Coverage Report

Created: 2018-07-12 09:57

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/clang-build/tools/clang/include/clang/AST/Attrs.inc
Line
Count
Source (jump to first uncovered line)
1
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2
|*                                                                            *|
3
|* Attribute classes' definitions                                             *|
4
|*                                                                            *|
5
|* Automatically generated file, do not edit!                                 *|
6
|*                                                                            *|
7
\*===----------------------------------------------------------------------===*/
8
9
#ifndef LLVM_CLANG_ATTR_CLASSES_INC
10
#define LLVM_CLANG_ATTR_CLASSES_INC
11
12
class AMDGPUFlatWorkGroupSizeAttr : public InheritableAttr {
13
unsigned min;
14
15
unsigned max;
16
17
public:
18
  static AMDGPUFlatWorkGroupSizeAttr *CreateImplicit(ASTContext &Ctx, unsigned Min, unsigned Max, SourceRange Loc = SourceRange()) {
19
    auto *A = new (Ctx) AMDGPUFlatWorkGroupSizeAttr(Loc, Ctx, Min, Max, 0);
20
    A->setImplicit(true);
21
    return A;
22
  }
23
24
  AMDGPUFlatWorkGroupSizeAttr(SourceRange R, ASTContext &Ctx
25
              , unsigned Min
26
              , unsigned Max
27
              , unsigned SI
28
             )
29
    : InheritableAttr(attr::AMDGPUFlatWorkGroupSize, R, SI, false, false)
30
              , min(Min)
31
              , max(Max)
32
86
  {
33
86
  }
34
35
  AMDGPUFlatWorkGroupSizeAttr *clone(ASTContext &C) const;
36
  void printPretty(raw_ostream &OS,
37
                   const PrintingPolicy &Policy) const;
38
  const char *getSpelling() const;
39
47
  unsigned getMin() const {
40
47
    return min;
41
47
  }
42
43
47
  unsigned getMax() const {
44
47
    return max;
45
47
  }
46
47
48
49
6.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::AMDGPUFlatWorkGroupSize; }
50
};
51
52
class AMDGPUNumSGPRAttr : public InheritableAttr {
53
unsigned numSGPR;
54
55
public:
56
  static AMDGPUNumSGPRAttr *CreateImplicit(ASTContext &Ctx, unsigned NumSGPR, SourceRange Loc = SourceRange()) {
57
    auto *A = new (Ctx) AMDGPUNumSGPRAttr(Loc, Ctx, NumSGPR, 0);
58
    A->setImplicit(true);
59
    return A;
60
  }
61
62
  AMDGPUNumSGPRAttr(SourceRange R, ASTContext &Ctx
63
              , unsigned NumSGPR
64
              , unsigned SI
65
             )
66
    : InheritableAttr(attr::AMDGPUNumSGPR, R, SI, false, false)
67
              , numSGPR(NumSGPR)
68
69
  {
69
69
  }
70
71
  AMDGPUNumSGPRAttr *clone(ASTContext &C) const;
72
  void printPretty(raw_ostream &OS,
73
                   const PrintingPolicy &Policy) const;
74
  const char *getSpelling() const;
75
37
  unsigned getNumSGPR() const {
76
37
    return numSGPR;
77
37
  }
78
79
80
81
6.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::AMDGPUNumSGPR; }
82
};
83
84
class AMDGPUNumVGPRAttr : public InheritableAttr {
85
unsigned numVGPR;
86
87
public:
88
  static AMDGPUNumVGPRAttr *CreateImplicit(ASTContext &Ctx, unsigned NumVGPR, SourceRange Loc = SourceRange()) {
89
    auto *A = new (Ctx) AMDGPUNumVGPRAttr(Loc, Ctx, NumVGPR, 0);
90
    A->setImplicit(true);
91
    return A;
92
  }
93
94
  AMDGPUNumVGPRAttr(SourceRange R, ASTContext &Ctx
95
              , unsigned NumVGPR
96
              , unsigned SI
97
             )
98
    : InheritableAttr(attr::AMDGPUNumVGPR, R, SI, false, false)
99
              , numVGPR(NumVGPR)
100
69
  {
101
69
  }
102
103
  AMDGPUNumVGPRAttr *clone(ASTContext &C) const;
104
  void printPretty(raw_ostream &OS,
105
                   const PrintingPolicy &Policy) const;
106
  const char *getSpelling() const;
107
37
  unsigned getNumVGPR() const {
108
37
    return numVGPR;
109
37
  }
110
111
112
113
6.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::AMDGPUNumVGPR; }
114
};
115
116
class AMDGPUWavesPerEUAttr : public InheritableAttr {
117
unsigned min;
118
119
unsigned max;
120
121
public:
122
  static AMDGPUWavesPerEUAttr *CreateImplicit(ASTContext &Ctx, unsigned Min, unsigned Max, SourceRange Loc = SourceRange()) {
123
    auto *A = new (Ctx) AMDGPUWavesPerEUAttr(Loc, Ctx, Min, Max, 0);
124
    A->setImplicit(true);
125
    return A;
126
  }
127
128
  AMDGPUWavesPerEUAttr(SourceRange R, ASTContext &Ctx
129
              , unsigned Min
130
              , unsigned Max
131
              , unsigned SI
132
             )
133
    : InheritableAttr(attr::AMDGPUWavesPerEU, R, SI, false, false)
134
              , min(Min)
135
              , max(Max)
136
107
  {
137
107
  }
138
139
  AMDGPUWavesPerEUAttr(SourceRange R, ASTContext &Ctx
140
              , unsigned Min
141
              , unsigned SI
142
             )
143
    : InheritableAttr(attr::AMDGPUWavesPerEU, R, SI, false, false)
144
              , min(Min)
145
              , max()
146
  {
147
  }
148
149
  AMDGPUWavesPerEUAttr *clone(ASTContext &C) const;
150
  void printPretty(raw_ostream &OS,
151
                   const PrintingPolicy &Policy) const;
152
  const char *getSpelling() const;
153
57
  unsigned getMin() const {
154
57
    return min;
155
57
  }
156
157
57
  unsigned getMax() const {
158
57
    return max;
159
57
  }
160
161
162
163
6.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::AMDGPUWavesPerEU; }
164
};
165
166
class ARMInterruptAttr : public InheritableAttr {
167
public:
168
  enum InterruptType {
169
    IRQ,
170
    FIQ,
171
    SWI,
172
    ABORT,
173
    UNDEF,
174
    Generic
175
  };
176
private:
177
  InterruptType interrupt;
178
179
public:
180
  static ARMInterruptAttr *CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, SourceRange Loc = SourceRange()) {
181
    auto *A = new (Ctx) ARMInterruptAttr(Loc, Ctx, Interrupt, 0);
182
    A->setImplicit(true);
183
    return A;
184
  }
185
186
  ARMInterruptAttr(SourceRange R, ASTContext &Ctx
187
              , InterruptType Interrupt
188
              , unsigned SI
189
             )
190
    : InheritableAttr(attr::ARMInterrupt, R, SI, false, false)
191
              , interrupt(Interrupt)
192
73
  {
193
73
  }
194
195
  ARMInterruptAttr(SourceRange R, ASTContext &Ctx
196
              , unsigned SI
197
             )
198
    : InheritableAttr(attr::ARMInterrupt, R, SI, false, false)
199
              , interrupt(InterruptType(0))
200
  {
201
  }
202
203
  ARMInterruptAttr *clone(ASTContext &C) const;
204
  void printPretty(raw_ostream &OS,
205
                   const PrintingPolicy &Policy) const;
206
  const char *getSpelling() const;
207
13
  InterruptType getInterrupt() const {
208
13
    return interrupt;
209
13
  }
210
211
78
  static bool ConvertStrToInterruptType(StringRef Val, InterruptType &Out) {
212
78
    Optional<InterruptType> R = llvm::StringSwitch<Optional<InterruptType>>(Val)
213
78
      .Case("IRQ", ARMInterruptAttr::IRQ)
214
78
      .Case("FIQ", ARMInterruptAttr::FIQ)
215
78
      .Case("SWI", ARMInterruptAttr::SWI)
216
78
      .Case("ABORT", ARMInterruptAttr::ABORT)
217
78
      .Case("UNDEF", ARMInterruptAttr::UNDEF)
218
78
      .Case("", ARMInterruptAttr::Generic)
219
78
      .Default(Optional<InterruptType>());
220
78
    if (R) {
221
73
      Out = *R;
222
73
      return true;
223
73
    }
224
5
    return false;
225
5
  }
226
227
0
  static const char *ConvertInterruptTypeToStr(InterruptType Val) {
228
0
    switch(Val) {
229
0
    case ARMInterruptAttr::IRQ: return "IRQ";
230
0
    case ARMInterruptAttr::FIQ: return "FIQ";
231
0
    case ARMInterruptAttr::SWI: return "SWI";
232
0
    case ARMInterruptAttr::ABORT: return "ABORT";
233
0
    case ARMInterruptAttr::UNDEF: return "UNDEF";
234
0
    case ARMInterruptAttr::Generic: return "";
235
0
    }
236
0
    llvm_unreachable("No enumerator with that value");
237
0
  }
238
239
240
4.36M
  static bool classof(const Attr *A) { return A->getKind() == attr::ARMInterrupt; }
241
};
242
243
class AVRInterruptAttr : public InheritableAttr {
244
public:
245
  static AVRInterruptAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
246
    auto *A = new (Ctx) AVRInterruptAttr(Loc, Ctx, 0);
247
    A->setImplicit(true);
248
    return A;
249
  }
250
251
  AVRInterruptAttr(SourceRange R, ASTContext &Ctx
252
              , unsigned SI
253
             )
254
    : InheritableAttr(attr::AVRInterrupt, R, SI, false, false)
255
2
  {
256
2
  }
257
258
  AVRInterruptAttr *clone(ASTContext &C) const;
259
  void printPretty(raw_ostream &OS,
260
                   const PrintingPolicy &Policy) const;
261
  const char *getSpelling() const;
262
263
264
3
  static bool classof(const Attr *A) { return A->getKind() == attr::AVRInterrupt; }
265
};
266
267
class AVRSignalAttr : public InheritableAttr {
268
public:
269
  static AVRSignalAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
270
    auto *A = new (Ctx) AVRSignalAttr(Loc, Ctx, 0);
271
    A->setImplicit(true);
272
    return A;
273
  }
274
275
  AVRSignalAttr(SourceRange R, ASTContext &Ctx
276
              , unsigned SI
277
             )
278
    : InheritableAttr(attr::AVRSignal, R, SI, false, false)
279
2
  {
280
2
  }
281
282
  AVRSignalAttr *clone(ASTContext &C) const;
283
  void printPretty(raw_ostream &OS,
284
                   const PrintingPolicy &Policy) const;
285
  const char *getSpelling() const;
286
287
288
3
  static bool classof(const Attr *A) { return A->getKind() == attr::AVRSignal; }
289
};
290
291
class AbiTagAttr : public Attr {
292
  unsigned tags_Size;
293
  StringRef *tags_;
294
295
public:
296
  static AbiTagAttr *CreateImplicit(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, SourceRange Loc = SourceRange()) {
297
    auto *A = new (Ctx) AbiTagAttr(Loc, Ctx, Tags, TagsSize, 0);
298
    A->setImplicit(true);
299
    return A;
300
  }
301
302
  AbiTagAttr(SourceRange R, ASTContext &Ctx
303
              , StringRef *Tags, unsigned TagsSize
304
              , unsigned SI
305
             )
306
    : Attr(attr::AbiTag, R, SI, false)
307
              , tags_Size(TagsSize), tags_(new (Ctx, 16) StringRef[tags_Size])
308
142
  {
309
345
    for (size_t I = 0, E = tags_Size; I != E;
310
203
         ++I) {
311
203
      StringRef Ref = Tags[I];
312
203
      if (!Ref.empty()) {
313
203
        char *Mem = new (Ctx, 1) char[Ref.size()];
314
203
        std::memcpy(Mem, Ref.data(), Ref.size());
315
203
        tags_[I] = StringRef(Mem, Ref.size());
316
203
      }
317
203
    }
318
142
  }
319
320
  AbiTagAttr(SourceRange R, ASTContext &Ctx
321
              , unsigned SI
322
             )
323
    : Attr(attr::AbiTag, R, SI, false)
324
              , tags_Size(0), tags_(nullptr)
325
  {
326
  }
327
328
  AbiTagAttr *clone(ASTContext &C) const;
329
  void printPretty(raw_ostream &OS,
330
                   const PrintingPolicy &Policy) const;
331
  const char *getSpelling() const;
332
  typedef StringRef* tags_iterator;
333
1.21k
  tags_iterator tags_begin() const { return tags_; }
334
1.21k
  tags_iterator tags_end() const { return tags_ + tags_Size; }
335
1
  unsigned tags_size() const { return tags_Size; }
336
1.20k
  llvm::iterator_range<tags_iterator> tags() const { return llvm::make_range(tags_begin(), tags_end()); }
337
338
339
340
341
1.58M
  static bool classof(const Attr *A) { return A->getKind() == attr::AbiTag; }
342
};
343
344
class AcquireCapabilityAttr : public InheritableAttr {
345
  unsigned args_Size;
346
  Expr * *args_;
347
348
public:
349
  enum Spelling {
350
    GNU_acquire_capability = 0,
351
    CXX11_clang_acquire_capability = 1,
352
    GNU_acquire_shared_capability = 2,
353
    CXX11_clang_acquire_shared_capability = 3,
354
    GNU_exclusive_lock_function = 4,
355
    GNU_shared_lock_function = 5
356
  };
357
358
  static AcquireCapabilityAttr *CreateImplicit(ASTContext &Ctx, Spelling S, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
359
    auto *A = new (Ctx) AcquireCapabilityAttr(Loc, Ctx, Args, ArgsSize, S);
360
    A->setImplicit(true);
361
    return A;
362
  }
363
364
  AcquireCapabilityAttr(SourceRange R, ASTContext &Ctx
365
              , Expr * *Args, unsigned ArgsSize
366
              , unsigned SI
367
             )
368
    : InheritableAttr(attr::AcquireCapability, R, SI, true, true)
369
              , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
370
466
  {
371
466
    std::copy(Args, Args + args_Size, args_);
372
466
  }
373
374
  AcquireCapabilityAttr(SourceRange R, ASTContext &Ctx
375
              , unsigned SI
376
             )
377
    : InheritableAttr(attr::AcquireCapability, R, SI, true, true)
378
              , args_Size(0), args_(nullptr)
379
  {
380
  }
381
382
  AcquireCapabilityAttr *clone(ASTContext &C) const;
383
  void printPretty(raw_ostream &OS,
384
                   const PrintingPolicy &Policy) const;
385
  const char *getSpelling() const;
386
  Spelling getSemanticSpelling() const {
387
  switch (SpellingListIndex) {
388
    default: llvm_unreachable("Unknown spelling list index");
389
    case 0: return GNU_acquire_capability;
390
    case 1: return CXX11_clang_acquire_capability;
391
    case 2: return GNU_acquire_shared_capability;
392
    case 3: return CXX11_clang_acquire_shared_capability;
393
    case 4: return GNU_exclusive_lock_function;
394
    case 5: return GNU_shared_lock_function;
395
  }
396
  }
397
1.58k
  bool isShared() const { return SpellingListIndex == 2 ||
398
1.58k
    SpellingListIndex == 3 ||
399
1.58k
    SpellingListIndex == 5; }
400
  typedef Expr ** args_iterator;
401
2.09k
  args_iterator args_begin() const { return args_; }
402
2.09k
  args_iterator args_end() const { return args_ + args_Size; }
403
1.71k
  unsigned args_size() const { return args_Size; }
404
2.08k
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
405
406
407
408
409
271k
  static bool classof(const Attr *A) { return A->getKind() == attr::AcquireCapability; }
410
};
411
412
class AcquiredAfterAttr : public InheritableAttr {
413
  unsigned args_Size;
414
  Expr * *args_;
415
416
public:
417
  static AcquiredAfterAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
418
    auto *A = new (Ctx) AcquiredAfterAttr(Loc, Ctx, Args, ArgsSize, 0);
419
    A->setImplicit(true);
420
    return A;
421
  }
422
423
  AcquiredAfterAttr(SourceRange R, ASTContext &Ctx
424
              , Expr * *Args, unsigned ArgsSize
425
              , unsigned SI
426
             )
427
    : InheritableAttr(attr::AcquiredAfter, R, SI, true, true)
428
              , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
429
134
  {
430
134
    std::copy(Args, Args + args_Size, args_);
431
134
  }
432
433
  AcquiredAfterAttr(SourceRange R, ASTContext &Ctx
434
              , unsigned SI
435
             )
436
    : InheritableAttr(attr::AcquiredAfter, R, SI, true, true)
437
              , args_Size(0), args_(nullptr)
438
  {
439
  }
440
441
  AcquiredAfterAttr *clone(ASTContext &C) const;
442
  void printPretty(raw_ostream &OS,
443
                   const PrintingPolicy &Policy) const;
444
  const char *getSpelling() const;
445
  typedef Expr ** args_iterator;
446
87
  args_iterator args_begin() const { return args_; }
447
87
  args_iterator args_end() const { return args_ + args_Size; }
448
1
  unsigned args_size() const { return args_Size; }
449
86
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
450
451
452
453
454
270k
  static bool classof(const Attr *A) { return A->getKind() == attr::AcquiredAfter; }
455
};
456
457
class AcquiredBeforeAttr : public InheritableAttr {
458
  unsigned args_Size;
459
  Expr * *args_;
460
461
public:
462
  static AcquiredBeforeAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
463
    auto *A = new (Ctx) AcquiredBeforeAttr(Loc, Ctx, Args, ArgsSize, 0);
464
    A->setImplicit(true);
465
    return A;
466
  }
467
468
  AcquiredBeforeAttr(SourceRange R, ASTContext &Ctx
469
              , Expr * *Args, unsigned ArgsSize
470
              , unsigned SI
471
             )
472
    : InheritableAttr(attr::AcquiredBefore, R, SI, true, true)
473
              , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
474
94
  {
475
94
    std::copy(Args, Args + args_Size, args_);
476
94
  }
477
478
  AcquiredBeforeAttr(SourceRange R, ASTContext &Ctx
479
              , unsigned SI
480
             )
481
    : InheritableAttr(attr::AcquiredBefore, R, SI, true, true)
482
              , args_Size(0), args_(nullptr)
483
  {
484
  }
485
486
  AcquiredBeforeAttr *clone(ASTContext &C) const;
487
  void printPretty(raw_ostream &OS,
488
                   const PrintingPolicy &Policy) const;
489
  const char *getSpelling() const;
490
  typedef Expr ** args_iterator;
491
52
  args_iterator args_begin() const { return args_; }
492
52
  args_iterator args_end() const { return args_ + args_Size; }
493
0
  unsigned args_size() const { return args_Size; }
494
52
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
495
496
497
498
499
270k
  static bool classof(const Attr *A) { return A->getKind() == attr::AcquiredBefore; }
500
};
501
502
class AliasAttr : public Attr {
503
unsigned aliaseeLength;
504
char *aliasee;
505
506
public:
507
17
  static AliasAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Loc = SourceRange()) {
508
17
    auto *A = new (Ctx) AliasAttr(Loc, Ctx, Aliasee, 0);
509
17
    A->setImplicit(true);
510
17
    return A;
511
17
  }
512
513
  AliasAttr(SourceRange R, ASTContext &Ctx
514
              , llvm::StringRef Aliasee
515
              , unsigned SI
516
             )
517
    : Attr(attr::Alias, R, SI, false)
518
              , aliaseeLength(Aliasee.size()),aliasee(new (Ctx, 1) char[aliaseeLength])
519
134
  {
520
134
      if (!Aliasee.empty())
521
134
        std::memcpy(aliasee, Aliasee.data(), aliaseeLength);
522
134
  }
523
524
  AliasAttr *clone(ASTContext &C) const;
525
  void printPretty(raw_ostream &OS,
526
                   const PrintingPolicy &Policy) const;
527
  const char *getSpelling() const;
528
203
  llvm::StringRef getAliasee() const {
529
203
    return llvm::StringRef(aliasee, aliaseeLength);
530
203
  }
531
  unsigned getAliaseeLength() const {
532
    return aliaseeLength;
533
  }
534
  void setAliasee(ASTContext &C, llvm::StringRef S) {
535
    aliaseeLength = S.size();
536
    this->aliasee = new (C, 1) char [aliaseeLength];
537
    if (!S.empty())
538
      std::memcpy(this->aliasee, S.data(), aliaseeLength);
539
  }
540
541
542
543
23.2M
  static bool classof(const Attr *A) { return A->getKind() == attr::Alias; }
544
};
545
546
class AlignMac68kAttr : public InheritableAttr {
547
public:
548
13
  static AlignMac68kAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
549
13
    auto *A = new (Ctx) AlignMac68kAttr(Loc, Ctx, 0);
550
13
    A->setImplicit(true);
551
13
    return A;
552
13
  }
553
554
  AlignMac68kAttr(SourceRange R, ASTContext &Ctx
555
              , unsigned SI
556
             )
557
    : InheritableAttr(attr::AlignMac68k, R, SI, false, false)
558
13
  {
559
13
  }
560
561
  AlignMac68kAttr *clone(ASTContext &C) const;
562
  void printPretty(raw_ostream &OS,
563
                   const PrintingPolicy &Policy) const;
564
  const char *getSpelling() const;
565
566
567
19.4k
  static bool classof(const Attr *A) { return A->getKind() == attr::AlignMac68k; }
568
};
569
570
class AlignValueAttr : public Attr {
571
Expr * alignment;
572
573
public:
574
0
  static AlignValueAttr *CreateImplicit(ASTContext &Ctx, Expr * Alignment, SourceRange Loc = SourceRange()) {
575
0
    auto *A = new (Ctx) AlignValueAttr(Loc, Ctx, Alignment, 0);
576
0
    A->setImplicit(true);
577
0
    return A;
578
0
  }
579
580
  AlignValueAttr(SourceRange R, ASTContext &Ctx
581
              , Expr * Alignment
582
              , unsigned SI
583
             )
584
    : Attr(attr::AlignValue, R, SI, false)
585
              , alignment(Alignment)
586
308
  {
587
308
  }
588
589
  AlignValueAttr *clone(ASTContext &C) const;
590
  void printPretty(raw_ostream &OS,
591
                   const PrintingPolicy &Policy) const;
592
  const char *getSpelling() const;
593
20
  Expr * getAlignment() const {
594
20
    return alignment;
595
20
  }
596
597
598
599
1.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::AlignValue; }
600
};
601
602
class AlignedAttr : public InheritableAttr {
603
bool isalignmentExpr;
604
union {
605
Expr *alignmentExpr;
606
TypeSourceInfo *alignmentType;
607
};
608
609
public:
610
  enum Spelling {
611
    GNU_aligned = 0,
612
    CXX11_gnu_aligned = 1,
613
    Declspec_align = 2,
614
    Keyword_alignas = 3,
615
    Keyword_Alignas = 4
616
  };
617
618
0
  static AlignedAttr *CreateImplicit(ASTContext &Ctx, Spelling S, bool IsAlignmentExpr, void *Alignment, SourceRange Loc = SourceRange()) {
619
0
    auto *A = new (Ctx) AlignedAttr(Loc, Ctx, IsAlignmentExpr, Alignment, S);
620
0
    A->setImplicit(true);
621
0
    return A;
622
0
  }
623
624
  AlignedAttr(SourceRange R, ASTContext &Ctx
625
              , bool IsAlignmentExpr, void *Alignment
626
              , unsigned SI
627
             )
628
    : InheritableAttr(attr::Aligned, R, SI, false, false)
629
              , isalignmentExpr(IsAlignmentExpr)
630
57.4k
  {
631
57.4k
    if (isalignmentExpr)
632
57.4k
       alignmentExpr = reinterpret_cast<Expr *>(Alignment);
633
0
    else
634
0
       alignmentType = reinterpret_cast<TypeSourceInfo *>(Alignment);
635
57.4k
  }
636
637
  AlignedAttr(SourceRange R, ASTContext &Ctx
638
              , unsigned SI
639
             )
640
    : InheritableAttr(attr::Aligned, R, SI, false, false)
641
              , isalignmentExpr(false)
642
  {
643
  }
644
645
  AlignedAttr *clone(ASTContext &C) const;
646
  void printPretty(raw_ostream &OS,
647
                   const PrintingPolicy &Policy) const;
648
  const char *getSpelling() const;
649
0
  Spelling getSemanticSpelling() const {
650
0
  switch (SpellingListIndex) {
651
0
    default: llvm_unreachable("Unknown spelling list index");
652
0
    case 0: return GNU_aligned;
653
0
    case 1: return CXX11_gnu_aligned;
654
0
    case 2: return Declspec_align;
655
0
    case 3: return Keyword_alignas;
656
0
    case 4: return Keyword_Alignas;
657
0
  }
658
0
  }
659
0
  bool isGNU() const { return SpellingListIndex == 0 ||
660
0
    SpellingListIndex == 1; }
661
7
  bool isC11() const { return SpellingListIndex == 4; }
662
63.2k
  bool isAlignas() const { return SpellingListIndex == 3 ||
663
63.2k
    
SpellingListIndex == 447.5k
; }
664
0
  bool isDeclspec() const { return SpellingListIndex == 2; }
665
  bool isAlignmentDependent() const;
666
  unsigned getAlignment(ASTContext &Ctx) const;
667
767
  bool isAlignmentExpr() const {
668
767
    return isalignmentExpr;
669
767
  }
670
525
  Expr *getAlignmentExpr() const {
671
525
    assert(isalignmentExpr);
672
525
    return alignmentExpr;
673
525
  }
674
0
  TypeSourceInfo *getAlignmentType() const {
675
0
    assert(!isalignmentExpr);
676
0
    return alignmentType;
677
0
  }
678
679
680
681
3.67M
  static bool classof(const Attr *A) { return A->getKind() == attr::Aligned; }
682
};
683
684
class AllocAlignAttr : public InheritableAttr {
685
ParamIdx paramIndex;
686
687
public:
688
  static AllocAlignAttr *CreateImplicit(ASTContext &Ctx, ParamIdx ParamIndex, SourceRange Loc = SourceRange()) {
689
    auto *A = new (Ctx) AllocAlignAttr(Loc, Ctx, ParamIndex, 0);
690
    A->setImplicit(true);
691
    return A;
692
  }
693
694
  AllocAlignAttr(SourceRange R, ASTContext &Ctx
695
              , ParamIdx ParamIndex
696
              , unsigned SI
697
             )
698
    : InheritableAttr(attr::AllocAlign, R, SI, false, false)
699
              , paramIndex(ParamIndex)
700
48
  {
701
48
  }
702
703
  AllocAlignAttr *clone(ASTContext &C) const;
704
  void printPretty(raw_ostream &OS,
705
                   const PrintingPolicy &Policy) const;
706
  const char *getSpelling() const;
707
20
  ParamIdx getParamIndex() const {
708
20
    return paramIndex;
709
20
  }
710
711
712
713
2.13M
  static bool classof(const Attr *A) { return A->getKind() == attr::AllocAlign; }
714
};
715
716
class AllocSizeAttr : public InheritableAttr {
717
ParamIdx elemSizeParam;
718
719
ParamIdx numElemsParam;
720
721
public:
722
  static AllocSizeAttr *CreateImplicit(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, SourceRange Loc = SourceRange()) {
723
    auto *A = new (Ctx) AllocSizeAttr(Loc, Ctx, ElemSizeParam, NumElemsParam, 0);
724
    A->setImplicit(true);
725
    return A;
726
  }
727
728
  AllocSizeAttr(SourceRange R, ASTContext &Ctx
729
              , ParamIdx ElemSizeParam
730
              , ParamIdx NumElemsParam
731
              , unsigned SI
732
             )
733
    : InheritableAttr(attr::AllocSize, R, SI, false, false)
734
              , elemSizeParam(ElemSizeParam)
735
              , numElemsParam(NumElemsParam)
736
10.6k
  {
737
10.6k
  }
738
739
  AllocSizeAttr(SourceRange R, ASTContext &Ctx
740
              , ParamIdx ElemSizeParam
741
              , unsigned SI
742
             )
743
    : InheritableAttr(attr::AllocSize, R, SI, false, false)
744
              , elemSizeParam(ElemSizeParam)
745
              , numElemsParam()
746
  {
747
  }
748
749
  AllocSizeAttr *clone(ASTContext &C) const;
750
  void printPretty(raw_ostream &OS,
751
                   const PrintingPolicy &Policy) const;
752
  const char *getSpelling() const;
753
3.07k
  ParamIdx getElemSizeParam() const {
754
3.07k
    return elemSizeParam;
755
3.07k
  }
756
757
3.91k
  ParamIdx getNumElemsParam() const {
758
3.91k
    return numElemsParam;
759
3.91k
  }
760
761
762
763
499k
  static bool classof(const Attr *A) { return A->getKind() == attr::AllocSize; }
764
};
765
766
class AlwaysInlineAttr : public InheritableAttr {
767
public:
768
  enum Spelling {
769
    GNU_always_inline = 0,
770
    CXX11_gnu_always_inline = 1,
771
    Keyword_forceinline = 2
772
  };
773
774
83.4k
  static AlwaysInlineAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
775
83.4k
    auto *A = new (Ctx) AlwaysInlineAttr(Loc, Ctx, S);
776
83.4k
    A->setImplicit(true);
777
83.4k
    return A;
778
83.4k
  }
779
780
  AlwaysInlineAttr(SourceRange R, ASTContext &Ctx
781
              , unsigned SI
782
             )
783
    : InheritableAttr(attr::AlwaysInline, R, SI, false, false)
784
2.47M
  {
785
2.47M
  }
786
787
  AlwaysInlineAttr *clone(ASTContext &C) const;
788
  void printPretty(raw_ostream &OS,
789
                   const PrintingPolicy &Policy) const;
790
  const char *getSpelling() const;
791
  Spelling getSemanticSpelling() const {
792
  switch (SpellingListIndex) {
793
    default: llvm_unreachable("Unknown spelling list index");
794
    case 0: return GNU_always_inline;
795
    case 1: return CXX11_gnu_always_inline;
796
    case 2: return Keyword_forceinline;
797
  }
798
  }
799
800
801
2.62M
  static bool classof(const Attr *A) { return A->getKind() == attr::AlwaysInline; }
802
};
803
804
class AnalyzerNoReturnAttr : public InheritableAttr {
805
public:
806
  static AnalyzerNoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
807
    auto *A = new (Ctx) AnalyzerNoReturnAttr(Loc, Ctx, 0);
808
    A->setImplicit(true);
809
    return A;
810
  }
811
812
  AnalyzerNoReturnAttr(SourceRange R, ASTContext &Ctx
813
              , unsigned SI
814
             )
815
    : InheritableAttr(attr::AnalyzerNoReturn, R, SI, false, false)
816
6
  {
817
6
  }
818
819
  AnalyzerNoReturnAttr *clone(ASTContext &C) const;
820
  void printPretty(raw_ostream &OS,
821
                   const PrintingPolicy &Policy) const;
822
  const char *getSpelling() const;
823
824
825
240k
  static bool classof(const Attr *A) { return A->getKind() == attr::AnalyzerNoReturn; }
826
};
827
828
class AnnotateAttr : public InheritableParamAttr {
829
unsigned annotationLength;
830
char *annotation;
831
832
public:
833
  static AnnotateAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, SourceRange Loc = SourceRange()) {
834
    auto *A = new (Ctx) AnnotateAttr(Loc, Ctx, Annotation, 0);
835
    A->setImplicit(true);
836
    return A;
837
  }
838
839
  AnnotateAttr(SourceRange R, ASTContext &Ctx
840
              , llvm::StringRef Annotation
841
              , unsigned SI
842
             )
843
    : InheritableParamAttr(attr::Annotate, R, SI, false, false)
844
              , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength])
845
322
  {
846
322
      if (!Annotation.empty())
847
322
        std::memcpy(annotation, Annotation.data(), annotationLength);
848
322
  }
849
850
  AnnotateAttr *clone(ASTContext &C) const;
851
  void printPretty(raw_ostream &OS,
852
                   const PrintingPolicy &Policy) const;
853
  const char *getSpelling() const;
854
702
  llvm::StringRef getAnnotation() const {
855
702
    return llvm::StringRef(annotation, annotationLength);
856
702
  }
857
  unsigned getAnnotationLength() const {
858
    return annotationLength;
859
  }
860
  void setAnnotation(ASTContext &C, llvm::StringRef S) {
861
    annotationLength = S.size();
862
    this->annotation = new (C, 1) char [annotationLength];
863
    if (!S.empty())
864
      std::memcpy(this->annotation, S.data(), annotationLength);
865
  }
866
867
868
869
390k
  static bool classof(const Attr *A) { return A->getKind() == attr::Annotate; }
870
};
871
872
class AnyX86InterruptAttr : public InheritableAttr {
873
public:
874
  static AnyX86InterruptAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
875
    auto *A = new (Ctx) AnyX86InterruptAttr(Loc, Ctx, 0);
876
    A->setImplicit(true);
877
    return A;
878
  }
879
880
  AnyX86InterruptAttr(SourceRange R, ASTContext &Ctx
881
              , unsigned SI
882
             )
883
    : InheritableAttr(attr::AnyX86Interrupt, R, SI, false, false)
884
59
  {
885
59
  }
886
887
  AnyX86InterruptAttr *clone(ASTContext &C) const;
888
  void printPretty(raw_ostream &OS,
889
                   const PrintingPolicy &Policy) const;
890
  const char *getSpelling() const;
891
892
893
3.97M
  static bool classof(const Attr *A) { return A->getKind() == attr::AnyX86Interrupt; }
894
};
895
896
class AnyX86NoCallerSavedRegistersAttr : public InheritableAttr {
897
public:
898
  static AnyX86NoCallerSavedRegistersAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
899
    auto *A = new (Ctx) AnyX86NoCallerSavedRegistersAttr(Loc, Ctx, 0);
900
    A->setImplicit(true);
901
    return A;
902
  }
903
904
  AnyX86NoCallerSavedRegistersAttr(SourceRange R, ASTContext &Ctx
905
              , unsigned SI
906
             )
907
    : InheritableAttr(attr::AnyX86NoCallerSavedRegisters, R, SI, false, false)
908
25
  {
909
25
  }
910
911
  AnyX86NoCallerSavedRegistersAttr *clone(ASTContext &C) const;
912
  void printPretty(raw_ostream &OS,
913
                   const PrintingPolicy &Policy) const;
914
  const char *getSpelling() const;
915
916
917
496k
  static bool classof(const Attr *A) { return A->getKind() == attr::AnyX86NoCallerSavedRegisters; }
918
};
919
920
class AnyX86NoCfCheckAttr : public InheritableAttr {
921
public:
922
  static AnyX86NoCfCheckAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
923
    auto *A = new (Ctx) AnyX86NoCfCheckAttr(Loc, Ctx, 0);
924
    A->setImplicit(true);
925
    return A;
926
  }
927
928
  AnyX86NoCfCheckAttr(SourceRange R, ASTContext &Ctx
929
              , unsigned SI
930
             )
931
    : InheritableAttr(attr::AnyX86NoCfCheck, R, SI, false, false)
932
10
  {
933
10
  }
934
935
  AnyX86NoCfCheckAttr *clone(ASTContext &C) const;
936
  void printPretty(raw_ostream &OS,
937
                   const PrintingPolicy &Policy) const;
938
  const char *getSpelling() const;
939
940
941
496k
  static bool classof(const Attr *A) { return A->getKind() == attr::AnyX86NoCfCheck; }
942
};
943
944
class ArcWeakrefUnavailableAttr : public InheritableAttr {
945
public:
946
  static ArcWeakrefUnavailableAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
947
    auto *A = new (Ctx) ArcWeakrefUnavailableAttr(Loc, Ctx, 0);
948
    A->setImplicit(true);
949
    return A;
950
  }
951
952
  ArcWeakrefUnavailableAttr(SourceRange R, ASTContext &Ctx
953
              , unsigned SI
954
             )
955
    : InheritableAttr(attr::ArcWeakrefUnavailable, R, SI, false, false)
956
63
  {
957
63
  }
958
959
  ArcWeakrefUnavailableAttr *clone(ASTContext &C) const;
960
  void printPretty(raw_ostream &OS,
961
                   const PrintingPolicy &Policy) const;
962
  const char *getSpelling() const;
963
964
965
81
  static bool classof(const Attr *A) { return A->getKind() == attr::ArcWeakrefUnavailable; }
966
};
967
968
class ArgumentWithTypeTagAttr : public InheritableAttr {
969
IdentifierInfo * argumentKind;
970
971
ParamIdx argumentIdx;
972
973
ParamIdx typeTagIdx;
974
975
bool isPointer;
976
977
public:
978
  enum Spelling {
979
    GNU_argument_with_type_tag = 0,
980
    CXX11_clang_argument_with_type_tag = 1,
981
    C2x_clang_argument_with_type_tag = 2,
982
    GNU_pointer_with_type_tag = 3,
983
    CXX11_clang_pointer_with_type_tag = 4,
984
    C2x_clang_pointer_with_type_tag = 5
985
  };
986
987
  static ArgumentWithTypeTagAttr *CreateImplicit(ASTContext &Ctx, Spelling S, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, SourceRange Loc = SourceRange()) {
988
    auto *A = new (Ctx) ArgumentWithTypeTagAttr(Loc, Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer, S);
989
    A->setImplicit(true);
990
    return A;
991
  }
992
993
  static ArgumentWithTypeTagAttr *CreateImplicit(ASTContext &Ctx, Spelling S, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, SourceRange Loc = SourceRange()) {
994
    auto *A = new (Ctx) ArgumentWithTypeTagAttr(Loc, Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, S);
995
    A->setImplicit(true);
996
    return A;
997
  }
998
999
  ArgumentWithTypeTagAttr(SourceRange R, ASTContext &Ctx
1000
              , IdentifierInfo * ArgumentKind
1001
              , ParamIdx ArgumentIdx
1002
              , ParamIdx TypeTagIdx
1003
              , bool IsPointer
1004
              , unsigned SI
1005
             )
1006
    : InheritableAttr(attr::ArgumentWithTypeTag, R, SI, false, false)
1007
              , argumentKind(ArgumentKind)
1008
              , argumentIdx(ArgumentIdx)
1009
              , typeTagIdx(TypeTagIdx)
1010
              , isPointer(IsPointer)
1011
73
  {
1012
73
  }
1013
1014
  ArgumentWithTypeTagAttr(SourceRange R, ASTContext &Ctx
1015
              , IdentifierInfo * ArgumentKind
1016
              , ParamIdx ArgumentIdx
1017
              , ParamIdx TypeTagIdx
1018
              , unsigned SI
1019
             )
1020
    : InheritableAttr(attr::ArgumentWithTypeTag, R, SI, false, false)
1021
              , argumentKind(ArgumentKind)
1022
              , argumentIdx(ArgumentIdx)
1023
              , typeTagIdx(TypeTagIdx)
1024
              , isPointer()
1025
  {
1026
  }
1027
1028
  ArgumentWithTypeTagAttr *clone(ASTContext &C) const;
1029
  void printPretty(raw_ostream &OS,
1030
                   const PrintingPolicy &Policy) const;
1031
  const char *getSpelling() const;
1032
  Spelling getSemanticSpelling() const {
1033
  switch (SpellingListIndex) {
1034
    default: llvm_unreachable("Unknown spelling list index");
1035
    case 0: return GNU_argument_with_type_tag;
1036
    case 1: return CXX11_clang_argument_with_type_tag;
1037
    case 2: return C2x_clang_argument_with_type_tag;
1038
    case 3: return GNU_pointer_with_type_tag;
1039
    case 4: return CXX11_clang_pointer_with_type_tag;
1040
    case 5: return C2x_clang_pointer_with_type_tag;
1041
  }
1042
  }
1043
430
  IdentifierInfo * getArgumentKind() const {
1044
430
    return argumentKind;
1045
430
  }
1046
1047
389
  ParamIdx getArgumentIdx() const {
1048
389
    return argumentIdx;
1049
389
  }
1050
1051
423
  ParamIdx getTypeTagIdx() const {
1052
423
    return typeTagIdx;
1053
423
  }
1054
1055
411
  bool getIsPointer() const {
1056
411
    return isPointer;
1057
411
  }
1058
1059
1060
1061
3.66M
  static bool classof(const Attr *A) { return A->getKind() == attr::ArgumentWithTypeTag; }
1062
};
1063
1064
class ArtificialAttr : public InheritableAttr {
1065
public:
1066
  static ArtificialAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1067
    auto *A = new (Ctx) ArtificialAttr(Loc, Ctx, 0);
1068
    A->setImplicit(true);
1069
    return A;
1070
  }
1071
1072
  ArtificialAttr(SourceRange R, ASTContext &Ctx
1073
              , unsigned SI
1074
             )
1075
    : InheritableAttr(attr::Artificial, R, SI, false, false)
1076
36
  {
1077
36
  }
1078
1079
  ArtificialAttr *clone(ASTContext &C) const;
1080
  void printPretty(raw_ostream &OS,
1081
                   const PrintingPolicy &Policy) const;
1082
  const char *getSpelling() const;
1083
1084
1085
32.5k
  static bool classof(const Attr *A) { return A->getKind() == attr::Artificial; }
1086
};
1087
1088
class AsmLabelAttr : public InheritableAttr {
1089
unsigned labelLength;
1090
char *label;
1091
1092
public:
1093
9
  static AsmLabelAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, SourceRange Loc = SourceRange()) {
1094
9
    auto *A = new (Ctx) AsmLabelAttr(Loc, Ctx, Label, 0);
1095
9
    A->setImplicit(true);
1096
9
    return A;
1097
9
  }
1098
1099
  AsmLabelAttr(SourceRange R, ASTContext &Ctx
1100
              , llvm::StringRef Label
1101
              , unsigned SI
1102
             )
1103
    : InheritableAttr(attr::AsmLabel, R, SI, false, false)
1104
              , labelLength(Label.size()),label(new (Ctx, 1) char[labelLength])
1105
91.1k
  {
1106
91.1k
      if (!Label.empty())
1107
91.1k
        std::memcpy(label, Label.data(), labelLength);
1108
91.1k
  }
1109
1110
  AsmLabelAttr *clone(ASTContext &C) const;
1111
  void printPretty(raw_ostream &OS,
1112
                   const PrintingPolicy &Policy) const;
1113
  const char *getSpelling() const;
1114
5.53k
  llvm::StringRef getLabel() const {
1115
5.53k
    return llvm::StringRef(label, labelLength);
1116
5.53k
  }
1117
  unsigned getLabelLength() const {
1118
    return labelLength;
1119
  }
1120
  void setLabel(ASTContext &C, llvm::StringRef S) {
1121
    labelLength = S.size();
1122
    this->label = new (C, 1) char [labelLength];
1123
    if (!S.empty())
1124
      std::memcpy(this->label, S.data(), labelLength);
1125
  }
1126
1127
1128
1129
4.64M
  static bool classof(const Attr *A) { return A->getKind() == attr::AsmLabel; }
1130
};
1131
1132
class AssertCapabilityAttr : public InheritableAttr {
1133
  unsigned args_Size;
1134
  Expr * *args_;
1135
1136
public:
1137
  enum Spelling {
1138
    GNU_assert_capability = 0,
1139
    CXX11_clang_assert_capability = 1,
1140
    GNU_assert_shared_capability = 2,
1141
    CXX11_clang_assert_shared_capability = 3
1142
  };
1143
1144
  static AssertCapabilityAttr *CreateImplicit(ASTContext &Ctx, Spelling S, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
1145
    auto *A = new (Ctx) AssertCapabilityAttr(Loc, Ctx, Args, ArgsSize, S);
1146
    A->setImplicit(true);
1147
    return A;
1148
  }
1149
1150
  AssertCapabilityAttr(SourceRange R, ASTContext &Ctx
1151
              , Expr * *Args, unsigned ArgsSize
1152
              , unsigned SI
1153
             )
1154
    : InheritableAttr(attr::AssertCapability, R, SI, true, true)
1155
              , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
1156
36
  {
1157
36
    std::copy(Args, Args + args_Size, args_);
1158
36
  }
1159
1160
  AssertCapabilityAttr(SourceRange R, ASTContext &Ctx
1161
              , unsigned SI
1162
             )
1163
    : InheritableAttr(attr::AssertCapability, R, SI, true, true)
1164
              , args_Size(0), args_(nullptr)
1165
  {
1166
  }
1167
1168
  AssertCapabilityAttr *clone(ASTContext &C) const;
1169
  void printPretty(raw_ostream &OS,
1170
                   const PrintingPolicy &Policy) const;
1171
  const char *getSpelling() const;
1172
  Spelling getSemanticSpelling() const {
1173
  switch (SpellingListIndex) {
1174
    default: llvm_unreachable("Unknown spelling list index");
1175
    case 0: return GNU_assert_capability;
1176
    case 1: return CXX11_clang_assert_capability;
1177
    case 2: return GNU_assert_shared_capability;
1178
    case 3: return CXX11_clang_assert_shared_capability;
1179
  }
1180
  }
1181
44
  bool isShared() const { return SpellingListIndex == 2 ||
1182
44
    
SpellingListIndex == 334
; }
1183
  typedef Expr ** args_iterator;
1184
58
  args_iterator args_begin() const { return args_; }
1185
58
  args_iterator args_end() const { return args_ + args_Size; }
1186
40
  unsigned args_size() const { return args_Size; }
1187
58
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
1188
1189
1190
1191
1192
  static bool classof(const Attr *A) { return A->getKind() == attr::AssertCapability; }
1193
};
1194
1195
class AssertExclusiveLockAttr : public InheritableAttr {
1196
  unsigned args_Size;
1197
  Expr * *args_;
1198
1199
public:
1200
  static AssertExclusiveLockAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
1201
    auto *A = new (Ctx) AssertExclusiveLockAttr(Loc, Ctx, Args, ArgsSize, 0);
1202
    A->setImplicit(true);
1203
    return A;
1204
  }
1205
1206
  AssertExclusiveLockAttr(SourceRange R, ASTContext &Ctx
1207
              , Expr * *Args, unsigned ArgsSize
1208
              , unsigned SI
1209
             )
1210
    : InheritableAttr(attr::AssertExclusiveLock, R, SI, true, true)
1211
              , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
1212
21
  {
1213
21
    std::copy(Args, Args + args_Size, args_);
1214
21
  }
1215
1216
  AssertExclusiveLockAttr(SourceRange R, ASTContext &Ctx
1217
              , unsigned SI
1218
             )
1219
    : InheritableAttr(attr::AssertExclusiveLock, R, SI, true, true)
1220
              , args_Size(0), args_(nullptr)
1221
  {
1222
  }
1223
1224
  AssertExclusiveLockAttr *clone(ASTContext &C) const;
1225
  void printPretty(raw_ostream &OS,
1226
                   const PrintingPolicy &Policy) const;
1227
  const char *getSpelling() const;
1228
  typedef Expr ** args_iterator;
1229
42
  args_iterator args_begin() const { return args_; }
1230
42
  args_iterator args_end() const { return args_ + args_Size; }
1231
32
  unsigned args_size() const { return args_Size; }
1232
42
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
1233
1234
1235
1236
1237
  static bool classof(const Attr *A) { return A->getKind() == attr::AssertExclusiveLock; }
1238
};
1239
1240
class AssertSharedLockAttr : public InheritableAttr {
1241
  unsigned args_Size;
1242
  Expr * *args_;
1243
1244
public:
1245
  static AssertSharedLockAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
1246
    auto *A = new (Ctx) AssertSharedLockAttr(Loc, Ctx, Args, ArgsSize, 0);
1247
    A->setImplicit(true);
1248
    return A;
1249
  }
1250
1251
  AssertSharedLockAttr(SourceRange R, ASTContext &Ctx
1252
              , Expr * *Args, unsigned ArgsSize
1253
              , unsigned SI
1254
             )
1255
    : InheritableAttr(attr::AssertSharedLock, R, SI, true, true)
1256
              , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
1257
19
  {
1258
19
    std::copy(Args, Args + args_Size, args_);
1259
19
  }
1260
1261
  AssertSharedLockAttr(SourceRange R, ASTContext &Ctx
1262
              , unsigned SI
1263
             )
1264
    : InheritableAttr(attr::AssertSharedLock, R, SI, true, true)
1265
              , args_Size(0), args_(nullptr)
1266
  {
1267
  }
1268
1269
  AssertSharedLockAttr *clone(ASTContext &C) const;
1270
  void printPretty(raw_ostream &OS,
1271
                   const PrintingPolicy &Policy) const;
1272
  const char *getSpelling() const;
1273
  typedef Expr ** args_iterator;
1274
16
  args_iterator args_begin() const { return args_; }
1275
16
  args_iterator args_end() const { return args_ + args_Size; }
1276
8
  unsigned args_size() const { return args_Size; }
1277
16
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
1278
1279
1280
1281
1282
  static bool classof(const Attr *A) { return A->getKind() == attr::AssertSharedLock; }
1283
};
1284
1285
class AssumeAlignedAttr : public InheritableAttr {
1286
Expr * alignment;
1287
1288
Expr * offset;
1289
1290
public:
1291
  static AssumeAlignedAttr *CreateImplicit(ASTContext &Ctx, Expr * Alignment, Expr * Offset, SourceRange Loc = SourceRange()) {
1292
    auto *A = new (Ctx) AssumeAlignedAttr(Loc, Ctx, Alignment, Offset, 0);
1293
    A->setImplicit(true);
1294
    return A;
1295
  }
1296
1297
  AssumeAlignedAttr(SourceRange R, ASTContext &Ctx
1298
              , Expr * Alignment
1299
              , Expr * Offset
1300
              , unsigned SI
1301
             )
1302
    : InheritableAttr(attr::AssumeAligned, R, SI, false, false)
1303
              , alignment(Alignment)
1304
              , offset(Offset)
1305
46
  {
1306
46
  }
1307
1308
  AssumeAlignedAttr(SourceRange R, ASTContext &Ctx
1309
              , Expr * Alignment
1310
              , unsigned SI
1311
             )
1312
    : InheritableAttr(attr::AssumeAligned, R, SI, false, false)
1313
              , alignment(Alignment)
1314
              , offset()
1315
  {
1316
  }
1317
1318
  AssumeAlignedAttr *clone(ASTContext &C) const;
1319
  void printPretty(raw_ostream &OS,
1320
                   const PrintingPolicy &Policy) const;
1321
  const char *getSpelling() const;
1322
12
  Expr * getAlignment() const {
1323
12
    return alignment;
1324
12
  }
1325
1326
13
  Expr * getOffset() const {
1327
13
    return offset;
1328
13
  }
1329
1330
1331
1332
2.13M
  static bool classof(const Attr *A) { return A->getKind() == attr::AssumeAligned; }
1333
};
1334
1335
class AvailabilityAttr : public InheritableAttr {
1336
IdentifierInfo * platform;
1337
1338
VersionTuple introduced;
1339
1340
1341
VersionTuple deprecated;
1342
1343
1344
VersionTuple obsoleted;
1345
1346
1347
bool unavailable;
1348
1349
unsigned messageLength;
1350
char *message;
1351
1352
bool strict;
1353
1354
unsigned replacementLength;
1355
char *replacement;
1356
1357
public:
1358
  static AvailabilityAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * Platform, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool Unavailable, llvm::StringRef Message, bool Strict, llvm::StringRef Replacement, SourceRange Loc = SourceRange()) {
1359
    auto *A = new (Ctx) AvailabilityAttr(Loc, Ctx, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, 0);
1360
    A->setImplicit(true);
1361
    return A;
1362
  }
1363
1364
  AvailabilityAttr(SourceRange R, ASTContext &Ctx
1365
              , IdentifierInfo * Platform
1366
              , VersionTuple Introduced
1367
              , VersionTuple Deprecated
1368
              , VersionTuple Obsoleted
1369
              , bool Unavailable
1370
              , llvm::StringRef Message
1371
              , bool Strict
1372
              , llvm::StringRef Replacement
1373
              , unsigned SI
1374
             )
1375
    : InheritableAttr(attr::Availability, R, SI, false, true)
1376
              , platform(Platform)
1377
              , introduced(Introduced)
1378
              , deprecated(Deprecated)
1379
              , obsoleted(Obsoleted)
1380
              , unavailable(Unavailable)
1381
              , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
1382
              , strict(Strict)
1383
              , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength])
1384
643k
  {
1385
643k
      if (!Message.empty())
1386
37.2k
        std::memcpy(message, Message.data(), messageLength);
1387
643k
      if (!Replacement.empty())
1388
368
        std::memcpy(replacement, Replacement.data(), replacementLength);
1389
643k
  }
1390
1391
  AvailabilityAttr *clone(ASTContext &C) const;
1392
  void printPretty(raw_ostream &OS,
1393
                   const PrintingPolicy &Policy) const;
1394
  const char *getSpelling() const;
1395
991k
  IdentifierInfo * getPlatform() const {
1396
991k
    return platform;
1397
991k
  }
1398
1399
182k
  VersionTuple getIntroduced() const {
1400
182k
    return introduced;
1401
182k
  }
1402
  void setIntroduced(ASTContext &C, VersionTuple V) {
1403
    introduced = V;
1404
  }
1405
1406
121k
  VersionTuple getDeprecated() const {
1407
121k
    return deprecated;
1408
121k
  }
1409
  void setDeprecated(ASTContext &C, VersionTuple V) {
1410
    deprecated = V;
1411
  }
1412
1413
116k
  VersionTuple getObsoleted() const {
1414
116k
    return obsoleted;
1415
116k
  }
1416
  void setObsoleted(ASTContext &C, VersionTuple V) {
1417
    obsoleted = V;
1418
  }
1419
1420
96.0k
  bool getUnavailable() const {
1421
96.0k
    return unavailable;
1422
96.0k
  }
1423
1424
102k
  llvm::StringRef getMessage() const {
1425
102k
    return llvm::StringRef(message, messageLength);
1426
102k
  }
1427
  unsigned getMessageLength() const {
1428
    return messageLength;
1429
  }
1430
  void setMessage(ASTContext &C, llvm::StringRef S) {
1431
    messageLength = S.size();
1432
    this->message = new (C, 1) char [messageLength];
1433
    if (!S.empty())
1434
      std::memcpy(this->message, S.data(), messageLength);
1435
  }
1436
1437
10.3k
  bool getStrict() const {
1438
10.3k
    return strict;
1439
10.3k
  }
1440
1441
31.0k
  llvm::StringRef getReplacement() const {
1442
31.0k
    return llvm::StringRef(replacement, replacementLength);
1443
31.0k
  }
1444
  unsigned getReplacementLength() const {
1445
    return replacementLength;
1446
  }
1447
  void setReplacement(ASTContext &C, llvm::StringRef S) {
1448
    replacementLength = S.size();
1449
    this->replacement = new (C, 1) char [replacementLength];
1450
    if (!S.empty())
1451
      std::memcpy(this->replacement, S.data(), replacementLength);
1452
  }
1453
1454
1.32M
static llvm::StringRef getPrettyPlatformName(llvm::StringRef Platform) {
1455
1.32M
    return llvm::StringSwitch<llvm::StringRef>(Platform)
1456
1.32M
             .Case("android", "Android")
1457
1.32M
             .Case("ios", "iOS")
1458
1.32M
             .Case("macos", "macOS")
1459
1.32M
             .Case("tvos", "tvOS")
1460
1.32M
             .Case("watchos", "watchOS")
1461
1.32M
             .Case("ios_app_extension", "iOS (App Extension)")
1462
1.32M
             .Case("macos_app_extension", "macOS (App Extension)")
1463
1.32M
             .Case("tvos_app_extension", "tvOS (App Extension)")
1464
1.32M
             .Case("watchos_app_extension", "watchOS (App Extension)")
1465
1.32M
             .Default(llvm::StringRef());
1466
1.32M
}
1467
324
static llvm::StringRef getPlatformNameSourceSpelling(llvm::StringRef Platform) {
1468
324
    return llvm::StringSwitch<llvm::StringRef>(Platform)
1469
324
             .Case("ios", "iOS")
1470
324
             .Case("macos", "macOS")
1471
324
             .Case("tvos", "tvOS")
1472
324
             .Case("watchos", "watchOS")
1473
324
             .Case("ios_app_extension", "iOSApplicationExtension")
1474
324
             .Case("macos_app_extension", "macOSApplicationExtension")
1475
324
             .Case("tvos_app_extension", "tvOSApplicationExtension")
1476
324
             .Case("watchos_app_extension", "watchOSApplicationExtension")
1477
324
             .Default(Platform);
1478
324
}
1479
557k
static llvm::StringRef canonicalizePlatformName(llvm::StringRef Platform) {
1480
557k
    return llvm::StringSwitch<llvm::StringRef>(Platform)
1481
557k
             .Case("iOS", "ios")
1482
557k
             .Case("macOS", "macos")
1483
557k
             .Case("tvOS", "tvos")
1484
557k
             .Case("watchOS", "watchos")
1485
557k
             .Case("iOSApplicationExtension", "ios_app_extension")
1486
557k
             .Case("macOSApplicationExtension", "macos_app_extension")
1487
557k
             .Case("tvOSApplicationExtension", "tvos_app_extension")
1488
557k
             .Case("watchOSApplicationExtension", "watchos_app_extension")
1489
557k
             .Default(Platform);
1490
557k
} 
1491
1492
13.2M
  static bool classof(const Attr *A) { return A->getKind() == attr::Availability; }
1493
};
1494
1495
class BlocksAttr : public InheritableAttr {
1496
public:
1497
  enum BlockType {
1498
    ByRef
1499
  };
1500
private:
1501
  BlockType type;
1502
1503
public:
1504
  static BlocksAttr *CreateImplicit(ASTContext &Ctx, BlockType Type, SourceRange Loc = SourceRange()) {
1505
    auto *A = new (Ctx) BlocksAttr(Loc, Ctx, Type, 0);
1506
    A->setImplicit(true);
1507
    return A;
1508
  }
1509
1510
  BlocksAttr(SourceRange R, ASTContext &Ctx
1511
              , BlockType Type
1512
              , unsigned SI
1513
             )
1514
    : InheritableAttr(attr::Blocks, R, SI, false, false)
1515
              , type(Type)
1516
506
  {
1517
506
  }
1518
1519
  BlocksAttr *clone(ASTContext &C) const;
1520
  void printPretty(raw_ostream &OS,
1521
                   const PrintingPolicy &Policy) const;
1522
  const char *getSpelling() const;
1523
4
  BlockType getType() const {
1524
4
    return type;
1525
4
  }
1526
1527
501
  static bool ConvertStrToBlockType(StringRef Val, BlockType &Out) {
1528
501
    Optional<BlockType> R = llvm::StringSwitch<Optional<BlockType>>(Val)
1529
501
      .Case("byref", BlocksAttr::ByRef)
1530
501
      .Default(Optional<BlockType>());
1531
501
    if (R) {
1532
501
      Out = *R;
1533
501
      return true;
1534
501
    }
1535
0
    return false;
1536
0
  }
1537
1538
2
  static const char *ConvertBlockTypeToStr(BlockType Val) {
1539
2
    switch(Val) {
1540
2
    case BlocksAttr::ByRef: return "byref";
1541
0
    }
1542
0
    llvm_unreachable("No enumerator with that value");
1543
0
  }
1544
1545
1546
331k
  static bool classof(const Attr *A) { return A->getKind() == attr::Blocks; }
1547
};
1548
1549
class C11NoReturnAttr : public InheritableAttr {
1550
public:
1551
  static C11NoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1552
    auto *A = new (Ctx) C11NoReturnAttr(Loc, Ctx, 0);
1553
    A->setImplicit(true);
1554
    return A;
1555
  }
1556
1557
  C11NoReturnAttr(SourceRange R, ASTContext &Ctx
1558
              , unsigned SI
1559
             )
1560
    : InheritableAttr(attr::C11NoReturn, R, SI, false, false)
1561
37
  {
1562
37
  }
1563
1564
  C11NoReturnAttr *clone(ASTContext &C) const;
1565
  void printPretty(raw_ostream &OS,
1566
                   const PrintingPolicy &Policy) const;
1567
  const char *getSpelling() const;
1568
1569
1570
4.87M
  static bool classof(const Attr *A) { return A->getKind() == attr::C11NoReturn; }
1571
};
1572
1573
class CDeclAttr : public InheritableAttr {
1574
public:
1575
  static CDeclAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1576
    auto *A = new (Ctx) CDeclAttr(Loc, Ctx, 0);
1577
    A->setImplicit(true);
1578
    return A;
1579
  }
1580
1581
  CDeclAttr(SourceRange R, ASTContext &Ctx
1582
              , unsigned SI
1583
             )
1584
    : InheritableAttr(attr::CDecl, R, SI, false, false)
1585
0
  {
1586
0
  }
1587
1588
  CDeclAttr *clone(ASTContext &C) const;
1589
  void printPretty(raw_ostream &OS,
1590
                   const PrintingPolicy &Policy) const;
1591
  const char *getSpelling() const;
1592
1593
1594
  static bool classof(const Attr *A) { return A->getKind() == attr::CDecl; }
1595
};
1596
1597
class CFAuditedTransferAttr : public InheritableAttr {
1598
public:
1599
26.5k
  static CFAuditedTransferAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1600
26.5k
    auto *A = new (Ctx) CFAuditedTransferAttr(Loc, Ctx, 0);
1601
26.5k
    A->setImplicit(true);
1602
26.5k
    return A;
1603
26.5k
  }
1604
1605
  CFAuditedTransferAttr(SourceRange R, ASTContext &Ctx
1606
              , unsigned SI
1607
             )
1608
    : InheritableAttr(attr::CFAuditedTransfer, R, SI, false, false)
1609
26.5k
  {
1610
26.5k
  }
1611
1612
  CFAuditedTransferAttr *clone(ASTContext &C) const;
1613
  void printPretty(raw_ostream &OS,
1614
                   const PrintingPolicy &Policy) const;
1615
  const char *getSpelling() const;
1616
1617
1618
17.1k
  static bool classof(const Attr *A) { return A->getKind() == attr::CFAuditedTransfer; }
1619
};
1620
1621
class CFConsumedAttr : public InheritableParamAttr {
1622
public:
1623
  static CFConsumedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1624
    auto *A = new (Ctx) CFConsumedAttr(Loc, Ctx, 0);
1625
    A->setImplicit(true);
1626
    return A;
1627
  }
1628
1629
  CFConsumedAttr(SourceRange R, ASTContext &Ctx
1630
              , unsigned SI
1631
             )
1632
    : InheritableParamAttr(attr::CFConsumed, R, SI, false, false)
1633
437
  {
1634
437
  }
1635
1636
  CFConsumedAttr *clone(ASTContext &C) const;
1637
  void printPretty(raw_ostream &OS,
1638
                   const PrintingPolicy &Policy) const;
1639
  const char *getSpelling() const;
1640
1641
1642
1.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::CFConsumed; }
1643
};
1644
1645
class CFReturnsNotRetainedAttr : public InheritableAttr {
1646
public:
1647
  static CFReturnsNotRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1648
    auto *A = new (Ctx) CFReturnsNotRetainedAttr(Loc, Ctx, 0);
1649
    A->setImplicit(true);
1650
    return A;
1651
  }
1652
1653
  CFReturnsNotRetainedAttr(SourceRange R, ASTContext &Ctx
1654
              , unsigned SI
1655
             )
1656
    : InheritableAttr(attr::CFReturnsNotRetained, R, SI, false, false)
1657
77
  {
1658
77
  }
1659
1660
  CFReturnsNotRetainedAttr *clone(ASTContext &C) const;
1661
  void printPretty(raw_ostream &OS,
1662
                   const PrintingPolicy &Policy) const;
1663
  const char *getSpelling() const;
1664
1665
1666
136
  static bool classof(const Attr *A) { return A->getKind() == attr::CFReturnsNotRetained; }
1667
};
1668
1669
class CFReturnsRetainedAttr : public InheritableAttr {
1670
public:
1671
  static CFReturnsRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1672
    auto *A = new (Ctx) CFReturnsRetainedAttr(Loc, Ctx, 0);
1673
    A->setImplicit(true);
1674
    return A;
1675
  }
1676
1677
  CFReturnsRetainedAttr(SourceRange R, ASTContext &Ctx
1678
              , unsigned SI
1679
             )
1680
    : InheritableAttr(attr::CFReturnsRetained, R, SI, false, false)
1681
528
  {
1682
528
  }
1683
1684
  CFReturnsRetainedAttr *clone(ASTContext &C) const;
1685
  void printPretty(raw_ostream &OS,
1686
                   const PrintingPolicy &Policy) const;
1687
  const char *getSpelling() const;
1688
1689
1690
181
  static bool classof(const Attr *A) { return A->getKind() == attr::CFReturnsRetained; }
1691
};
1692
1693
class CFUnknownTransferAttr : public InheritableAttr {
1694
public:
1695
  static CFUnknownTransferAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1696
    auto *A = new (Ctx) CFUnknownTransferAttr(Loc, Ctx, 0);
1697
    A->setImplicit(true);
1698
    return A;
1699
  }
1700
1701
  CFUnknownTransferAttr(SourceRange R, ASTContext &Ctx
1702
              , unsigned SI
1703
             )
1704
    : InheritableAttr(attr::CFUnknownTransfer, R, SI, false, false)
1705
1
  {
1706
1
  }
1707
1708
  CFUnknownTransferAttr *clone(ASTContext &C) const;
1709
  void printPretty(raw_ostream &OS,
1710
                   const PrintingPolicy &Policy) const;
1711
  const char *getSpelling() const;
1712
1713
1714
16.8k
  static bool classof(const Attr *A) { return A->getKind() == attr::CFUnknownTransfer; }
1715
};
1716
1717
class CUDAConstantAttr : public InheritableAttr {
1718
public:
1719
  static CUDAConstantAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1720
    auto *A = new (Ctx) CUDAConstantAttr(Loc, Ctx, 0);
1721
    A->setImplicit(true);
1722
    return A;
1723
  }
1724
1725
  CUDAConstantAttr(SourceRange R, ASTContext &Ctx
1726
              , unsigned SI
1727
             )
1728
    : InheritableAttr(attr::CUDAConstant, R, SI, false, false)
1729
109
  {
1730
109
  }
1731
1732
  CUDAConstantAttr *clone(ASTContext &C) const;
1733
  void printPretty(raw_ostream &OS,
1734
                   const PrintingPolicy &Policy) const;
1735
  const char *getSpelling() const;
1736
1737
1738
705
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDAConstant; }
1739
};
1740
1741
class CUDADeviceAttr : public InheritableAttr {
1742
public:
1743
2.72k
  static CUDADeviceAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1744
2.72k
    auto *A = new (Ctx) CUDADeviceAttr(Loc, Ctx, 0);
1745
2.72k
    A->setImplicit(true);
1746
2.72k
    return A;
1747
2.72k
  }
1748
1749
  CUDADeviceAttr(SourceRange R, ASTContext &Ctx
1750
              , unsigned SI
1751
             )
1752
    : InheritableAttr(attr::CUDADevice, R, SI, false, false)
1753
3.93k
  {
1754
3.93k
  }
1755
1756
  CUDADeviceAttr *clone(ASTContext &C) const;
1757
  void printPretty(raw_ostream &OS,
1758
                   const PrintingPolicy &Policy) const;
1759
  const char *getSpelling() const;
1760
1761
1762
29.0k
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDADevice; }
1763
};
1764
1765
class CUDAGlobalAttr : public InheritableAttr {
1766
public:
1767
  static CUDAGlobalAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1768
    auto *A = new (Ctx) CUDAGlobalAttr(Loc, Ctx, 0);
1769
    A->setImplicit(true);
1770
    return A;
1771
  }
1772
1773
  CUDAGlobalAttr(SourceRange R, ASTContext &Ctx
1774
              , unsigned SI
1775
             )
1776
    : InheritableAttr(attr::CUDAGlobal, R, SI, false, false)
1777
156
  {
1778
156
  }
1779
1780
  CUDAGlobalAttr *clone(ASTContext &C) const;
1781
  void printPretty(raw_ostream &OS,
1782
                   const PrintingPolicy &Policy) const;
1783
  const char *getSpelling() const;
1784
1785
1786
7.30M
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDAGlobal; }
1787
};
1788
1789
class CUDAHostAttr : public InheritableAttr {
1790
public:
1791
1.75k
  static CUDAHostAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1792
1.75k
    auto *A = new (Ctx) CUDAHostAttr(Loc, Ctx, 0);
1793
1.75k
    A->setImplicit(true);
1794
1.75k
    return A;
1795
1.75k
  }
1796
1797
  CUDAHostAttr(SourceRange R, ASTContext &Ctx
1798
              , unsigned SI
1799
             )
1800
    : InheritableAttr(attr::CUDAHost, R, SI, false, false)
1801
2.24k
  {
1802
2.24k
  }
1803
1804
  CUDAHostAttr *clone(ASTContext &C) const;
1805
  void printPretty(raw_ostream &OS,
1806
                   const PrintingPolicy &Policy) const;
1807
  const char *getSpelling() const;
1808
1809
1810
38.1k
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDAHost; }
1811
};
1812
1813
class CUDAInvalidTargetAttr : public InheritableAttr {
1814
public:
1815
15
  static CUDAInvalidTargetAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1816
15
    auto *A = new (Ctx) CUDAInvalidTargetAttr(Loc, Ctx, 0);
1817
15
    A->setImplicit(true);
1818
15
    return A;
1819
15
  }
1820
1821
  CUDAInvalidTargetAttr(SourceRange R, ASTContext &Ctx
1822
              , unsigned SI
1823
             )
1824
    : InheritableAttr(attr::CUDAInvalidTarget, R, SI, false, false)
1825
15
  {
1826
15
  }
1827
1828
  CUDAInvalidTargetAttr *clone(ASTContext &C) const;
1829
  void printPretty(raw_ostream &OS,
1830
                   const PrintingPolicy &Policy) const;
1831
  const char *getSpelling() const;
1832
1833
1834
46.2k
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDAInvalidTarget; }
1835
};
1836
1837
class CUDALaunchBoundsAttr : public InheritableAttr {
1838
Expr * maxThreads;
1839
1840
Expr * minBlocks;
1841
1842
public:
1843
  static CUDALaunchBoundsAttr *CreateImplicit(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, SourceRange Loc = SourceRange()) {
1844
    auto *A = new (Ctx) CUDALaunchBoundsAttr(Loc, Ctx, MaxThreads, MinBlocks, 0);
1845
    A->setImplicit(true);
1846
    return A;
1847
  }
1848
1849
  CUDALaunchBoundsAttr(SourceRange R, ASTContext &Ctx
1850
              , Expr * MaxThreads
1851
              , Expr * MinBlocks
1852
              , unsigned SI
1853
             )
1854
    : InheritableAttr(attr::CUDALaunchBounds, R, SI, false, false)
1855
              , maxThreads(MaxThreads)
1856
              , minBlocks(MinBlocks)
1857
60
  {
1858
60
  }
1859
1860
  CUDALaunchBoundsAttr(SourceRange R, ASTContext &Ctx
1861
              , Expr * MaxThreads
1862
              , unsigned SI
1863
             )
1864
    : InheritableAttr(attr::CUDALaunchBounds, R, SI, false, false)
1865
              , maxThreads(MaxThreads)
1866
              , minBlocks()
1867
  {
1868
  }
1869
1870
  CUDALaunchBoundsAttr *clone(ASTContext &C) const;
1871
  void printPretty(raw_ostream &OS,
1872
                   const PrintingPolicy &Policy) const;
1873
  const char *getSpelling() const;
1874
14
  Expr * getMaxThreads() const {
1875
14
    return maxThreads;
1876
14
  }
1877
1878
24
  Expr * getMinBlocks() const {
1879
24
    return minBlocks;
1880
24
  }
1881
1882
1883
1884
1.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDALaunchBounds; }
1885
};
1886
1887
class CUDASharedAttr : public InheritableAttr {
1888
public:
1889
  static CUDASharedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1890
    auto *A = new (Ctx) CUDASharedAttr(Loc, Ctx, 0);
1891
    A->setImplicit(true);
1892
    return A;
1893
  }
1894
1895
  CUDASharedAttr(SourceRange R, ASTContext &Ctx
1896
              , unsigned SI
1897
             )
1898
    : InheritableAttr(attr::CUDAShared, R, SI, false, false)
1899
185
  {
1900
185
  }
1901
1902
  CUDASharedAttr *clone(ASTContext &C) const;
1903
  void printPretty(raw_ostream &OS,
1904
                   const PrintingPolicy &Policy) const;
1905
  const char *getSpelling() const;
1906
1907
1908
841
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDAShared; }
1909
};
1910
1911
class CXX11NoReturnAttr : public InheritableAttr {
1912
public:
1913
  static CXX11NoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1914
    auto *A = new (Ctx) CXX11NoReturnAttr(Loc, Ctx, 0);
1915
    A->setImplicit(true);
1916
    return A;
1917
  }
1918
1919
  CXX11NoReturnAttr(SourceRange R, ASTContext &Ctx
1920
              , unsigned SI
1921
             )
1922
    : InheritableAttr(attr::CXX11NoReturn, R, SI, false, false)
1923
9.99k
  {
1924
9.99k
  }
1925
1926
  CXX11NoReturnAttr *clone(ASTContext &C) const;
1927
  void printPretty(raw_ostream &OS,
1928
                   const PrintingPolicy &Policy) const;
1929
  const char *getSpelling() const;
1930
1931
1932
4.98M
  static bool classof(const Attr *A) { return A->getKind() == attr::CXX11NoReturn; }
1933
};
1934
1935
class CallableWhenAttr : public InheritableAttr {
1936
public:
1937
  enum ConsumedState {
1938
    Unknown,
1939
    Consumed,
1940
    Unconsumed
1941
  };
1942
private:
1943
  unsigned callableStates_Size;
1944
  ConsumedState *callableStates_;
1945
1946
public:
1947
  static CallableWhenAttr *CreateImplicit(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, SourceRange Loc = SourceRange()) {
1948
    auto *A = new (Ctx) CallableWhenAttr(Loc, Ctx, CallableStates, CallableStatesSize, 0);
1949
    A->setImplicit(true);
1950
    return A;
1951
  }
1952
1953
  CallableWhenAttr(SourceRange R, ASTContext &Ctx
1954
              , ConsumedState *CallableStates, unsigned CallableStatesSize
1955
              , unsigned SI
1956
             )
1957
    : InheritableAttr(attr::CallableWhen, R, SI, false, false)
1958
              , callableStates_Size(CallableStatesSize), callableStates_(new (Ctx, 16) ConsumedState[callableStates_Size])
1959
18
  {
1960
18
    std::copy(CallableStates, CallableStates + callableStates_Size, callableStates_);
1961
18
  }
1962
1963
  CallableWhenAttr(SourceRange R, ASTContext &Ctx
1964
              , unsigned SI
1965
             )
1966
    : InheritableAttr(attr::CallableWhen, R, SI, false, false)
1967
              , callableStates_Size(0), callableStates_(nullptr)
1968
  {
1969
  }
1970
1971
  CallableWhenAttr *clone(ASTContext &C) const;
1972
  void printPretty(raw_ostream &OS,
1973
                   const PrintingPolicy &Policy) const;
1974
  const char *getSpelling() const;
1975
  typedef ConsumedState* callableStates_iterator;
1976
204
  callableStates_iterator callableStates_begin() const { return callableStates_; }
1977
204
  callableStates_iterator callableStates_end() const { return callableStates_ + callableStates_Size; }
1978
0
  unsigned callableStates_size() const { return callableStates_Size; }
1979
204
  llvm::iterator_range<callableStates_iterator> callableStates() const { return llvm::make_range(callableStates_begin(), callableStates_end()); }
1980
1981
1982
19
  static bool ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) {
1983
19
    Optional<ConsumedState> R = llvm::StringSwitch<Optional<ConsumedState>>(Val)
1984
19
      .Case("unknown", CallableWhenAttr::Unknown)
1985
19
      .Case("consumed", CallableWhenAttr::Consumed)
1986
19
      .Case("unconsumed", CallableWhenAttr::Unconsumed)
1987
19
      .Default(Optional<ConsumedState>());
1988
19
    if (R) {
1989
18
      Out = *R;
1990
18
      return true;
1991
18
    }
1992
1
    return false;
1993
1
  }
1994
1995
2
  static const char *ConvertConsumedStateToStr(ConsumedState Val) {
1996
2
    switch(Val) {
1997
2
    
case CallableWhenAttr::Unknown: return "unknown"0
;
1998
2
    
case CallableWhenAttr::Consumed: return "consumed"1
;
1999
2
    
case CallableWhenAttr::Unconsumed: return "unconsumed"1
;
2000
0
    }
2001
0
    llvm_unreachable("No enumerator with that value");
2002
0
  }
2003
2004
2005
476
  static bool classof(const Attr *A) { return A->getKind() == attr::CallableWhen; }
2006
};
2007
2008
class CapabilityAttr : public InheritableAttr {
2009
unsigned nameLength;
2010
char *name;
2011
2012
public:
2013
  enum Spelling {
2014
    GNU_capability = 0,
2015
    CXX11_clang_capability = 1,
2016
    GNU_shared_capability = 2,
2017
    CXX11_clang_shared_capability = 3
2018
  };
2019
2020
  static CapabilityAttr *CreateImplicit(ASTContext &Ctx, Spelling S, llvm::StringRef Name, SourceRange Loc = SourceRange()) {
2021
    auto *A = new (Ctx) CapabilityAttr(Loc, Ctx, Name, S);
2022
    A->setImplicit(true);
2023
    return A;
2024
  }
2025
2026
  CapabilityAttr(SourceRange R, ASTContext &Ctx
2027
              , llvm::StringRef Name
2028
              , unsigned SI
2029
             )
2030
    : InheritableAttr(attr::Capability, R, SI, false, false)
2031
              , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
2032
72
  {
2033
72
      if (!Name.empty())
2034
72
        std::memcpy(name, Name.data(), nameLength);
2035
72
  }
2036
2037
  CapabilityAttr *clone(ASTContext &C) const;
2038
  void printPretty(raw_ostream &OS,
2039
                   const PrintingPolicy &Policy) const;
2040
  const char *getSpelling() const;
2041
  Spelling getSemanticSpelling() const {
2042
  switch (SpellingListIndex) {
2043
    default: llvm_unreachable("Unknown spelling list index");
2044
    case 0: return GNU_capability;
2045
    case 1: return CXX11_clang_capability;
2046
    case 2: return GNU_shared_capability;
2047
    case 3: return CXX11_clang_shared_capability;
2048
  }
2049
  }
2050
  bool isShared() const { return SpellingListIndex == 2 ||
2051
    SpellingListIndex == 3; }
2052
3.57k
  llvm::StringRef getName() const {
2053
3.57k
    return llvm::StringRef(name, nameLength);
2054
3.57k
  }
2055
  unsigned getNameLength() const {
2056
    return nameLength;
2057
  }
2058
  void setName(ASTContext &C, llvm::StringRef S) {
2059
    nameLength = S.size();
2060
    this->name = new (C, 1) char [nameLength];
2061
    if (!S.empty())
2062
      std::memcpy(this->name, S.data(), nameLength);
2063
  }
2064
2065
2066
    bool isMutex() const { return getName().equals_lower("mutex"); }
2067
    bool isRole() const { return getName().equals_lower("role"); }
2068
  
2069
2070
9.58k
  static bool classof(const Attr *A) { return A->getKind() == attr::Capability; }
2071
};
2072
2073
class CapturedRecordAttr : public InheritableAttr {
2074
public:
2075
289k
  static CapturedRecordAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2076
289k
    auto *A = new (Ctx) CapturedRecordAttr(Loc, Ctx, 0);
2077
289k
    A->setImplicit(true);
2078
289k
    return A;
2079
289k
  }
2080
2081
  CapturedRecordAttr(SourceRange R, ASTContext &Ctx
2082
              , unsigned SI
2083
             )
2084
    : InheritableAttr(attr::CapturedRecord, R, SI, false, false)
2085
308k
  {
2086
308k
  }
2087
2088
  CapturedRecordAttr *clone(ASTContext &C) const;
2089
  void printPretty(raw_ostream &OS,
2090
                   const PrintingPolicy &Policy) const;
2091
  const char *getSpelling() const;
2092
2093
2094
0
  static bool classof(const Attr *A) { return A->getKind() == attr::CapturedRecord; }
2095
};
2096
2097
class CarriesDependencyAttr : public InheritableParamAttr {
2098
public:
2099
  static CarriesDependencyAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2100
    auto *A = new (Ctx) CarriesDependencyAttr(Loc, Ctx, 0);
2101
    A->setImplicit(true);
2102
    return A;
2103
  }
2104
2105
  CarriesDependencyAttr(SourceRange R, ASTContext &Ctx
2106
              , unsigned SI
2107
             )
2108
    : InheritableParamAttr(attr::CarriesDependency, R, SI, false, false)
2109
25
  {
2110
25
  }
2111
2112
  CarriesDependencyAttr *clone(ASTContext &C) const;
2113
  void printPretty(raw_ostream &OS,
2114
                   const PrintingPolicy &Policy) const;
2115
  const char *getSpelling() const;
2116
2117
2118
100k
  static bool classof(const Attr *A) { return A->getKind() == attr::CarriesDependency; }
2119
};
2120
2121
class CleanupAttr : public InheritableAttr {
2122
FunctionDecl * functionDecl;
2123
2124
public:
2125
  static CleanupAttr *CreateImplicit(ASTContext &Ctx, FunctionDecl * FunctionDecl, SourceRange Loc = SourceRange()) {
2126
    auto *A = new (Ctx) CleanupAttr(Loc, Ctx, FunctionDecl, 0);
2127
    A->setImplicit(true);
2128
    return A;
2129
  }
2130
2131
  CleanupAttr(SourceRange R, ASTContext &Ctx
2132
              , FunctionDecl * FunctionDecl
2133
              , unsigned SI
2134
             )
2135
    : InheritableAttr(attr::Cleanup, R, SI, false, false)
2136
              , functionDecl(FunctionDecl)
2137
27
  {
2138
27
  }
2139
2140
  CleanupAttr *clone(ASTContext &C) const;
2141
  void printPretty(raw_ostream &OS,
2142
                   const PrintingPolicy &Policy) const;
2143
  const char *getSpelling() const;
2144
8
  FunctionDecl * getFunctionDecl() const {
2145
8
    return functionDecl;
2146
8
  }
2147
2148
2149
2150
112k
  static bool classof(const Attr *A) { return A->getKind() == attr::Cleanup; }
2151
};
2152
2153
class ColdAttr : public InheritableAttr {
2154
public:
2155
  static ColdAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2156
    auto *A = new (Ctx) ColdAttr(Loc, Ctx, 0);
2157
    A->setImplicit(true);
2158
    return A;
2159
  }
2160
2161
  ColdAttr(SourceRange R, ASTContext &Ctx
2162
              , unsigned SI
2163
             )
2164
    : InheritableAttr(attr::Cold, R, SI, false, false)
2165
34
  {
2166
34
  }
2167
2168
  ColdAttr *clone(ASTContext &C) const;
2169
  void printPretty(raw_ostream &OS,
2170
                   const PrintingPolicy &Policy) const;
2171
  const char *getSpelling() const;
2172
2173
2174
628k
  static bool classof(const Attr *A) { return A->getKind() == attr::Cold; }
2175
};
2176
2177
class CommonAttr : public InheritableAttr {
2178
public:
2179
  static CommonAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2180
    auto *A = new (Ctx) CommonAttr(Loc, Ctx, 0);
2181
    A->setImplicit(true);
2182
    return A;
2183
  }
2184
2185
  CommonAttr(SourceRange R, ASTContext &Ctx
2186
              , unsigned SI
2187
             )
2188
    : InheritableAttr(attr::Common, R, SI, false, false)
2189
7
  {
2190
7
  }
2191
2192
  CommonAttr *clone(ASTContext &C) const;
2193
  void printPretty(raw_ostream &OS,
2194
                   const PrintingPolicy &Policy) const;
2195
  const char *getSpelling() const;
2196
2197
2198
239k
  static bool classof(const Attr *A) { return A->getKind() == attr::Common; }
2199
};
2200
2201
class ConstAttr : public InheritableAttr {
2202
public:
2203
342k
  static ConstAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2204
342k
    auto *A = new (Ctx) ConstAttr(Loc, Ctx, 0);
2205
342k
    A->setImplicit(true);
2206
342k
    return A;
2207
342k
  }
2208
2209
  ConstAttr(SourceRange R, ASTContext &Ctx
2210
              , unsigned SI
2211
             )
2212
    : InheritableAttr(attr::Const, R, SI, false, false)
2213
626k
  {
2214
626k
  }
2215
2216
  ConstAttr *clone(ASTContext &C) const;
2217
  void printPretty(raw_ostream &OS,
2218
                   const PrintingPolicy &Policy) const;
2219
  const char *getSpelling() const;
2220
2221
2222
1.55M
  static bool classof(const Attr *A) { return A->getKind() == attr::Const; }
2223
};
2224
2225
class ConstructorAttr : public InheritableAttr {
2226
int priority;
2227
2228
public:
2229
  static ConstructorAttr *CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Loc = SourceRange()) {
2230
    auto *A = new (Ctx) ConstructorAttr(Loc, Ctx, Priority, 0);
2231
    A->setImplicit(true);
2232
    return A;
2233
  }
2234
2235
  ConstructorAttr(SourceRange R, ASTContext &Ctx
2236
              , int Priority
2237
              , unsigned SI
2238
             )
2239
    : InheritableAttr(attr::Constructor, R, SI, false, false)
2240
              , priority(Priority)
2241
63
  {
2242
63
  }
2243
2244
  ConstructorAttr(SourceRange R, ASTContext &Ctx
2245
              , unsigned SI
2246
             )
2247
    : InheritableAttr(attr::Constructor, R, SI, false, false)
2248
              , priority()
2249
  {
2250
  }
2251
2252
  ConstructorAttr *clone(ASTContext &C) const;
2253
  void printPretty(raw_ostream &OS,
2254
                   const PrintingPolicy &Policy) const;
2255
  const char *getSpelling() const;
2256
25
  int getPriority() const {
2257
25
    return priority;
2258
25
  }
2259
2260
  static const int DefaultPriority = 65535;
2261
2262
2263
2264
6.33M
  static bool classof(const Attr *A) { return A->getKind() == attr::Constructor; }
2265
};
2266
2267
class ConsumableAttr : public InheritableAttr {
2268
public:
2269
  enum ConsumedState {
2270
    Unknown,
2271
    Consumed,
2272
    Unconsumed
2273
  };
2274
private:
2275
  ConsumedState defaultState;
2276
2277
public:
2278
  static ConsumableAttr *CreateImplicit(ASTContext &Ctx, ConsumedState DefaultState, SourceRange Loc = SourceRange()) {
2279
    auto *A = new (Ctx) ConsumableAttr(Loc, Ctx, DefaultState, 0);
2280
    A->setImplicit(true);
2281
    return A;
2282
  }
2283
2284
  ConsumableAttr(SourceRange R, ASTContext &Ctx
2285
              , ConsumedState DefaultState
2286
              , unsigned SI
2287
             )
2288
    : InheritableAttr(attr::Consumable, R, SI, false, false)
2289
              , defaultState(DefaultState)
2290
8
  {
2291
8
  }
2292
2293
  ConsumableAttr *clone(ASTContext &C) const;
2294
  void printPretty(raw_ostream &OS,
2295
                   const PrintingPolicy &Policy) const;
2296
  const char *getSpelling() const;
2297
43
  ConsumedState getDefaultState() const {
2298
43
    return defaultState;
2299
43
  }
2300
2301
6
  static bool ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) {
2302
6
    Optional<ConsumedState> R = llvm::StringSwitch<Optional<ConsumedState>>(Val)
2303
6
      .Case("unknown", ConsumableAttr::Unknown)
2304
6
      .Case("consumed", ConsumableAttr::Consumed)
2305
6
      .Case("unconsumed", ConsumableAttr::Unconsumed)
2306
6
      .Default(Optional<ConsumedState>());
2307
6
    if (R) {
2308
6
      Out = *R;
2309
6
      return true;
2310
6
    }
2311
0
    return false;
2312
0
  }
2313
2314
1
  static const char *ConvertConsumedStateToStr(ConsumedState Val) {
2315
1
    switch(Val) {
2316
1
    case ConsumableAttr::Unknown: return "unknown";
2317
1
    
case ConsumableAttr::Consumed: return "consumed"0
;
2318
1
    
case ConsumableAttr::Unconsumed: return "unconsumed"0
;
2319
0
    }
2320
0
    llvm_unreachable("No enumerator with that value");
2321
0
  }
2322
2323
2324
691
  static bool classof(const Attr *A) { return A->getKind() == attr::Consumable; }
2325
};
2326
2327
class ConsumableAutoCastAttr : public InheritableAttr {
2328
public:
2329
  static ConsumableAutoCastAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2330
    auto *A = new (Ctx) ConsumableAutoCastAttr(Loc, Ctx, 0);
2331
    A->setImplicit(true);
2332
    return A;
2333
  }
2334
2335
  ConsumableAutoCastAttr(SourceRange R, ASTContext &Ctx
2336
              , unsigned SI
2337
             )
2338
    : InheritableAttr(attr::ConsumableAutoCast, R, SI, false, false)
2339
2
  {
2340
2
  }
2341
2342
  ConsumableAutoCastAttr *clone(ASTContext &C) const;
2343
  void printPretty(raw_ostream &OS,
2344
                   const PrintingPolicy &Policy) const;
2345
  const char *getSpelling() const;
2346
2347
2348
7
  static bool classof(const Attr *A) { return A->getKind() == attr::ConsumableAutoCast; }
2349
};
2350
2351
class ConsumableSetOnReadAttr : public InheritableAttr {
2352
public:
2353
  static ConsumableSetOnReadAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2354
    auto *A = new (Ctx) ConsumableSetOnReadAttr(Loc, Ctx, 0);
2355
    A->setImplicit(true);
2356
    return A;
2357
  }
2358
2359
  ConsumableSetOnReadAttr(SourceRange R, ASTContext &Ctx
2360
              , unsigned SI
2361
             )
2362
    : InheritableAttr(attr::ConsumableSetOnRead, R, SI, false, false)
2363
2
  {
2364
2
  }
2365
2366
  ConsumableSetOnReadAttr *clone(ASTContext &C) const;
2367
  void printPretty(raw_ostream &OS,
2368
                   const PrintingPolicy &Policy) const;
2369
  const char *getSpelling() const;
2370
2371
2372
18
  static bool classof(const Attr *A) { return A->getKind() == attr::ConsumableSetOnRead; }
2373
};
2374
2375
class ConvergentAttr : public InheritableAttr {
2376
public:
2377
  static ConvergentAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2378
    auto *A = new (Ctx) ConvergentAttr(Loc, Ctx, 0);
2379
    A->setImplicit(true);
2380
    return A;
2381
  }
2382
2383
  ConvergentAttr(SourceRange R, ASTContext &Ctx
2384
              , unsigned SI
2385
             )
2386
    : InheritableAttr(attr::Convergent, R, SI, false, false)
2387
2.79k
  {
2388
2.79k
  }
2389
2390
  ConvergentAttr *clone(ASTContext &C) const;
2391
  void printPretty(raw_ostream &OS,
2392
                   const PrintingPolicy &Policy) const;
2393
  const char *getSpelling() const;
2394
2395
2396
496k
  static bool classof(const Attr *A) { return A->getKind() == attr::Convergent; }
2397
};
2398
2399
class DLLExportAttr : public InheritableAttr {
2400
public:
2401
  static DLLExportAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2402
    auto *A = new (Ctx) DLLExportAttr(Loc, Ctx, 0);
2403
    A->setImplicit(true);
2404
    return A;
2405
  }
2406
2407
  DLLExportAttr(SourceRange R, ASTContext &Ctx
2408
              , unsigned SI
2409
             )
2410
    : InheritableAttr(attr::DLLExport, R, SI, false, false)
2411
6.86k
  {
2412
6.86k
  }
2413
2414
  DLLExportAttr *clone(ASTContext &C) const;
2415
  void printPretty(raw_ostream &OS,
2416
                   const PrintingPolicy &Policy) const;
2417
  const char *getSpelling() const;
2418
2419
2420
15.6M
  static bool classof(const Attr *A) { return A->getKind() == attr::DLLExport; }
2421
};
2422
2423
class DLLImportAttr : public InheritableAttr {
2424
public:
2425
  static DLLImportAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2426
    auto *A = new (Ctx) DLLImportAttr(Loc, Ctx, 0);
2427
    A->setImplicit(true);
2428
    return A;
2429
  }
2430
2431
  DLLImportAttr(SourceRange R, ASTContext &Ctx
2432
              , unsigned SI
2433
             )
2434
    : InheritableAttr(attr::DLLImport, R, SI, false, false)
2435
6.52k
  {
2436
6.52k
  }
2437
2438
  DLLImportAttr *clone(ASTContext &C) const;
2439
  void printPretty(raw_ostream &OS,
2440
                   const PrintingPolicy &Policy) const;
2441
  const char *getSpelling() const;
2442
2443
private:
2444
  bool PropagatedToBaseTemplate = false;
2445
2446
public:
2447
50
  void setPropagatedToBaseTemplate() { PropagatedToBaseTemplate = true; }
2448
671
  bool wasPropagatedToBaseTemplate() { return PropagatedToBaseTemplate; }
2449
  
2450
2451
18.9M
  static bool classof(const Attr *A) { return A->getKind() == attr::DLLImport; }
2452
};
2453
2454
class DeprecatedAttr : public InheritableAttr {
2455
unsigned messageLength;
2456
char *message;
2457
2458
unsigned replacementLength;
2459
char *replacement;
2460
2461
public:
2462
  static DeprecatedAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, SourceRange Loc = SourceRange()) {
2463
    auto *A = new (Ctx) DeprecatedAttr(Loc, Ctx, Message, Replacement, 0);
2464
    A->setImplicit(true);
2465
    return A;
2466
  }
2467
2468
  DeprecatedAttr(SourceRange R, ASTContext &Ctx
2469
              , llvm::StringRef Message
2470
              , llvm::StringRef Replacement
2471
              , unsigned SI
2472
             )
2473
    : InheritableAttr(attr::Deprecated, R, SI, false, false)
2474
              , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2475
              , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength])
2476
15.0k
  {
2477
15.0k
      if (!Message.empty())
2478
5.83k
        std::memcpy(message, Message.data(), messageLength);
2479
15.0k
      if (!Replacement.empty())
2480
68
        std::memcpy(replacement, Replacement.data(), replacementLength);
2481
15.0k
  }
2482
2483
  DeprecatedAttr(SourceRange R, ASTContext &Ctx
2484
              , unsigned SI
2485
             )
2486
    : InheritableAttr(attr::Deprecated, R, SI, false, false)
2487
              , messageLength(0),message(nullptr)
2488
              , replacementLength(0),replacement(nullptr)
2489
  {
2490
  }
2491
2492
  DeprecatedAttr *clone(ASTContext &C) const;
2493
  void printPretty(raw_ostream &OS,
2494
                   const PrintingPolicy &Policy) const;
2495
  const char *getSpelling() const;
2496
3.89k
  llvm::StringRef getMessage() const {
2497
3.89k
    return llvm::StringRef(message, messageLength);
2498
3.89k
  }
2499
  unsigned getMessageLength() const {
2500
    return messageLength;
2501
  }
2502
  void setMessage(ASTContext &C, llvm::StringRef S) {
2503
    messageLength = S.size();
2504
    this->message = new (C, 1) char [messageLength];
2505
    if (!S.empty())
2506
      std::memcpy(this->message, S.data(), messageLength);
2507
  }
2508
2509
2.34k
  llvm::StringRef getReplacement() const {
2510
2.34k
    return llvm::StringRef(replacement, replacementLength);
2511
2.34k
  }
2512
  unsigned getReplacementLength() const {
2513
    return replacementLength;
2514
  }
2515
  void setReplacement(ASTContext &C, llvm::StringRef S) {
2516
    replacementLength = S.size();
2517
    this->replacement = new (C, 1) char [replacementLength];
2518
    if (!S.empty())
2519
      std::memcpy(this->replacement, S.data(), replacementLength);
2520
  }
2521
2522
2523
2524
6.67M
  static bool classof(const Attr *A) { return A->getKind() == attr::Deprecated; }
2525
};
2526
2527
class DestructorAttr : public InheritableAttr {
2528
int priority;
2529
2530
public:
2531
  static DestructorAttr *CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Loc = SourceRange()) {
2532
    auto *A = new (Ctx) DestructorAttr(Loc, Ctx, Priority, 0);
2533
    A->setImplicit(true);
2534
    return A;
2535
  }
2536
2537
  DestructorAttr(SourceRange R, ASTContext &Ctx
2538
              , int Priority
2539
              , unsigned SI
2540
             )
2541
    : InheritableAttr(attr::Destructor, R, SI, false, false)
2542
              , priority(Priority)
2543
35
  {
2544
35
  }
2545
2546
  DestructorAttr(SourceRange R, ASTContext &Ctx
2547
              , unsigned SI
2548
             )
2549
    : InheritableAttr(attr::Destructor, R, SI, false, false)
2550
              , priority()
2551
  {
2552
  }
2553
2554
  DestructorAttr *clone(ASTContext &C) const;
2555
  void printPretty(raw_ostream &OS,
2556
                   const PrintingPolicy &Policy) const;
2557
  const char *getSpelling() const;
2558
16
  int getPriority() const {
2559
16
    return priority;
2560
16
  }
2561
2562
  static const int DefaultPriority = 65535;
2563
2564
2565
2566
6.33M
  static bool classof(const Attr *A) { return A->getKind() == attr::Destructor; }
2567
};
2568
2569
class DiagnoseIfAttr : public InheritableAttr {
2570
Expr * cond;
2571
2572
unsigned messageLength;
2573
char *message;
2574
2575
public:
2576
  enum DiagnosticType {
2577
    DT_Error,
2578
    DT_Warning
2579
  };
2580
private:
2581
  DiagnosticType diagnosticType;
2582
2583
bool argDependent;
2584
2585
NamedDecl * parent;
2586
2587
public:
2588
  static DiagnoseIfAttr *CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, SourceRange Loc = SourceRange()) {
2589
    auto *A = new (Ctx) DiagnoseIfAttr(Loc, Ctx, Cond, Message, DiagnosticType, ArgDependent, Parent, 0);
2590
    A->setImplicit(true);
2591
    return A;
2592
  }
2593
2594
  static DiagnoseIfAttr *CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, SourceRange Loc = SourceRange()) {
2595
    auto *A = new (Ctx) DiagnoseIfAttr(Loc, Ctx, Cond, Message, DiagnosticType, 0);
2596
    A->setImplicit(true);
2597
    return A;
2598
  }
2599
2600
  DiagnoseIfAttr(SourceRange R, ASTContext &Ctx
2601
              , Expr * Cond
2602
              , llvm::StringRef Message
2603
              , DiagnosticType DiagnosticType
2604
              , bool ArgDependent
2605
              , NamedDecl * Parent
2606
              , unsigned SI
2607
             )
2608
    : InheritableAttr(attr::DiagnoseIf, R, SI, true, true)
2609
              , cond(Cond)
2610
              , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2611
              , diagnosticType(DiagnosticType)
2612
              , argDependent(ArgDependent)
2613
              , parent(Parent)
2614
5.50k
  {
2615
5.50k
      if (!Message.empty())
2616
5.50k
        std::memcpy(message, Message.data(), messageLength);
2617
5.50k
  }
2618
2619
  DiagnoseIfAttr(SourceRange R, ASTContext &Ctx
2620
              , Expr * Cond
2621
              , llvm::StringRef Message
2622
              , DiagnosticType DiagnosticType
2623
              , unsigned SI
2624
             )
2625
    : InheritableAttr(attr::DiagnoseIf, R, SI, true, true)
2626
              , cond(Cond)
2627
              , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2628
              , diagnosticType(DiagnosticType)
2629
              , argDependent()
2630
              , parent()
2631
  {
2632
      if (!Message.empty())
2633
        std::memcpy(message, Message.data(), messageLength);
2634
  }
2635
2636
  DiagnoseIfAttr *clone(ASTContext &C) const;
2637
  void printPretty(raw_ostream &OS,
2638
                   const PrintingPolicy &Policy) const;
2639
  const char *getSpelling() const;
2640
1.24k
  Expr * getCond() const {
2641
1.24k
    return cond;
2642
1.24k
  }
2643
2644
698
  llvm::StringRef getMessage() const {
2645
698
    return llvm::StringRef(message, messageLength);
2646
698
  }
2647
  unsigned getMessageLength() const {
2648
    return messageLength;
2649
  }
2650
  void setMessage(ASTContext &C, llvm::StringRef S) {
2651
    messageLength = S.size();
2652
    this->message = new (C, 1) char [messageLength];
2653
    if (!S.empty())
2654
      std::memcpy(this->message, S.data(), messageLength);
2655
  }
2656
2657
574
  DiagnosticType getDiagnosticType() const {
2658
574
    return diagnosticType;
2659
574
  }
2660
2661
4.92k
  static bool ConvertStrToDiagnosticType(StringRef Val, DiagnosticType &Out) {
2662
4.92k
    Optional<DiagnosticType> R = llvm::StringSwitch<Optional<DiagnosticType>>(Val)
2663
4.92k
      .Case("error", DiagnoseIfAttr::DT_Error)
2664
4.92k
      .Case("warning", DiagnoseIfAttr::DT_Warning)
2665
4.92k
      .Default(Optional<DiagnosticType>());
2666
4.92k
    if (R) {
2667
4.92k
      Out = *R;
2668
4.92k
      return true;
2669
4.92k
    }
2670
3
    return false;
2671
3
  }
2672
2673
0
  static const char *ConvertDiagnosticTypeToStr(DiagnosticType Val) {
2674
0
    switch(Val) {
2675
0
    case DiagnoseIfAttr::DT_Error: return "error";
2676
0
    case DiagnoseIfAttr::DT_Warning: return "warning";
2677
0
    }
2678
0
    llvm_unreachable("No enumerator with that value");
2679
0
  }
2680
1.67k
  bool getArgDependent() const {
2681
1.67k
    return argDependent;
2682
1.67k
  }
2683
2684
340
  NamedDecl * getParent() const {
2685
340
    return parent;
2686
340
  }
2687
2688
2689
568
    bool isError() const { return diagnosticType == DT_Error; }
2690
    bool isWarning() const { return diagnosticType == DT_Warning; }
2691
  
2692
2693
10.4M
  static bool classof(const Attr *A) { return A->getKind() == attr::DiagnoseIf; }
2694
};
2695
2696
class DisableTailCallsAttr : public InheritableAttr {
2697
public:
2698
  static DisableTailCallsAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2699
    auto *A = new (Ctx) DisableTailCallsAttr(Loc, Ctx, 0);
2700
    A->setImplicit(true);
2701
    return A;
2702
  }
2703
2704
  DisableTailCallsAttr(SourceRange R, ASTContext &Ctx
2705
              , unsigned SI
2706
             )
2707
    : InheritableAttr(attr::DisableTailCalls, R, SI, false, false)
2708
55
  {
2709
55
  }
2710
2711
  DisableTailCallsAttr *clone(ASTContext &C) const;
2712
  void printPretty(raw_ostream &OS,
2713
                   const PrintingPolicy &Policy) const;
2714
  const char *getSpelling() const;
2715
2716
2717
152k
  static bool classof(const Attr *A) { return A->getKind() == attr::DisableTailCalls; }
2718
};
2719
2720
class EmptyBasesAttr : public InheritableAttr {
2721
public:
2722
  static EmptyBasesAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2723
    auto *A = new (Ctx) EmptyBasesAttr(Loc, Ctx, 0);
2724
    A->setImplicit(true);
2725
    return A;
2726
  }
2727
2728
  EmptyBasesAttr(SourceRange R, ASTContext &Ctx
2729
              , unsigned SI
2730
             )
2731
    : InheritableAttr(attr::EmptyBases, R, SI, false, false)
2732
9
  {
2733
9
  }
2734
2735
  EmptyBasesAttr *clone(ASTContext &C) const;
2736
  void printPretty(raw_ostream &OS,
2737
                   const PrintingPolicy &Policy) const;
2738
  const char *getSpelling() const;
2739
2740
2741
867
  static bool classof(const Attr *A) { return A->getKind() == attr::EmptyBases; }
2742
};
2743
2744
class EnableIfAttr : public InheritableAttr {
2745
Expr * cond;
2746
2747
unsigned messageLength;
2748
char *message;
2749
2750
public:
2751
  static EnableIfAttr *CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, SourceRange Loc = SourceRange()) {
2752
    auto *A = new (Ctx) EnableIfAttr(Loc, Ctx, Cond, Message, 0);
2753
    A->setImplicit(true);
2754
    return A;
2755
  }
2756
2757
  EnableIfAttr(SourceRange R, ASTContext &Ctx
2758
              , Expr * Cond
2759
              , llvm::StringRef Message
2760
              , unsigned SI
2761
             )
2762
    : InheritableAttr(attr::EnableIf, R, SI, false, false)
2763
              , cond(Cond)
2764
              , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2765
12.6k
  {
2766
12.6k
      if (!Message.empty())
2767
12.6k
        std::memcpy(message, Message.data(), messageLength);
2768
12.6k
  }
2769
2770
  EnableIfAttr *clone(ASTContext &C) const;
2771
  void printPretty(raw_ostream &OS,
2772
                   const PrintingPolicy &Policy) const;
2773
  const char *getSpelling() const;
2774
14.3k
  Expr * getCond() const {
2775
14.3k
    return cond;
2776
14.3k
  }
2777
2778
410
  llvm::StringRef getMessage() const {
2779
410
    return llvm::StringRef(message, messageLength);
2780
410
  }
2781
  unsigned getMessageLength() const {
2782
    return messageLength;
2783
  }
2784
  void setMessage(ASTContext &C, llvm::StringRef S) {
2785
    messageLength = S.size();
2786
    this->message = new (C, 1) char [messageLength];
2787
    if (!S.empty())
2788
      std::memcpy(this->message, S.data(), messageLength);
2789
  }
2790
2791
2792
2793
8.72M
  static bool classof(const Attr *A) { return A->getKind() == attr::EnableIf; }
2794
};
2795
2796
class EnumExtensibilityAttr : public InheritableAttr {
2797
public:
2798
  enum Kind {
2799
    Closed,
2800
    Open
2801
  };
2802
private:
2803
  Kind extensibility;
2804
2805
public:
2806
  static EnumExtensibilityAttr *CreateImplicit(ASTContext &Ctx, Kind Extensibility, SourceRange Loc = SourceRange()) {
2807
    auto *A = new (Ctx) EnumExtensibilityAttr(Loc, Ctx, Extensibility, 0);
2808
    A->setImplicit(true);
2809
    return A;
2810
  }
2811
2812
  EnumExtensibilityAttr(SourceRange R, ASTContext &Ctx
2813
              , Kind Extensibility
2814
              , unsigned SI
2815
             )
2816
    : InheritableAttr(attr::EnumExtensibility, R, SI, false, false)
2817
              , extensibility(Extensibility)
2818
4.98k
  {
2819
4.98k
  }
2820
2821
  EnumExtensibilityAttr *clone(ASTContext &C) const;
2822
  void printPretty(raw_ostream &OS,
2823
                   const PrintingPolicy &Policy) const;
2824
  const char *getSpelling() const;
2825
2.79k
  Kind getExtensibility() const {
2826
2.79k
    return extensibility;
2827
2.79k
  }
2828
2829
2.74k
  static bool ConvertStrToKind(StringRef Val, Kind &Out) {
2830
2.74k
    Optional<Kind> R = llvm::StringSwitch<Optional<Kind>>(Val)
2831
2.74k
      .Case("closed", EnumExtensibilityAttr::Closed)
2832
2.74k
      .Case("open", EnumExtensibilityAttr::Open)
2833
2.74k
      .Default(Optional<Kind>());
2834
2.74k
    if (R) {
2835
2.74k
      Out = *R;
2836
2.74k
      return true;
2837
2.74k
    }
2838
1
    return false;
2839
1
  }
2840
2841
0
  static const char *ConvertKindToStr(Kind Val) {
2842
0
    switch(Val) {
2843
0
    case EnumExtensibilityAttr::Closed: return "closed";
2844
0
    case EnumExtensibilityAttr::Open: return "open";
2845
0
    }
2846
0
    llvm_unreachable("No enumerator with that value");
2847
0
  }
2848
2849
2850
7.07k
  static bool classof(const Attr *A) { return A->getKind() == attr::EnumExtensibility; }
2851
};
2852
2853
class ExclusiveTrylockFunctionAttr : public InheritableAttr {
2854
Expr * successValue;
2855
2856
  unsigned args_Size;
2857
  Expr * *args_;
2858
2859
public:
2860
  static ExclusiveTrylockFunctionAttr *CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
2861
    auto *A = new (Ctx) ExclusiveTrylockFunctionAttr(Loc, Ctx, SuccessValue, Args, ArgsSize, 0);
2862
    A->setImplicit(true);
2863
    return A;
2864
  }
2865
2866
  ExclusiveTrylockFunctionAttr(SourceRange R, ASTContext &Ctx
2867
              , Expr * SuccessValue
2868
              , Expr * *Args, unsigned ArgsSize
2869
              , unsigned SI
2870
             )
2871
    : InheritableAttr(attr::ExclusiveTrylockFunction, R, SI, true, true)
2872
              , successValue(SuccessValue)
2873
              , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
2874
88
  {
2875
88
    std::copy(Args, Args + args_Size, args_);
2876
88
  }
2877
2878
  ExclusiveTrylockFunctionAttr(SourceRange R, ASTContext &Ctx
2879
              , Expr * SuccessValue
2880
              , unsigned SI
2881
             )
2882
    : InheritableAttr(attr::ExclusiveTrylockFunction, R, SI, true, true)
2883
              , successValue(SuccessValue)
2884
              , args_Size(0), args_(nullptr)
2885
  {
2886
  }
2887
2888
  ExclusiveTrylockFunctionAttr *clone(ASTContext &C) const;
2889
  void printPretty(raw_ostream &OS,
2890
                   const PrintingPolicy &Policy) const;
2891
  const char *getSpelling() const;
2892
205
  Expr * getSuccessValue() const {
2893
205
    return successValue;
2894
205
  }
2895
2896
  typedef Expr ** args_iterator;
2897
238
  args_iterator args_begin() const { return args_; }
2898
238
  args_iterator args_end() const { return args_ + args_Size; }
2899
103
  unsigned args_size() const { return args_Size; }
2900
238
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
2901
2902
2903
2904
2905
270k
  static bool classof(const Attr *A) { return A->getKind() == attr::ExclusiveTrylockFunction; }
2906
};
2907
2908
class ExternalSourceSymbolAttr : public InheritableAttr {
2909
unsigned languageLength;
2910
char *language;
2911
2912
unsigned definedInLength;
2913
char *definedIn;
2914
2915
bool generatedDeclaration;
2916
2917
public:
2918
  static ExternalSourceSymbolAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, SourceRange Loc = SourceRange()) {
2919
    auto *A = new (Ctx) ExternalSourceSymbolAttr(Loc, Ctx, Language, DefinedIn, GeneratedDeclaration, 0);
2920
    A->setImplicit(true);
2921
    return A;
2922
  }
2923
2924
  ExternalSourceSymbolAttr(SourceRange R, ASTContext &Ctx
2925
              , llvm::StringRef Language
2926
              , llvm::StringRef DefinedIn
2927
              , bool GeneratedDeclaration
2928
              , unsigned SI
2929
             )
2930
    : InheritableAttr(attr::ExternalSourceSymbol, R, SI, false, false)
2931
              , languageLength(Language.size()),language(new (Ctx, 1) char[languageLength])
2932
              , definedInLength(DefinedIn.size()),definedIn(new (Ctx, 1) char[definedInLength])
2933
              , generatedDeclaration(GeneratedDeclaration)
2934
60
  {
2935
60
      if (!Language.empty())
2936
49
        std::memcpy(language, Language.data(), languageLength);
2937
60
      if (!DefinedIn.empty())
2938
47
        std::memcpy(definedIn, DefinedIn.data(), definedInLength);
2939
60
  }
2940
2941
  ExternalSourceSymbolAttr(SourceRange R, ASTContext &Ctx
2942
              , unsigned SI
2943
             )
2944
    : InheritableAttr(attr::ExternalSourceSymbol, R, SI, false, false)
2945
              , languageLength(0),language(nullptr)
2946
              , definedInLength(0),definedIn(nullptr)
2947
              , generatedDeclaration()
2948
  {
2949
  }
2950
2951
  ExternalSourceSymbolAttr *clone(ASTContext &C) const;
2952
  void printPretty(raw_ostream &OS,
2953
                   const PrintingPolicy &Policy) const;
2954
  const char *getSpelling() const;
2955
28
  llvm::StringRef getLanguage() const {
2956
28
    return llvm::StringRef(language, languageLength);
2957
28
  }
2958
  unsigned getLanguageLength() const {
2959
    return languageLength;
2960
  }
2961
  void setLanguage(ASTContext &C, llvm::StringRef S) {
2962
    languageLength = S.size();
2963
    this->language = new (C, 1) char [languageLength];
2964
    if (!S.empty())
2965
      std::memcpy(this->language, S.data(), languageLength);
2966
  }
2967
2968
45
  llvm::StringRef getDefinedIn() const {
2969
45
    return llvm::StringRef(definedIn, definedInLength);
2970
45
  }
2971
  unsigned getDefinedInLength() const {
2972
    return definedInLength;
2973
  }
2974
  void setDefinedIn(ASTContext &C, llvm::StringRef S) {
2975
    definedInLength = S.size();
2976
    this->definedIn = new (C, 1) char [definedInLength];
2977
    if (!S.empty())
2978
      std::memcpy(this->definedIn, S.data(), definedInLength);
2979
  }
2980
2981
19
  bool getGeneratedDeclaration() const {
2982
19
    return generatedDeclaration;
2983
19
  }
2984
2985
2986
2987
755
  static bool classof(const Attr *A) { return A->getKind() == attr::ExternalSourceSymbol; }
2988
};
2989
2990
class FallThroughAttr : public StmtAttr {
2991
public:
2992
0
  static FallThroughAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2993
0
    auto *A = new (Ctx) FallThroughAttr(Loc, Ctx, 0);
2994
0
    A->setImplicit(true);
2995
0
    return A;
2996
0
  }
2997
2998
  FallThroughAttr(SourceRange R, ASTContext &Ctx
2999
              , unsigned SI
3000
             )
3001
    : StmtAttr(attr::FallThrough, R, SI, false)
3002
72
  {
3003
72
  }
3004
3005
  FallThroughAttr *clone(ASTContext &C) const;
3006
  void printPretty(raw_ostream &OS,
3007
                   const PrintingPolicy &Policy) const;
3008
  const char *getSpelling() const;
3009
3010
3011
86
  static bool classof(const Attr *A) { return A->getKind() == attr::FallThrough; }
3012
};
3013
3014
class FastCallAttr : public InheritableAttr {
3015
public:
3016
  static FastCallAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3017
    auto *A = new (Ctx) FastCallAttr(Loc, Ctx, 0);
3018
    A->setImplicit(true);
3019
    return A;
3020
  }
3021
3022
  FastCallAttr(SourceRange R, ASTContext &Ctx
3023
              , unsigned SI
3024
             )
3025
    : InheritableAttr(attr::FastCall, R, SI, false, false)
3026
0
  {
3027
0
  }
3028
3029
  FastCallAttr *clone(ASTContext &C) const;
3030
  void printPretty(raw_ostream &OS,
3031
                   const PrintingPolicy &Policy) const;
3032
  const char *getSpelling() const;
3033
3034
3035
307
  static bool classof(const Attr *A) { return A->getKind() == attr::FastCall; }
3036
};
3037
3038
class FinalAttr : public InheritableAttr {
3039
public:
3040
  enum Spelling {
3041
    Keyword_final = 0,
3042
    Keyword_sealed = 1
3043
  };
3044
3045
  static FinalAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
3046
    auto *A = new (Ctx) FinalAttr(Loc, Ctx, S);
3047
    A->setImplicit(true);
3048
    return A;
3049
  }
3050
3051
  FinalAttr(SourceRange R, ASTContext &Ctx
3052
              , unsigned SI
3053
             )
3054
    : InheritableAttr(attr::Final, R, SI, false, false)
3055
4.50k
  {
3056
4.50k
  }
3057
3058
  FinalAttr *clone(ASTContext &C) const;
3059
  void printPretty(raw_ostream &OS,
3060
                   const PrintingPolicy &Policy) const;
3061
  const char *getSpelling() const;
3062
  Spelling getSemanticSpelling() const {
3063
  switch (SpellingListIndex) {
3064
    default: llvm_unreachable("Unknown spelling list index");
3065
    case 0: return Keyword_final;
3066
    case 1: return Keyword_sealed;
3067
  }
3068
  }
3069
27
  bool isSpelledAsSealed() const { return SpellingListIndex == 1; }
3070
3071
3072
1.61M
  static bool classof(const Attr *A) { return A->getKind() == attr::Final; }
3073
};
3074
3075
class FlagEnumAttr : public InheritableAttr {
3076
public:
3077
  static FlagEnumAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3078
    auto *A = new (Ctx) FlagEnumAttr(Loc, Ctx, 0);
3079
    A->setImplicit(true);
3080
    return A;
3081
  }
3082
3083
  FlagEnumAttr(SourceRange R, ASTContext &Ctx
3084
              , unsigned SI
3085
             )
3086
    : InheritableAttr(attr::FlagEnum, R, SI, false, false)
3087
1.91k
  {
3088
1.91k
  }
3089
3090
  FlagEnumAttr *clone(ASTContext &C) const;
3091
  void printPretty(raw_ostream &OS,
3092
                   const PrintingPolicy &Policy) const;
3093
  const char *getSpelling() const;
3094
3095
3096
1.53k
  static bool classof(const Attr *A) { return A->getKind() == attr::FlagEnum; }
3097
};
3098
3099
class FlattenAttr : public InheritableAttr {
3100
public:
3101
  static FlattenAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3102
    auto *A = new (Ctx) FlattenAttr(Loc, Ctx, 0);
3103
    A->setImplicit(true);
3104
    return A;
3105
  }
3106
3107
  FlattenAttr(SourceRange R, ASTContext &Ctx
3108
              , unsigned SI
3109
             )
3110
    : InheritableAttr(attr::Flatten, R, SI, false, false)
3111
10
  {
3112
10
  }
3113
3114
  FlattenAttr *clone(ASTContext &C) const;
3115
  void printPretty(raw_ostream &OS,
3116
                   const PrintingPolicy &Policy) const;
3117
  const char *getSpelling() const;
3118
3119
3120
132k
  static bool classof(const Attr *A) { return A->getKind() == attr::Flatten; }
3121
};
3122
3123
class FormatAttr : public InheritableAttr {
3124
IdentifierInfo * type;
3125
3126
int formatIdx;
3127
3128
int firstArg;
3129
3130
public:
3131
23.6k
  static FormatAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, SourceRange Loc = SourceRange()) {
3132
23.6k
    auto *A = new (Ctx) FormatAttr(Loc, Ctx, Type, FormatIdx, FirstArg, 0);
3133
23.6k
    A->setImplicit(true);
3134
23.6k
    return A;
3135
23.6k
  }
3136
3137
  FormatAttr(SourceRange R, ASTContext &Ctx
3138
              , IdentifierInfo * Type
3139
              , int FormatIdx
3140
              , int FirstArg
3141
              , unsigned SI
3142
             )
3143
    : InheritableAttr(attr::Format, R, SI, false, false)
3144
              , type(Type)
3145
              , formatIdx(FormatIdx)
3146
              , firstArg(FirstArg)
3147
73.8k
  {
3148
73.8k
  }
3149
3150
  FormatAttr *clone(ASTContext &C) const;
3151
  void printPretty(raw_ostream &OS,
3152
                   const PrintingPolicy &Policy) const;
3153
  const char *getSpelling() const;
3154
88.6k
  IdentifierInfo * getType() const {
3155
88.6k
    return type;
3156
88.6k
  }
3157
3158
87.9k
  int getFormatIdx() const {
3159
87.9k
    return formatIdx;
3160
87.9k
  }
3161
3162
129k
  int getFirstArg() const {
3163
129k
    return firstArg;
3164
129k
  }
3165
3166
3167
3168
4.20M
  static bool classof(const Attr *A) { return A->getKind() == attr::Format; }
3169
};
3170
3171
class FormatArgAttr : public InheritableAttr {
3172
ParamIdx formatIdx;
3173
3174
public:
3175
1
  static FormatArgAttr *CreateImplicit(ASTContext &Ctx, ParamIdx FormatIdx, SourceRange Loc = SourceRange()) {
3176
1
    auto *A = new (Ctx) FormatArgAttr(Loc, Ctx, FormatIdx, 0);
3177
1
    A->setImplicit(true);
3178
1
    return A;
3179
1
  }
3180
3181
  FormatArgAttr(SourceRange R, ASTContext &Ctx
3182
              , ParamIdx FormatIdx
3183
              , unsigned SI
3184
             )
3185
    : InheritableAttr(attr::FormatArg, R, SI, false, false)
3186
              , formatIdx(FormatIdx)
3187
349
  {
3188
349
  }
3189
3190
  FormatArgAttr *clone(ASTContext &C) const;
3191
  void printPretty(raw_ostream &OS,
3192
                   const PrintingPolicy &Policy) const;
3193
  const char *getSpelling() const;
3194
35
  ParamIdx getFormatIdx() const {
3195
35
    return formatIdx;
3196
35
  }
3197
3198
3199
3200
99
  static bool classof(const Attr *A) { return A->getKind() == attr::FormatArg; }
3201
};
3202
3203
class GNUInlineAttr : public InheritableAttr {
3204
public:
3205
  static GNUInlineAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3206
    auto *A = new (Ctx) GNUInlineAttr(Loc, Ctx, 0);
3207
    A->setImplicit(true);
3208
    return A;
3209
  }
3210
3211
  GNUInlineAttr(SourceRange R, ASTContext &Ctx
3212
              , unsigned SI
3213
             )
3214
    : InheritableAttr(attr::GNUInline, R, SI, false, false)
3215
113
  {
3216
113
  }
3217
3218
  GNUInlineAttr *clone(ASTContext &C) const;
3219
  void printPretty(raw_ostream &OS,
3220
                   const PrintingPolicy &Policy) const;
3221
  const char *getSpelling() const;
3222
3223
3224
3.15M
  static bool classof(const Attr *A) { return A->getKind() == attr::GNUInline; }
3225
};
3226
3227
class GuardedByAttr : public InheritableAttr {
3228
Expr * arg;
3229
3230
public:
3231
  static GuardedByAttr *CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Loc = SourceRange()) {
3232
    auto *A = new (Ctx) GuardedByAttr(Loc, Ctx, Arg, 0);
3233
    A->setImplicit(true);
3234
    return A;
3235
  }
3236
3237
  GuardedByAttr(SourceRange R, ASTContext &Ctx
3238
              , Expr * Arg
3239
              , unsigned SI
3240
             )
3241
    : InheritableAttr(attr::GuardedBy, R, SI, true, true)
3242
              , arg(Arg)
3243
549
  {
3244
549
  }
3245
3246
  GuardedByAttr *clone(ASTContext &C) const;
3247
  void printPretty(raw_ostream &OS,
3248
                   const PrintingPolicy &Policy) const;
3249
  const char *getSpelling() const;
3250
3.33k
  Expr * getArg() const {
3251
3.33k
    return arg;
3252
3.33k
  }
3253
3254
3255
3256
275k
  static bool classof(const Attr *A) { return A->getKind() == attr::GuardedBy; }
3257
};
3258
3259
class GuardedVarAttr : public InheritableAttr {
3260
public:
3261
  static GuardedVarAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3262
    auto *A = new (Ctx) GuardedVarAttr(Loc, Ctx, 0);
3263
    A->setImplicit(true);
3264
    return A;
3265
  }
3266
3267
  GuardedVarAttr(SourceRange R, ASTContext &Ctx
3268
              , unsigned SI
3269
             )
3270
    : InheritableAttr(attr::GuardedVar, R, SI, false, false)
3271
14
  {
3272
14
  }
3273
3274
  GuardedVarAttr *clone(ASTContext &C) const;
3275
  void printPretty(raw_ostream &OS,
3276
                   const PrintingPolicy &Policy) const;
3277
  const char *getSpelling() const;
3278
3279
3280
2.46k
  static bool classof(const Attr *A) { return A->getKind() == attr::GuardedVar; }
3281
};
3282
3283
class HotAttr : public InheritableAttr {
3284
public:
3285
  static HotAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3286
    auto *A = new (Ctx) HotAttr(Loc, Ctx, 0);
3287
    A->setImplicit(true);
3288
    return A;
3289
  }
3290
3291
  HotAttr(SourceRange R, ASTContext &Ctx
3292
              , unsigned SI
3293
             )
3294
    : InheritableAttr(attr::Hot, R, SI, false, false)
3295
2
  {
3296
2
  }
3297
3298
  HotAttr *clone(ASTContext &C) const;
3299
  void printPretty(raw_ostream &OS,
3300
                   const PrintingPolicy &Policy) const;
3301
  const char *getSpelling() const;
3302
3303
3304
2
  static bool classof(const Attr *A) { return A->getKind() == attr::Hot; }
3305
};
3306
3307
class IBActionAttr : public InheritableAttr {
3308
public:
3309
  static IBActionAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3310
    auto *A = new (Ctx) IBActionAttr(Loc, Ctx, 0);
3311
    A->setImplicit(true);
3312
    return A;
3313
  }
3314
3315
  IBActionAttr(SourceRange R, ASTContext &Ctx
3316
              , unsigned SI
3317
             )
3318
    : InheritableAttr(attr::IBAction, R, SI, false, false)
3319
57
  {
3320
57
  }
3321
3322
  IBActionAttr *clone(ASTContext &C) const;
3323
  void printPretty(raw_ostream &OS,
3324
                   const PrintingPolicy &Policy) const;
3325
  const char *getSpelling() const;
3326
3327
3328
  static bool classof(const Attr *A) { return A->getKind() == attr::IBAction; }
3329
};
3330
3331
class IBOutletAttr : public InheritableAttr {
3332
public:
3333
  static IBOutletAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3334
    auto *A = new (Ctx) IBOutletAttr(Loc, Ctx, 0);
3335
    A->setImplicit(true);
3336
    return A;
3337
  }
3338
3339
  IBOutletAttr(SourceRange R, ASTContext &Ctx
3340
              , unsigned SI
3341
             )
3342
    : InheritableAttr(attr::IBOutlet, R, SI, false, false)
3343
38
  {
3344
38
  }
3345
3346
  IBOutletAttr *clone(ASTContext &C) const;
3347
  void printPretty(raw_ostream &OS,
3348
                   const PrintingPolicy &Policy) const;
3349
  const char *getSpelling() const;
3350
3351
3352
32
  static bool classof(const Attr *A) { return A->getKind() == attr::IBOutlet; }
3353
};
3354
3355
class IBOutletCollectionAttr : public InheritableAttr {
3356
TypeSourceInfo * interface_;
3357
3358
public:
3359
  static IBOutletCollectionAttr *CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Interface, SourceRange Loc = SourceRange()) {
3360
    auto *A = new (Ctx) IBOutletCollectionAttr(Loc, Ctx, Interface, 0);
3361
    A->setImplicit(true);
3362
    return A;
3363
  }
3364
3365
  IBOutletCollectionAttr(SourceRange R, ASTContext &Ctx
3366
              , TypeSourceInfo * Interface
3367
              , unsigned SI
3368
             )
3369
    : InheritableAttr(attr::IBOutletCollection, R, SI, false, false)
3370
              , interface_(Interface)
3371
28
  {
3372
28
  }
3373
3374
  IBOutletCollectionAttr(SourceRange R, ASTContext &Ctx
3375
              , unsigned SI
3376
             )
3377
    : InheritableAttr(attr::IBOutletCollection, R, SI, false, false)
3378
              , interface_()
3379
  {
3380
  }
3381
3382
  IBOutletCollectionAttr *clone(ASTContext &C) const;
3383
  void printPretty(raw_ostream &OS,
3384
                   const PrintingPolicy &Policy) const;
3385
  const char *getSpelling() const;
3386
12
  QualType getInterface() const {
3387
12
    return interface_->getType();
3388
12
  }  TypeSourceInfo * getInterfaceLoc() const {
3389
10
    return interface_;
3390
10
  }
3391
3392
3393
3394
182
  static bool classof(const Attr *A) { return A->getKind() == attr::IBOutletCollection; }
3395
};
3396
3397
class IFuncAttr : public Attr {
3398
unsigned resolverLength;
3399
char *resolver;
3400
3401
public:
3402
  static IFuncAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Resolver, SourceRange Loc = SourceRange()) {
3403
    auto *A = new (Ctx) IFuncAttr(Loc, Ctx, Resolver, 0);
3404
    A->setImplicit(true);
3405
    return A;
3406
  }
3407
3408
  IFuncAttr(SourceRange R, ASTContext &Ctx
3409
              , llvm::StringRef Resolver
3410
              , unsigned SI
3411
             )
3412
    : Attr(attr::IFunc, R, SI, false)
3413
              , resolverLength(Resolver.size()),resolver(new (Ctx, 1) char[resolverLength])
3414
12
  {
3415
12
      if (!Resolver.empty())
3416
12
        std::memcpy(resolver, Resolver.data(), resolverLength);
3417
12
  }
3418
3419
  IFuncAttr *clone(ASTContext &C) const;
3420
  void printPretty(raw_ostream &OS,
3421
                   const PrintingPolicy &Policy) const;
3422
  const char *getSpelling() const;
3423
21
  llvm::StringRef getResolver() const {
3424
21
    return llvm::StringRef(resolver, resolverLength);
3425
21
  }
3426
  unsigned getResolverLength() const {
3427
    return resolverLength;
3428
  }
3429
  void setResolver(ASTContext &C, llvm::StringRef S) {
3430
    resolverLength = S.size();
3431
    this->resolver = new (C, 1) char [resolverLength];
3432
    if (!S.empty())
3433
      std::memcpy(this->resolver, S.data(), resolverLength);
3434
  }
3435
3436
3437
3438
17.3M
  static bool classof(const Attr *A) { return A->getKind() == attr::IFunc; }
3439
};
3440
3441
class InitPriorityAttr : public InheritableAttr {
3442
unsigned priority;
3443
3444
public:
3445
  static InitPriorityAttr *CreateImplicit(ASTContext &Ctx, unsigned Priority, SourceRange Loc = SourceRange()) {
3446
    auto *A = new (Ctx) InitPriorityAttr(Loc, Ctx, Priority, 0);
3447
    A->setImplicit(true);
3448
    return A;
3449
  }
3450
3451
  InitPriorityAttr(SourceRange R, ASTContext &Ctx
3452
              , unsigned Priority
3453
              , unsigned SI
3454
             )
3455
    : InheritableAttr(attr::InitPriority, R, SI, false, false)
3456
              , priority(Priority)
3457
820
  {
3458
820
  }
3459
3460
  InitPriorityAttr *clone(ASTContext &C) const;
3461
  void printPretty(raw_ostream &OS,
3462
                   const PrintingPolicy &Policy) const;
3463
  const char *getSpelling() const;
3464
711
  unsigned getPriority() const {
3465
711
    return priority;
3466
711
  }
3467
3468
3469
3470
1.26k
  static bool classof(const Attr *A) { return A->getKind() == attr::InitPriority; }
3471
};
3472
3473
class InitSegAttr : public Attr {
3474
unsigned sectionLength;
3475
char *section;
3476
3477
public:
3478
10
  static InitSegAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Section, SourceRange Loc = SourceRange()) {
3479
10
    auto *A = new (Ctx) InitSegAttr(Loc, Ctx, Section, 0);
3480
10
    A->setImplicit(true);
3481
10
    return A;
3482
10
  }
3483
3484
  InitSegAttr(SourceRange R, ASTContext &Ctx
3485
              , llvm::StringRef Section
3486
              , unsigned SI
3487
             )
3488
    : Attr(attr::InitSeg, R, SI, false)
3489
              , sectionLength(Section.size()),section(new (Ctx, 1) char[sectionLength])
3490
12
  {
3491
12
      if (!Section.empty())
3492
12
        std::memcpy(section, Section.data(), sectionLength);
3493
12
  }
3494
3495
  InitSegAttr *clone(ASTContext &C) const;
3496
  void printPretty(raw_ostream &OS,
3497
                   const PrintingPolicy &Policy) const;
3498
  const char *getSpelling() const;
3499
9
  llvm::StringRef getSection() const {
3500
9
    return llvm::StringRef(section, sectionLength);
3501
9
  }
3502
  unsigned getSectionLength() const {
3503
    return sectionLength;
3504
  }
3505
  void setSection(ASTContext &C, llvm::StringRef S) {
3506
    sectionLength = S.size();
3507
    this->section = new (C, 1) char [sectionLength];
3508
    if (!S.empty())
3509
      std::memcpy(this->section, S.data(), sectionLength);
3510
  }
3511
3512
3513
1
  void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
3514
1
    OS << " (" << getSection() << ')';
3515
1
  }
3516
  
3517
3518
791
  static bool classof(const Attr *A) { return A->getKind() == attr::InitSeg; }
3519
};
3520
3521
class IntelOclBiccAttr : public InheritableAttr {
3522
public:
3523
  static IntelOclBiccAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3524
    auto *A = new (Ctx) IntelOclBiccAttr(Loc, Ctx, 0);
3525
    A->setImplicit(true);
3526
    return A;
3527
  }
3528
3529
  IntelOclBiccAttr(SourceRange R, ASTContext &Ctx
3530
              , unsigned SI
3531
             )
3532
    : InheritableAttr(attr::IntelOclBicc, R, SI, false, false)
3533
0
  {
3534
0
  }
3535
3536
  IntelOclBiccAttr *clone(ASTContext &C) const;
3537
  void printPretty(raw_ostream &OS,
3538
                   const PrintingPolicy &Policy) const;
3539
  const char *getSpelling() const;
3540
3541
3542
307
  static bool classof(const Attr *A) { return A->getKind() == attr::IntelOclBicc; }
3543
};
3544
3545
class InternalLinkageAttr : public InheritableAttr {
3546
public:
3547
  static InternalLinkageAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3548
    auto *A = new (Ctx) InternalLinkageAttr(Loc, Ctx, 0);
3549
    A->setImplicit(true);
3550
    return A;
3551
  }
3552
3553
  InternalLinkageAttr(SourceRange R, ASTContext &Ctx
3554
              , unsigned SI
3555
             )
3556
    : InheritableAttr(attr::InternalLinkage, R, SI, false, false)
3557
37
  {
3558
37
  }
3559
3560
  InternalLinkageAttr *clone(ASTContext &C) const;
3561
  void printPretty(raw_ostream &OS,
3562
                   const PrintingPolicy &Policy) const;
3563
  const char *getSpelling() const;
3564
3565
3566
63.9M
  static bool classof(const Attr *A) { return A->getKind() == attr::InternalLinkage; }
3567
};
3568
3569
class LTOVisibilityPublicAttr : public InheritableAttr {
3570
public:
3571
  static LTOVisibilityPublicAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3572
    auto *A = new (Ctx) LTOVisibilityPublicAttr(Loc, Ctx, 0);
3573
    A->setImplicit(true);
3574
    return A;
3575
  }
3576
3577
  LTOVisibilityPublicAttr(SourceRange R, ASTContext &Ctx
3578
              , unsigned SI
3579
             )
3580
    : InheritableAttr(attr::LTOVisibilityPublic, R, SI, false, false)
3581
5
  {
3582
5
  }
3583
3584
  LTOVisibilityPublicAttr *clone(ASTContext &C) const;
3585
  void printPretty(raw_ostream &OS,
3586
                   const PrintingPolicy &Policy) const;
3587
  const char *getSpelling() const;
3588
3589
3590
14
  static bool classof(const Attr *A) { return A->getKind() == attr::LTOVisibilityPublic; }
3591
};
3592
3593
class LayoutVersionAttr : public InheritableAttr {
3594
unsigned version;
3595
3596
public:
3597
  static LayoutVersionAttr *CreateImplicit(ASTContext &Ctx, unsigned Version, SourceRange Loc = SourceRange()) {
3598
    auto *A = new (Ctx) LayoutVersionAttr(Loc, Ctx, Version, 0);
3599
    A->setImplicit(true);
3600
    return A;
3601
  }
3602
3603
  LayoutVersionAttr(SourceRange R, ASTContext &Ctx
3604
              , unsigned Version
3605
              , unsigned SI
3606
             )
3607
    : InheritableAttr(attr::LayoutVersion, R, SI, false, false)
3608
              , version(Version)
3609
1
  {
3610
1
  }
3611
3612
  LayoutVersionAttr *clone(ASTContext &C) const;
3613
  void printPretty(raw_ostream &OS,
3614
                   const PrintingPolicy &Policy) const;
3615
  const char *getSpelling() const;
3616
0
  unsigned getVersion() const {
3617
0
    return version;
3618
0
  }
3619
3620
3621
3622
851
  static bool classof(const Attr *A) { return A->getKind() == attr::LayoutVersion; }
3623
};
3624
3625
class LockReturnedAttr : public InheritableAttr {
3626
Expr * arg;
3627
3628
public:
3629
  static LockReturnedAttr *CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Loc = SourceRange()) {
3630
    auto *A = new (Ctx) LockReturnedAttr(Loc, Ctx, Arg, 0);
3631
    A->setImplicit(true);
3632
    return A;
3633
  }
3634
3635
  LockReturnedAttr(SourceRange R, ASTContext &Ctx
3636
              , Expr * Arg
3637
              , unsigned SI
3638
             )
3639
    : InheritableAttr(attr::LockReturned, R, SI, true, false)
3640
              , arg(Arg)
3641
87
  {
3642
87
  }
3643
3644
  LockReturnedAttr *clone(ASTContext &C) const;
3645
  void printPretty(raw_ostream &OS,
3646
                   const PrintingPolicy &Policy) const;
3647
  const char *getSpelling() const;
3648
183
  Expr * getArg() const {
3649
183
    return arg;
3650
183
  }
3651
3652
3653
3654
271k
  static bool classof(const Attr *A) { return A->getKind() == attr::LockReturned; }
3655
};
3656
3657
class LocksExcludedAttr : public InheritableAttr {
3658
  unsigned args_Size;
3659
  Expr * *args_;
3660
3661
public:
3662
  static LocksExcludedAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
3663
    auto *A = new (Ctx) LocksExcludedAttr(Loc, Ctx, Args, ArgsSize, 0);
3664
    A->setImplicit(true);
3665
    return A;
3666
  }
3667
3668
  LocksExcludedAttr(SourceRange R, ASTContext &Ctx
3669
              , Expr * *Args, unsigned ArgsSize
3670
              , unsigned SI
3671
             )
3672
    : InheritableAttr(attr::LocksExcluded, R, SI, true, true)
3673
              , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
3674
155
  {
3675
155
    std::copy(Args, Args + args_Size, args_);
3676
155
  }
3677
3678
  LocksExcludedAttr(SourceRange R, ASTContext &Ctx
3679
              , unsigned SI
3680
             )
3681
    : InheritableAttr(attr::LocksExcluded, R, SI, true, true)
3682
              , args_Size(0), args_(nullptr)
3683
  {
3684
  }
3685
3686
  LocksExcludedAttr *clone(ASTContext &C) const;
3687
  void printPretty(raw_ostream &OS,
3688
                   const PrintingPolicy &Policy) const;
3689
  const char *getSpelling() const;
3690
  typedef Expr ** args_iterator;
3691
244
  args_iterator args_begin() const { return args_; }
3692
244
  args_iterator args_end() const { return args_ + args_Size; }
3693
8
  unsigned args_size() const { return args_Size; }
3694
240
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
3695
3696
3697
3698
3699
270k
  static bool classof(const Attr *A) { return A->getKind() == attr::LocksExcluded; }
3700
};
3701
3702
class LoopHintAttr : public Attr {
3703
public:
3704
  enum OptionType {
3705
    Vectorize,
3706
    VectorizeWidth,
3707
    Interleave,
3708
    InterleaveCount,
3709
    Unroll,
3710
    UnrollCount,
3711
    Distribute
3712
  };
3713
private:
3714
  OptionType option;
3715
3716
public:
3717
  enum LoopHintState {
3718
    Enable,
3719
    Disable,
3720
    Numeric,
3721
    AssumeSafety,
3722
    Full
3723
  };
3724
private:
3725
  LoopHintState state;
3726
3727
Expr * value;
3728
3729
public:
3730
  enum Spelling {
3731
    Pragma_clang_loop = 0,
3732
    Pragma_unroll = 1,
3733
    Pragma_nounroll = 2
3734
  };
3735
3736
217
  static LoopHintAttr *CreateImplicit(ASTContext &Ctx, Spelling S, OptionType Option, LoopHintState State, Expr * Value, SourceRange Loc = SourceRange()) {
3737
217
    auto *A = new (Ctx) LoopHintAttr(Loc, Ctx, Option, State, Value, S);
3738
217
    A->setImplicit(true);
3739
217
    return A;
3740
217
  }
3741
3742
  LoopHintAttr(SourceRange R, ASTContext &Ctx
3743
              , OptionType Option
3744
              , LoopHintState State
3745
              , Expr * Value
3746
              , unsigned SI
3747
             )
3748
    : Attr(attr::LoopHint, R, SI, false)
3749
              , option(Option)
3750
              , state(State)
3751
              , value(Value)
3752
235
  {
3753
235
  }
3754
3755
  LoopHintAttr *clone(ASTContext &C) const;
3756
  void printPretty(raw_ostream &OS,
3757
                   const PrintingPolicy &Policy) const;
3758
  const char *getSpelling() const;
3759
27
  Spelling getSemanticSpelling() const {
3760
27
  switch (SpellingListIndex) {
3761
27
    
default: 0
llvm_unreachable0
("Unknown spelling list index");
3762
27
    case 0: return Pragma_clang_loop;
3763
27
    
case 1: return Pragma_unroll0
;
3764
27
    
case 2: return Pragma_nounroll0
;
3765
27
  }
3766
27
  }
3767
297
  OptionType getOption() const {
3768
297
    return option;
3769
297
  }
3770
3771
  static bool ConvertStrToOptionType(StringRef Val, OptionType &Out) {
3772
    Optional<OptionType> R = llvm::StringSwitch<Optional<OptionType>>(Val)
3773
      .Case("vectorize", LoopHintAttr::Vectorize)
3774
      .Case("vectorize_width", LoopHintAttr::VectorizeWidth)
3775
      .Case("interleave", LoopHintAttr::Interleave)
3776
      .Case("interleave_count", LoopHintAttr::InterleaveCount)
3777
      .Case("unroll", LoopHintAttr::Unroll)
3778
      .Case("unroll_count", LoopHintAttr::UnrollCount)
3779
      .Case("distribute", LoopHintAttr::Distribute)
3780
      .Default(Optional<OptionType>());
3781
    if (R) {
3782
      Out = *R;
3783
      return true;
3784
    }
3785
    return false;
3786
  }
3787
3788
  static const char *ConvertOptionTypeToStr(OptionType Val) {
3789
    switch(Val) {
3790
    case LoopHintAttr::Vectorize: return "vectorize";
3791
    case LoopHintAttr::VectorizeWidth: return "vectorize_width";
3792
    case LoopHintAttr::Interleave: return "interleave";
3793
    case LoopHintAttr::InterleaveCount: return "interleave_count";
3794
    case LoopHintAttr::Unroll: return "unroll";
3795
    case LoopHintAttr::UnrollCount: return "unroll_count";
3796
    case LoopHintAttr::Distribute: return "distribute";
3797
    }
3798
    llvm_unreachable("No enumerator with that value");
3799
  }
3800
113
  LoopHintState getState() const {
3801
113
    return state;
3802
113
  }
3803
3804
  static bool ConvertStrToLoopHintState(StringRef Val, LoopHintState &Out) {
3805
    Optional<LoopHintState> R = llvm::StringSwitch<Optional<LoopHintState>>(Val)
3806
      .Case("enable", LoopHintAttr::Enable)
3807
      .Case("disable", LoopHintAttr::Disable)
3808
      .Case("numeric", LoopHintAttr::Numeric)
3809
      .Case("assume_safety", LoopHintAttr::AssumeSafety)
3810
      .Case("full", LoopHintAttr::Full)
3811
      .Default(Optional<LoopHintState>());
3812
    if (R) {
3813
      Out = *R;
3814
      return true;
3815
    }
3816
    return false;
3817
  }
3818
3819
  static const char *ConvertLoopHintStateToStr(LoopHintState Val) {
3820
    switch(Val) {
3821
    case LoopHintAttr::Enable: return "enable";
3822
    case LoopHintAttr::Disable: return "disable";
3823
    case LoopHintAttr::Numeric: return "numeric";
3824
    case LoopHintAttr::AssumeSafety: return "assume_safety";
3825
    case LoopHintAttr::Full: return "full";
3826
    }
3827
    llvm_unreachable("No enumerator with that value");
3828
  }
3829
158
  Expr * getValue() const {
3830
158
    return value;
3831
158
  }
3832
3833
3834
76
  static const char *getOptionName(int Option) {
3835
76
    switch(Option) {
3836
76
    
case Vectorize: return "vectorize"12
;
3837
76
    
case VectorizeWidth: return "vectorize_width"13
;
3838
76
    
case Interleave: return "interleave"12
;
3839
76
    
case InterleaveCount: return "interleave_count"13
;
3840
76
    
case Unroll: return "unroll"11
;
3841
76
    
case UnrollCount: return "unroll_count"7
;
3842
76
    
case Distribute: return "distribute"8
;
3843
0
    }
3844
0
    llvm_unreachable("Unhandled LoopHint option.");
3845
0
  }
3846
3847
42
  void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
3848
42
    unsigned SpellingIndex = getSpellingListIndex();
3849
42
    // For "#pragma unroll" and "#pragma nounroll" the string "unroll" or
3850
42
    // "nounroll" is already emitted as the pragma name.
3851
42
    if (SpellingIndex == Pragma_nounroll)
3852
1
      return;
3853
41
    else if (SpellingIndex == Pragma_unroll) {
3854
2
      OS << ' ' << getValueString(Policy);
3855
2
      return;
3856
2
    }
3857
39
3858
39
    assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
3859
39
    OS << ' ' << getOptionName(option) << getValueString(Policy);
3860
39
  }
3861
3862
  // Return a string containing the loop hint argument including the
3863
  // enclosing parentheses.
3864
84
  std::string getValueString(const PrintingPolicy &Policy) const {
3865
84
    std::string ValueName;
3866
84
    llvm::raw_string_ostream OS(ValueName);
3867
84
    OS << "(";
3868
84
    if (state == Numeric)
3869
40
      value->printPretty(OS, nullptr, Policy);
3870
44
    else if (state == Enable)
3871
16
      OS << "enable";
3872
28
    else if (state == Full)
3873
5
      OS << "full";
3874
23
    else if (state == AssumeSafety)
3875
2
      OS << "assume_safety";
3876
21
    else
3877
21
      OS << "disable";
3878
84
    OS << ")";
3879
84
    return OS.str();
3880
84
  }
3881
3882
  // Return a string suitable for identifying this attribute in diagnostics.
3883
50
  std::string getDiagnosticName(const PrintingPolicy &Policy) const {
3884
50
    unsigned SpellingIndex = getSpellingListIndex();
3885
50
    if (SpellingIndex == Pragma_nounroll)
3886
3
      return "#pragma nounroll";
3887
47
    else if (SpellingIndex == Pragma_unroll)
3888
10
      return "#pragma unroll" + (option == UnrollCount ? 
getValueString(Policy)6
:
""4
);
3889
37
3890
37
    assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
3891
37
    return getOptionName(option) + getValueString(Policy);
3892
37
  }
3893
  
3894
3895
353
  static bool classof(const Attr *A) { return A->getKind() == attr::LoopHint; }
3896
};
3897
3898
class MSABIAttr : public InheritableAttr {
3899
public:
3900
  static MSABIAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3901
    auto *A = new (Ctx) MSABIAttr(Loc, Ctx, 0);
3902
    A->setImplicit(true);
3903
    return A;
3904
  }
3905
3906
  MSABIAttr(SourceRange R, ASTContext &Ctx
3907
              , unsigned SI
3908
             )
3909
    : InheritableAttr(attr::MSABI, R, SI, false, false)
3910
1
  {
3911
1
  }
3912
3913
  MSABIAttr *clone(ASTContext &C) const;
3914
  void printPretty(raw_ostream &OS,
3915
                   const PrintingPolicy &Policy) const;
3916
  const char *getSpelling() const;
3917
3918
3919
307
  static bool classof(const Attr *A) { return A->getKind() == attr::MSABI; }
3920
};
3921
3922
class MSInheritanceAttr : public InheritableAttr {
3923
bool bestCase;
3924
3925
public:
3926
  enum Spelling {
3927
    Keyword_single_inheritance = 0,
3928
    Keyword_multiple_inheritance = 1,
3929
    Keyword_virtual_inheritance = 2,
3930
    Keyword_unspecified_inheritance = 3
3931
  };
3932
3933
552
  static MSInheritanceAttr *CreateImplicit(ASTContext &Ctx, Spelling S, bool BestCase, SourceRange Loc = SourceRange()) {
3934
552
    auto *A = new (Ctx) MSInheritanceAttr(Loc, Ctx, BestCase, S);
3935
552
    A->setImplicit(true);
3936
552
    return A;
3937
552
  }
3938
3939
0
  static MSInheritanceAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
3940
0
    auto *A = new (Ctx) MSInheritanceAttr(Loc, Ctx, S);
3941
0
    A->setImplicit(true);
3942
0
    return A;
3943
0
  }
3944
3945
  MSInheritanceAttr(SourceRange R, ASTContext &Ctx
3946
              , bool BestCase
3947
              , unsigned SI
3948
             )
3949
    : InheritableAttr(attr::MSInheritance, R, SI, false, false)
3950
              , bestCase(BestCase)
3951
627
  {
3952
627
  }
3953
3954
  MSInheritanceAttr(SourceRange R, ASTContext &Ctx
3955
              , unsigned SI
3956
             )
3957
    : InheritableAttr(attr::MSInheritance, R, SI, false, false)
3958
              , bestCase()
3959
  {
3960
  }
3961
3962
  MSInheritanceAttr *clone(ASTContext &C) const;
3963
  void printPretty(raw_ostream &OS,
3964
                   const PrintingPolicy &Policy) const;
3965
  const char *getSpelling() const;
3966
2.50k
  Spelling getSemanticSpelling() const {
3967
2.50k
  switch (SpellingListIndex) {
3968
2.50k
    
default: 0
llvm_unreachable0
("Unknown spelling list index");
3969
2.50k
    
case 0: return Keyword_single_inheritance1.74k
;
3970
2.50k
    
case 1: return Keyword_multiple_inheritance201
;
3971
2.50k
    
case 2: return Keyword_virtual_inheritance151
;
3972
2.50k
    
case 3: return Keyword_unspecified_inheritance415
;
3973
2.50k
  }
3974
2.50k
  }
3975
74
  bool getBestCase() const {
3976
74
    return bestCase;
3977
74
  }
3978
3979
  static const bool DefaultBestCase = true;
3980
3981
3982
1.51k
  static bool hasVBPtrOffsetField(Spelling Inheritance) {
3983
1.51k
    return Inheritance == Keyword_unspecified_inheritance;
3984
1.51k
  }
3985
3986
  // Only member pointers to functions need a this adjustment, since it can be
3987
  // combined with the field offset for data pointers.
3988
1.41k
  static bool hasNVOffsetField(bool IsMemberFunction, Spelling Inheritance) {
3989
1.41k
    return IsMemberFunction && 
Inheritance >= Keyword_multiple_inheritance1.14k
;
3990
1.41k
  }
3991
3992
1.56k
  static bool hasVBTableOffsetField(Spelling Inheritance) {
3993
1.56k
    return Inheritance >= Keyword_virtual_inheritance;
3994
1.56k
  }
3995
3996
  static bool hasOnlyOneField(bool IsMemberFunction,
3997
624
                              Spelling Inheritance) {
3998
624
    if (IsMemberFunction)
3999
491
      return Inheritance <= Keyword_single_inheritance;
4000
133
    return Inheritance <= Keyword_multiple_inheritance;
4001
133
  }
4002
  
4003
4004
952k
  static bool classof(const Attr *A) { return A->getKind() == attr::MSInheritance; }
4005
};
4006
4007
class MSNoVTableAttr : public InheritableAttr {
4008
public:
4009
  static MSNoVTableAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4010
    auto *A = new (Ctx) MSNoVTableAttr(Loc, Ctx, 0);
4011
    A->setImplicit(true);
4012
    return A;
4013
  }
4014
4015
  MSNoVTableAttr(SourceRange R, ASTContext &Ctx
4016
              , unsigned SI
4017
             )
4018
    : InheritableAttr(attr::MSNoVTable, R, SI, false, false)
4019
6
  {
4020
6
  }
4021
4022
  MSNoVTableAttr *clone(ASTContext &C) const;
4023
  void printPretty(raw_ostream &OS,
4024
                   const PrintingPolicy &Policy) const;
4025
  const char *getSpelling() const;
4026
4027
4028
162
  static bool classof(const Attr *A) { return A->getKind() == attr::MSNoVTable; }
4029
};
4030
4031
class MSP430InterruptAttr : public InheritableAttr {
4032
unsigned number;
4033
4034
public:
4035
  static MSP430InterruptAttr *CreateImplicit(ASTContext &Ctx, unsigned Number, SourceRange Loc = SourceRange()) {
4036
    auto *A = new (Ctx) MSP430InterruptAttr(Loc, Ctx, Number, 0);
4037
    A->setImplicit(true);
4038
    return A;
4039
  }
4040
4041
  MSP430InterruptAttr(SourceRange R, ASTContext &Ctx
4042
              , unsigned Number
4043
              , unsigned SI
4044
             )
4045
    : InheritableAttr(attr::MSP430Interrupt, R, SI, false, false)
4046
              , number(Number)
4047
2
  {
4048
2
  }
4049
4050
  MSP430InterruptAttr *clone(ASTContext &C) const;
4051
  void printPretty(raw_ostream &OS,
4052
                   const PrintingPolicy &Policy) const;
4053
  const char *getSpelling() const;
4054
1
  unsigned getNumber() const {
4055
1
    return number;
4056
1
  }
4057
4058
4059
4060
0
  static bool classof(const Attr *A) { return A->getKind() == attr::MSP430Interrupt; }
4061
};
4062
4063
class MSStructAttr : public InheritableAttr {
4064
public:
4065
21
  static MSStructAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4066
21
    auto *A = new (Ctx) MSStructAttr(Loc, Ctx, 0);
4067
21
    A->setImplicit(true);
4068
21
    return A;
4069
21
  }
4070
4071
  MSStructAttr(SourceRange R, ASTContext &Ctx
4072
              , unsigned SI
4073
             )
4074
    : InheritableAttr(attr::MSStruct, R, SI, false, false)
4075
96
  {
4076
96
  }
4077
4078
  MSStructAttr *clone(ASTContext &C) const;
4079
  void printPretty(raw_ostream &OS,
4080
                   const PrintingPolicy &Policy) const;
4081
  const char *getSpelling() const;
4082
4083
4084
258k
  static bool classof(const Attr *A) { return A->getKind() == attr::MSStruct; }
4085
};
4086
4087
class MSVtorDispAttr : public InheritableAttr {
4088
unsigned vdm;
4089
4090
public:
4091
29
  static MSVtorDispAttr *CreateImplicit(ASTContext &Ctx, unsigned Vdm, SourceRange Loc = SourceRange()) {
4092
29
    auto *A = new (Ctx) MSVtorDispAttr(Loc, Ctx, Vdm, 0);
4093
29
    A->setImplicit(true);
4094
29
    return A;
4095
29
  }
4096
4097
  MSVtorDispAttr(SourceRange R, ASTContext &Ctx
4098
              , unsigned Vdm
4099
              , unsigned SI
4100
             )
4101
    : InheritableAttr(attr::MSVtorDisp, R, SI, false, false)
4102
              , vdm(Vdm)
4103
31
  {
4104
31
  }
4105
4106
  MSVtorDispAttr *clone(ASTContext &C) const;
4107
  void printPretty(raw_ostream &OS,
4108
                   const PrintingPolicy &Policy) const;
4109
  const char *getSpelling() const;
4110
0
  unsigned getVdm() const {
4111
0
    return vdm;
4112
0
  }
4113
4114
4115
  enum Mode {
4116
    Never,
4117
    ForVBaseOverride,
4118
    ForVFTable
4119
  };
4120
4121
26
  Mode getVtorDispMode() const { return Mode(vdm); }
4122
  
4123
4124
170
  static bool classof(const Attr *A) { return A->getKind() == attr::MSVtorDisp; }
4125
};
4126
4127
class MaxFieldAlignmentAttr : public InheritableAttr {
4128
unsigned alignment;
4129
4130
public:
4131
50.0k
  static MaxFieldAlignmentAttr *CreateImplicit(ASTContext &Ctx, unsigned Alignment, SourceRange Loc = SourceRange()) {
4132
50.0k
    auto *A = new (Ctx) MaxFieldAlignmentAttr(Loc, Ctx, Alignment, 0);
4133
50.0k
    A->setImplicit(true);
4134
50.0k
    return A;
4135
50.0k
  }
4136
4137
  MaxFieldAlignmentAttr(SourceRange R, ASTContext &Ctx
4138
              , unsigned Alignment
4139
              , unsigned SI
4140
             )
4141
    : InheritableAttr(attr::MaxFieldAlignment, R, SI, false, false)
4142
              , alignment(Alignment)
4143
50.0k
  {
4144
50.0k
  }
4145
4146
  MaxFieldAlignmentAttr *clone(ASTContext &C) const;
4147
  void printPretty(raw_ostream &OS,
4148
                   const PrintingPolicy &Policy) const;
4149
  const char *getSpelling() const;
4150
1.48k
  unsigned getAlignment() const {
4151
1.48k
    return alignment;
4152
1.48k
  }
4153
4154
4155
4156
21.8k
  static bool classof(const Attr *A) { return A->getKind() == attr::MaxFieldAlignment; }
4157
};
4158
4159
class MayAliasAttr : public InheritableAttr {
4160
public:
4161
  static MayAliasAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4162
    auto *A = new (Ctx) MayAliasAttr(Loc, Ctx, 0);
4163
    A->setImplicit(true);
4164
    return A;
4165
  }
4166
4167
  MayAliasAttr(SourceRange R, ASTContext &Ctx
4168
              , unsigned SI
4169
             )
4170
    : InheritableAttr(attr::MayAlias, R, SI, false, false)
4171
5.25k
  {
4172
5.25k
  }
4173
4174
  MayAliasAttr *clone(ASTContext &C) const;
4175
  void printPretty(raw_ostream &OS,
4176
                   const PrintingPolicy &Policy) const;
4177
  const char *getSpelling() const;
4178
4179
4180
74.7k
  static bool classof(const Attr *A) { return A->getKind() == attr::MayAlias; }
4181
};
4182
4183
class MicroMipsAttr : public InheritableAttr {
4184
public:
4185
  static MicroMipsAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4186
    auto *A = new (Ctx) MicroMipsAttr(Loc, Ctx, 0);
4187
    A->setImplicit(true);
4188
    return A;
4189
  }
4190
4191
  MicroMipsAttr(SourceRange R, ASTContext &Ctx
4192
              , unsigned SI
4193
             )
4194
    : InheritableAttr(attr::MicroMips, R, SI, false, false)
4195
3
  {
4196
3
  }
4197
4198
  MicroMipsAttr *clone(ASTContext &C) const;
4199
  void printPretty(raw_ostream &OS,
4200
                   const PrintingPolicy &Policy) const;
4201
  const char *getSpelling() const;
4202
4203
4204
34
  static bool classof(const Attr *A) { return A->getKind() == attr::MicroMips; }
4205
};
4206
4207
class MinSizeAttr : public InheritableAttr {
4208
public:
4209
  static MinSizeAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4210
    auto *A = new (Ctx) MinSizeAttr(Loc, Ctx, 0);
4211
    A->setImplicit(true);
4212
    return A;
4213
  }
4214
4215
  MinSizeAttr(SourceRange R, ASTContext &Ctx
4216
              , unsigned SI
4217
             )
4218
    : InheritableAttr(attr::MinSize, R, SI, false, false)
4219
35
  {
4220
35
  }
4221
4222
  MinSizeAttr *clone(ASTContext &C) const;
4223
  void printPretty(raw_ostream &OS,
4224
                   const PrintingPolicy &Policy) const;
4225
  const char *getSpelling() const;
4226
4227
4228
504k
  static bool classof(const Attr *A) { return A->getKind() == attr::MinSize; }
4229
};
4230
4231
class MinVectorWidthAttr : public InheritableAttr {
4232
unsigned vectorWidth;
4233
4234
public:
4235
  static MinVectorWidthAttr *CreateImplicit(ASTContext &Ctx, unsigned VectorWidth, SourceRange Loc = SourceRange()) {
4236
    auto *A = new (Ctx) MinVectorWidthAttr(Loc, Ctx, VectorWidth, 0);
4237
    A->setImplicit(true);
4238
    return A;
4239
  }
4240
4241
  MinVectorWidthAttr(SourceRange R, ASTContext &Ctx
4242
              , unsigned VectorWidth
4243
              , unsigned SI
4244
             )
4245
    : InheritableAttr(attr::MinVectorWidth, R, SI, false, false)
4246
              , vectorWidth(VectorWidth)
4247
511k
  {
4248
511k
  }
4249
4250
  MinVectorWidthAttr *clone(ASTContext &C) const;
4251
  void printPretty(raw_ostream &OS,
4252
                   const PrintingPolicy &Policy) const;
4253
  const char *getSpelling() const;
4254
20.5k
  unsigned getVectorWidth() const {
4255
20.5k
    return vectorWidth;
4256
20.5k
  }
4257
4258
4259
4260
120k
  static bool classof(const Attr *A) { return A->getKind() == attr::MinVectorWidth; }
4261
};
4262
4263
class Mips16Attr : public InheritableAttr {
4264
public:
4265
  static Mips16Attr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4266
    auto *A = new (Ctx) Mips16Attr(Loc, Ctx, 0);
4267
    A->setImplicit(true);
4268
    return A;
4269
  }
4270
4271
  Mips16Attr(SourceRange R, ASTContext &Ctx
4272
              , unsigned SI
4273
             )
4274
    : InheritableAttr(attr::Mips16, R, SI, false, false)
4275
9
  {
4276
9
  }
4277
4278
  Mips16Attr *clone(ASTContext &C) const;
4279
  void printPretty(raw_ostream &OS,
4280
                   const PrintingPolicy &Policy) const;
4281
  const char *getSpelling() const;
4282
4283
4284
38
  static bool classof(const Attr *A) { return A->getKind() == attr::Mips16; }
4285
};
4286
4287
class MipsInterruptAttr : public InheritableAttr {
4288
public:
4289
  enum InterruptType {
4290
    sw0,
4291
    sw1,
4292
    hw0,
4293
    hw1,
4294
    hw2,
4295
    hw3,
4296
    hw4,
4297
    hw5,
4298
    eic
4299
  };
4300
private:
4301
  InterruptType interrupt;
4302
4303
public:
4304
  static MipsInterruptAttr *CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, SourceRange Loc = SourceRange()) {
4305
    auto *A = new (Ctx) MipsInterruptAttr(Loc, Ctx, Interrupt, 0);
4306
    A->setImplicit(true);
4307
    return A;
4308
  }
4309
4310
  MipsInterruptAttr(SourceRange R, ASTContext &Ctx
4311
              , InterruptType Interrupt
4312
              , unsigned SI
4313
             )
4314
    : InheritableAttr(attr::MipsInterrupt, R, SI, false, false)
4315
              , interrupt(Interrupt)
4316
20
  {
4317
20
  }
4318
4319
  MipsInterruptAttr *clone(ASTContext &C) const;
4320
  void printPretty(raw_ostream &OS,
4321
                   const PrintingPolicy &Policy) const;
4322
  const char *getSpelling() const;
4323
9
  InterruptType getInterrupt() const {
4324
9
    return interrupt;
4325
9
  }
4326
4327
21
  static bool ConvertStrToInterruptType(StringRef Val, InterruptType &Out) {
4328
21
    Optional<InterruptType> R = llvm::StringSwitch<Optional<InterruptType>>(Val)
4329
21
      .Case("vector=sw0", MipsInterruptAttr::sw0)
4330
21
      .Case("vector=sw1", MipsInterruptAttr::sw1)
4331
21
      .Case("vector=hw0", MipsInterruptAttr::hw0)
4332
21
      .Case("vector=hw1", MipsInterruptAttr::hw1)
4333
21
      .Case("vector=hw2", MipsInterruptAttr::hw2)
4334
21
      .Case("vector=hw3", MipsInterruptAttr::hw3)
4335
21
      .Case("vector=hw4", MipsInterruptAttr::hw4)
4336
21
      .Case("vector=hw5", MipsInterruptAttr::hw5)
4337
21
      .Case("eic", MipsInterruptAttr::eic)
4338
21
      .Case("", MipsInterruptAttr::eic)
4339
21
      .Default(Optional<InterruptType>());
4340
21
    if (R) {
4341
20
      Out = *R;
4342
20
      return true;
4343
20
    }
4344
1
    return false;
4345
1
  }
4346
4347
0
  static const char *ConvertInterruptTypeToStr(InterruptType Val) {
4348
0
    switch(Val) {
4349
0
    case MipsInterruptAttr::sw0: return "vector=sw0";
4350
0
    case MipsInterruptAttr::sw1: return "vector=sw1";
4351
0
    case MipsInterruptAttr::hw0: return "vector=hw0";
4352
0
    case MipsInterruptAttr::hw1: return "vector=hw1";
4353
0
    case MipsInterruptAttr::hw2: return "vector=hw2";
4354
0
    case MipsInterruptAttr::hw3: return "vector=hw3";
4355
0
    case MipsInterruptAttr::hw4: return "vector=hw4";
4356
0
    case MipsInterruptAttr::hw5: return "vector=hw5";
4357
0
    case MipsInterruptAttr::eic: return "eic";
4358
0
    }
4359
0
    llvm_unreachable("No enumerator with that value");
4360
0
  }
4361
4362
4363
43
  static bool classof(const Attr *A) { return A->getKind() == attr::MipsInterrupt; }
4364
};
4365
4366
class MipsLongCallAttr : public InheritableAttr {
4367
public:
4368
  enum Spelling {
4369
    GNU_long_call = 0,
4370
    CXX11_gnu_long_call = 1,
4371
    GNU_far = 2,
4372
    CXX11_gnu_far = 3
4373
  };
4374
4375
  static MipsLongCallAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
4376
    auto *A = new (Ctx) MipsLongCallAttr(Loc, Ctx, S);
4377
    A->setImplicit(true);
4378
    return A;
4379
  }
4380
4381
  MipsLongCallAttr(SourceRange R, ASTContext &Ctx
4382
              , unsigned SI
4383
             )
4384
    : InheritableAttr(attr::MipsLongCall, R, SI, false, false)
4385
14
  {
4386
14
  }
4387
4388
  MipsLongCallAttr *clone(ASTContext &C) const;
4389
  void printPretty(raw_ostream &OS,
4390
                   const PrintingPolicy &Policy) const;
4391
  const char *getSpelling() const;
4392
  Spelling getSemanticSpelling() const {
4393
  switch (SpellingListIndex) {
4394
    default: llvm_unreachable("Unknown spelling list index");
4395
    case 0: return GNU_long_call;
4396
    case 1: return CXX11_gnu_long_call;
4397
    case 2: return GNU_far;
4398
    case 3: return CXX11_gnu_far;
4399
  }
4400
  }
4401
4402
4403
79
  static bool classof(const Attr *A) { return A->getKind() == attr::MipsLongCall; }
4404
};
4405
4406
class MipsShortCallAttr : public InheritableAttr {
4407
public:
4408
  enum Spelling {
4409
    GNU_short_call = 0,
4410
    CXX11_gnu_short_call = 1,
4411
    GNU_near = 2,
4412
    CXX11_gnu_near = 3
4413
  };
4414
4415
  static MipsShortCallAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
4416
    auto *A = new (Ctx) MipsShortCallAttr(Loc, Ctx, S);
4417
    A->setImplicit(true);
4418
    return A;
4419
  }
4420
4421
  MipsShortCallAttr(SourceRange R, ASTContext &Ctx
4422
              , unsigned SI
4423
             )
4424
    : InheritableAttr(attr::MipsShortCall, R, SI, false, false)
4425
14
  {
4426
14
  }
4427
4428
  MipsShortCallAttr *clone(ASTContext &C) const;
4429
  void printPretty(raw_ostream &OS,
4430
                   const PrintingPolicy &Policy) const;
4431
  const char *getSpelling() const;
4432
  Spelling getSemanticSpelling() const {
4433
  switch (SpellingListIndex) {
4434
    default: llvm_unreachable("Unknown spelling list index");
4435
    case 0: return GNU_short_call;
4436
    case 1: return CXX11_gnu_short_call;
4437
    case 2: return GNU_near;
4438
    case 3: return CXX11_gnu_near;
4439
  }
4440
  }
4441
4442
4443
73
  static bool classof(const Attr *A) { return A->getKind() == attr::MipsShortCall; }
4444
};
4445
4446
class ModeAttr : public Attr {
4447
IdentifierInfo * mode;
4448
4449
public:
4450
  static ModeAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * Mode, SourceRange Loc = SourceRange()) {
4451
    auto *A = new (Ctx) ModeAttr(Loc, Ctx, Mode, 0);
4452
    A->setImplicit(true);
4453
    return A;
4454
  }
4455
4456
  ModeAttr(SourceRange R, ASTContext &Ctx
4457
              , IdentifierInfo * Mode
4458
              , unsigned SI
4459
             )
4460
    : Attr(attr::Mode, R, SI, false)
4461
              , mode(Mode)
4462
2.43k
  {
4463
2.43k
  }
4464
4465
  ModeAttr *clone(ASTContext &C) const;
4466
  void printPretty(raw_ostream &OS,
4467
                   const PrintingPolicy &Policy) const;
4468
  const char *getSpelling() const;
4469
90
  IdentifierInfo * getMode() const {
4470
90
    return mode;
4471
90
  }
4472
4473
4474
4475
1.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::Mode; }
4476
};
4477
4478
class NSConsumedAttr : public InheritableParamAttr {
4479
public:
4480
153
  static NSConsumedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4481
153
    auto *A = new (Ctx) NSConsumedAttr(Loc, Ctx, 0);
4482
153
    A->setImplicit(true);
4483
153
    return A;
4484
153
  }
4485
4486
  NSConsumedAttr(SourceRange R, ASTContext &Ctx
4487
              , unsigned SI
4488
             )
4489
    : InheritableParamAttr(attr::NSConsumed, R, SI, false, false)
4490
375
  {
4491
375
  }
4492
4493
  NSConsumedAttr *clone(ASTContext &C) const;
4494
  void printPretty(raw_ostream &OS,
4495
                   const PrintingPolicy &Policy) const;
4496
  const char *getSpelling() const;
4497
4498
4499
1.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::NSConsumed; }
4500
};
4501
4502
class NSConsumesSelfAttr : public InheritableAttr {
4503
public:
4504
494
  static NSConsumesSelfAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4505
494
    auto *A = new (Ctx) NSConsumesSelfAttr(Loc, Ctx, 0);
4506
494
    A->setImplicit(true);
4507
494
    return A;
4508
494
  }
4509
4510
  NSConsumesSelfAttr(SourceRange R, ASTContext &Ctx
4511
              , unsigned SI
4512
             )
4513
    : InheritableAttr(attr::NSConsumesSelf, R, SI, false, false)
4514
673
  {
4515
673
  }
4516
4517
  NSConsumesSelfAttr *clone(ASTContext &C) const;
4518
  void printPretty(raw_ostream &OS,
4519
                   const PrintingPolicy &Policy) const;
4520
  const char *getSpelling() const;
4521
4522
4523
1.03k
  static bool classof(const Attr *A) { return A->getKind() == attr::NSConsumesSelf; }
4524
};
4525
4526
class NSReturnsAutoreleasedAttr : public InheritableAttr {
4527
public:
4528
  static NSReturnsAutoreleasedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4529
    auto *A = new (Ctx) NSReturnsAutoreleasedAttr(Loc, Ctx, 0);
4530
    A->setImplicit(true);
4531
    return A;
4532
  }
4533
4534
  NSReturnsAutoreleasedAttr(SourceRange R, ASTContext &Ctx
4535
              , unsigned SI
4536
             )
4537
    : InheritableAttr(attr::NSReturnsAutoreleased, R, SI, false, false)
4538
4
  {
4539
4
  }
4540
4541
  NSReturnsAutoreleasedAttr *clone(ASTContext &C) const;
4542
  void printPretty(raw_ostream &OS,
4543
                   const PrintingPolicy &Policy) const;
4544
  const char *getSpelling() const;
4545
4546
4547
46
  static bool classof(const Attr *A) { return A->getKind() == attr::NSReturnsAutoreleased; }
4548
};
4549
4550
class NSReturnsNotRetainedAttr : public InheritableAttr {
4551
public:
4552
3
  static NSReturnsNotRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4553
3
    auto *A = new (Ctx) NSReturnsNotRetainedAttr(Loc, Ctx, 0);
4554
3
    A->setImplicit(true);
4555
3
    return A;
4556
3
  }
4557
4558
  NSReturnsNotRetainedAttr(SourceRange R, ASTContext &Ctx
4559
              , unsigned SI
4560
             )
4561
    : InheritableAttr(attr::NSReturnsNotRetained, R, SI, false, false)
4562
119
  {
4563
119
  }
4564
4565
  NSReturnsNotRetainedAttr *clone(ASTContext &C) const;
4566
  void printPretty(raw_ostream &OS,
4567
                   const PrintingPolicy &Policy) const;
4568
  const char *getSpelling() const;
4569
4570
4571
32.2k
  static bool classof(const Attr *A) { return A->getKind() == attr::NSReturnsNotRetained; }
4572
};
4573
4574
class NSReturnsRetainedAttr : public InheritableAttr {
4575
public:
4576
875
  static NSReturnsRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4577
875
    auto *A = new (Ctx) NSReturnsRetainedAttr(Loc, Ctx, 0);
4578
875
    A->setImplicit(true);
4579
875
    return A;
4580
875
  }
4581
4582
  NSReturnsRetainedAttr(SourceRange R, ASTContext &Ctx
4583
              , unsigned SI
4584
             )
4585
    : InheritableAttr(attr::NSReturnsRetained, R, SI, false, false)
4586
1.86k
  {
4587
1.86k
  }
4588
4589
  NSReturnsRetainedAttr *clone(ASTContext &C) const;
4590
  void printPretty(raw_ostream &OS,
4591
                   const PrintingPolicy &Policy) const;
4592
  const char *getSpelling() const;
4593
4594
4595
18.5k
  static bool classof(const Attr *A) { return A->getKind() == attr::NSReturnsRetained; }
4596
};
4597
4598
class NakedAttr : public InheritableAttr {
4599
public:
4600
  static NakedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4601
    auto *A = new (Ctx) NakedAttr(Loc, Ctx, 0);
4602
    A->setImplicit(true);
4603
    return A;
4604
  }
4605
4606
  NakedAttr(SourceRange R, ASTContext &Ctx
4607
              , unsigned SI
4608
             )
4609
    : InheritableAttr(attr::Naked, R, SI, false, false)
4610
30
  {
4611
30
  }
4612
4613
  NakedAttr *clone(ASTContext &C) const;
4614
  void printPretty(raw_ostream &OS,
4615
                   const PrintingPolicy &Policy) const;
4616
  const char *getSpelling() const;
4617
4618
4619
9.34M
  static bool classof(const Attr *A) { return A->getKind() == attr::Naked; }
4620
};
4621
4622
class NoAliasAttr : public InheritableAttr {
4623
public:
4624
  static NoAliasAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4625
    auto *A = new (Ctx) NoAliasAttr(Loc, Ctx, 0);
4626
    A->setImplicit(true);
4627
    return A;
4628
  }
4629
4630
  NoAliasAttr(SourceRange R, ASTContext &Ctx
4631
              , unsigned SI
4632
             )
4633
    : InheritableAttr(attr::NoAlias, R, SI, false, false)
4634
2
  {
4635
2
  }
4636
4637
  NoAliasAttr *clone(ASTContext &C) const;
4638
  void printPretty(raw_ostream &OS,
4639
                   const PrintingPolicy &Policy) const;
4640
  const char *getSpelling() const;
4641
4642
4643
489k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoAlias; }
4644
};
4645
4646
class NoCommonAttr : public InheritableAttr {
4647
public:
4648
  static NoCommonAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4649
    auto *A = new (Ctx) NoCommonAttr(Loc, Ctx, 0);
4650
    A->setImplicit(true);
4651
    return A;
4652
  }
4653
4654
  NoCommonAttr(SourceRange R, ASTContext &Ctx
4655
              , unsigned SI
4656
             )
4657
    : InheritableAttr(attr::NoCommon, R, SI, false, false)
4658
4
  {
4659
4
  }
4660
4661
  NoCommonAttr *clone(ASTContext &C) const;
4662
  void printPretty(raw_ostream &OS,
4663
                   const PrintingPolicy &Policy) const;
4664
  const char *getSpelling() const;
4665
4666
4667
863
  static bool classof(const Attr *A) { return A->getKind() == attr::NoCommon; }
4668
};
4669
4670
class NoDebugAttr : public InheritableAttr {
4671
public:
4672
  static NoDebugAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4673
    auto *A = new (Ctx) NoDebugAttr(Loc, Ctx, 0);
4674
    A->setImplicit(true);
4675
    return A;
4676
  }
4677
4678
  NoDebugAttr(SourceRange R, ASTContext &Ctx
4679
              , unsigned SI
4680
             )
4681
    : InheritableAttr(attr::NoDebug, R, SI, false, false)
4682
700k
  {
4683
700k
  }
4684
4685
  NoDebugAttr *clone(ASTContext &C) const;
4686
  void printPretty(raw_ostream &OS,
4687
                   const PrintingPolicy &Policy) const;
4688
  const char *getSpelling() const;
4689
4690
4691
120k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoDebug; }
4692
};
4693
4694
class NoDuplicateAttr : public InheritableAttr {
4695
public:
4696
  static NoDuplicateAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4697
    auto *A = new (Ctx) NoDuplicateAttr(Loc, Ctx, 0);
4698
    A->setImplicit(true);
4699
    return A;
4700
  }
4701
4702
  NoDuplicateAttr(SourceRange R, ASTContext &Ctx
4703
              , unsigned SI
4704
             )
4705
    : InheritableAttr(attr::NoDuplicate, R, SI, false, false)
4706
5
  {
4707
5
  }
4708
4709
  NoDuplicateAttr *clone(ASTContext &C) const;
4710
  void printPretty(raw_ostream &OS,
4711
                   const PrintingPolicy &Policy) const;
4712
  const char *getSpelling() const;
4713
4714
4715
625k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoDuplicate; }
4716
};
4717
4718
class NoEscapeAttr : public Attr {
4719
public:
4720
  static NoEscapeAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4721
    auto *A = new (Ctx) NoEscapeAttr(Loc, Ctx, 0);
4722
    A->setImplicit(true);
4723
    return A;
4724
  }
4725
4726
  NoEscapeAttr(SourceRange R, ASTContext &Ctx
4727
              , unsigned SI
4728
             )
4729
    : Attr(attr::NoEscape, R, SI, false)
4730
1.84k
  {
4731
1.84k
  }
4732
4733
  NoEscapeAttr *clone(ASTContext &C) const;
4734
  void printPretty(raw_ostream &OS,
4735
                   const PrintingPolicy &Policy) const;
4736
  const char *getSpelling() const;
4737
4738
4739
8.97k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoEscape; }
4740
};
4741
4742
class NoInlineAttr : public InheritableAttr {
4743
public:
4744
22
  static NoInlineAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4745
22
    auto *A = new (Ctx) NoInlineAttr(Loc, Ctx, 0);
4746
22
    A->setImplicit(true);
4747
22
    return A;
4748
22
  }
4749
4750
  NoInlineAttr(SourceRange R, ASTContext &Ctx
4751
              , unsigned SI
4752
             )
4753
    : InheritableAttr(attr::NoInline, R, SI, false, false)
4754
16.0k
  {
4755
16.0k
  }
4756
4757
  NoInlineAttr *clone(ASTContext &C) const;
4758
  void printPretty(raw_ostream &OS,
4759
                   const PrintingPolicy &Policy) const;
4760
  const char *getSpelling() const;
4761
4762
4763
128k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoInline; }
4764
};
4765
4766
class NoInstrumentFunctionAttr : public InheritableAttr {
4767
public:
4768
  static NoInstrumentFunctionAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4769
    auto *A = new (Ctx) NoInstrumentFunctionAttr(Loc, Ctx, 0);
4770
    A->setImplicit(true);
4771
    return A;
4772
  }
4773
4774
  NoInstrumentFunctionAttr(SourceRange R, ASTContext &Ctx
4775
              , unsigned SI
4776
             )
4777
    : InheritableAttr(attr::NoInstrumentFunction, R, SI, false, false)
4778
30
  {
4779
30
  }
4780
4781
  NoInstrumentFunctionAttr *clone(ASTContext &C) const;
4782
  void printPretty(raw_ostream &OS,
4783
                   const PrintingPolicy &Policy) const;
4784
  const char *getSpelling() const;
4785
4786
4787
27
  static bool classof(const Attr *A) { return A->getKind() == attr::NoInstrumentFunction; }
4788
};
4789
4790
class NoMicroMipsAttr : public InheritableAttr {
4791
public:
4792
  static NoMicroMipsAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4793
    auto *A = new (Ctx) NoMicroMipsAttr(Loc, Ctx, 0);
4794
    A->setImplicit(true);
4795
    return A;
4796
  }
4797
4798
  NoMicroMipsAttr(SourceRange R, ASTContext &Ctx
4799
              , unsigned SI
4800
             )
4801
    : InheritableAttr(attr::NoMicroMips, R, SI, false, false)
4802
2
  {
4803
2
  }
4804
4805
  NoMicroMipsAttr *clone(ASTContext &C) const;
4806
  void printPretty(raw_ostream &OS,
4807
                   const PrintingPolicy &Policy) const;
4808
  const char *getSpelling() const;
4809
4810
4811
29
  static bool classof(const Attr *A) { return A->getKind() == attr::NoMicroMips; }
4812
};
4813
4814
class NoMips16Attr : public InheritableAttr {
4815
public:
4816
  static NoMips16Attr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4817
    auto *A = new (Ctx) NoMips16Attr(Loc, Ctx, 0);
4818
    A->setImplicit(true);
4819
    return A;
4820
  }
4821
4822
  NoMips16Attr(SourceRange R, ASTContext &Ctx
4823
              , unsigned SI
4824
             )
4825
    : InheritableAttr(attr::NoMips16, R, SI, false, false)
4826
6
  {
4827
6
  }
4828
4829
  NoMips16Attr *clone(ASTContext &C) const;
4830
  void printPretty(raw_ostream &OS,
4831
                   const PrintingPolicy &Policy) const;
4832
  const char *getSpelling() const;
4833
4834
4835
29
  static bool classof(const Attr *A) { return A->getKind() == attr::NoMips16; }
4836
};
4837
4838
class NoReturnAttr : public InheritableAttr {
4839
public:
4840
  static NoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4841
    auto *A = new (Ctx) NoReturnAttr(Loc, Ctx, 0);
4842
    A->setImplicit(true);
4843
    return A;
4844
  }
4845
4846
  NoReturnAttr(SourceRange R, ASTContext &Ctx
4847
              , unsigned SI
4848
             )
4849
    : InheritableAttr(attr::NoReturn, R, SI, false, false)
4850
14
  {
4851
14
  }
4852
4853
  NoReturnAttr *clone(ASTContext &C) const;
4854
  void printPretty(raw_ostream &OS,
4855
                   const PrintingPolicy &Policy) const;
4856
  const char *getSpelling() const;
4857
4858
4859
5.38M
  static bool classof(const Attr *A) { return A->getKind() == attr::NoReturn; }
4860
};
4861
4862
class NoSanitizeAttr : public InheritableAttr {
4863
  unsigned sanitizers_Size;
4864
  StringRef *sanitizers_;
4865
4866
public:
4867
  static NoSanitizeAttr *CreateImplicit(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, SourceRange Loc = SourceRange()) {
4868
    auto *A = new (Ctx) NoSanitizeAttr(Loc, Ctx, Sanitizers, SanitizersSize, 0);
4869
    A->setImplicit(true);
4870
    return A;
4871
  }
4872
4873
  NoSanitizeAttr(SourceRange R, ASTContext &Ctx
4874
              , StringRef *Sanitizers, unsigned SanitizersSize
4875
              , unsigned SI
4876
             )
4877
    : InheritableAttr(attr::NoSanitize, R, SI, false, false)
4878
              , sanitizers_Size(SanitizersSize), sanitizers_(new (Ctx, 16) StringRef[sanitizers_Size])
4879
9.67k
  {
4880
19.3k
    for (size_t I = 0, E = sanitizers_Size; I != E;
4881
9.68k
         ++I) {
4882
9.68k
      StringRef Ref = Sanitizers[I];
4883
9.68k
      if (!Ref.empty()) {
4884
9.68k
        char *Mem = new (Ctx, 1) char[Ref.size()];
4885
9.68k
        std::memcpy(Mem, Ref.data(), Ref.size());
4886
9.68k
        sanitizers_[I] = StringRef(Mem, Ref.size());
4887
9.68k
      }
4888
9.68k
    }
4889
9.67k
  }
4890
4891
  NoSanitizeAttr(SourceRange R, ASTContext &Ctx
4892
              , unsigned SI
4893
             )
4894
    : InheritableAttr(attr::NoSanitize, R, SI, false, false)
4895
              , sanitizers_Size(0), sanitizers_(nullptr)
4896
  {
4897
  }
4898
4899
  NoSanitizeAttr *clone(ASTContext &C) const;
4900
  void printPretty(raw_ostream &OS,
4901
                   const PrintingPolicy &Policy) const;
4902
  const char *getSpelling() const;
4903
  typedef StringRef* sanitizers_iterator;
4904
890
  sanitizers_iterator sanitizers_begin() const { return sanitizers_; }
4905
890
  sanitizers_iterator sanitizers_end() const { return sanitizers_ + sanitizers_Size; }
4906
1
  unsigned sanitizers_size() const { return sanitizers_Size; }
4907
890
  llvm::iterator_range<sanitizers_iterator> sanitizers() const { return llvm::make_range(sanitizers_begin(), sanitizers_end()); }
4908
4909
4910
4911
879
    SanitizerMask getMask() const {
4912
879
      SanitizerMask Mask = 0;
4913
879
      for (auto SanitizerName : sanitizers()) {
4914
879
        SanitizerMask ParsedMask =
4915
879
            parseSanitizerValue(SanitizerName, /*AllowGroups=*/true);
4916
879
        Mask |= expandSanitizerGroups(ParsedMask);
4917
879
      }
4918
879
      return Mask;
4919
879
    }
4920
  
4921
4922
134k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoSanitize; }
4923
};
4924
4925
class NoSplitStackAttr : public InheritableAttr {
4926
public:
4927
  static NoSplitStackAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4928
    auto *A = new (Ctx) NoSplitStackAttr(Loc, Ctx, 0);
4929
    A->setImplicit(true);
4930
    return A;
4931
  }
4932
4933
  NoSplitStackAttr(SourceRange R, ASTContext &Ctx
4934
              , unsigned SI
4935
             )
4936
    : InheritableAttr(attr::NoSplitStack, R, SI, false, false)
4937
16
  {
4938
16
  }
4939
4940
  NoSplitStackAttr *clone(ASTContext &C) const;
4941
  void printPretty(raw_ostream &OS,
4942
                   const PrintingPolicy &Policy) const;
4943
  const char *getSpelling() const;
4944
4945
4946
4
  static bool classof(const Attr *A) { return A->getKind() == attr::NoSplitStack; }
4947
};
4948
4949
class NoStackProtectorAttr : public InheritableAttr {
4950
public:
4951
  static NoStackProtectorAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4952
    auto *A = new (Ctx) NoStackProtectorAttr(Loc, Ctx, 0);
4953
    A->setImplicit(true);
4954
    return A;
4955
  }
4956
4957
  NoStackProtectorAttr(SourceRange R, ASTContext &Ctx
4958
              , unsigned SI
4959
             )
4960
    : InheritableAttr(attr::NoStackProtector, R, SI, false, false)
4961
10
  {
4962
10
  }
4963
4964
  NoStackProtectorAttr *clone(ASTContext &C) const;
4965
  void printPretty(raw_ostream &OS,
4966
                   const PrintingPolicy &Policy) const;
4967
  const char *getSpelling() const;
4968
4969
4970
132k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoStackProtector; }
4971
};
4972
4973
class NoThreadSafetyAnalysisAttr : public InheritableAttr {
4974
public:
4975
  static NoThreadSafetyAnalysisAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4976
    auto *A = new (Ctx) NoThreadSafetyAnalysisAttr(Loc, Ctx, 0);
4977
    A->setImplicit(true);
4978
    return A;
4979
  }
4980
4981
  NoThreadSafetyAnalysisAttr(SourceRange R, ASTContext &Ctx
4982
              , unsigned SI
4983
             )
4984
    : InheritableAttr(attr::NoThreadSafetyAnalysis, R, SI, false, false)
4985
69
  {
4986
69
  }
4987
4988
  NoThreadSafetyAnalysisAttr *clone(ASTContext &C) const;
4989
  void printPretty(raw_ostream &OS,
4990
                   const PrintingPolicy &Policy) const;
4991
  const char *getSpelling() const;
4992
4993
4994
4.46k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoThreadSafetyAnalysis; }
4995
};
4996
4997
class NoThrowAttr : public InheritableAttr {
4998
public:
4999
452k
  static NoThrowAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5000
452k
    auto *A = new (Ctx) NoThrowAttr(Loc, Ctx, 0);
5001
452k
    A->setImplicit(true);
5002
452k
    return A;
5003
452k
  }
5004
5005
  NoThrowAttr(SourceRange R, ASTContext &Ctx
5006
              , unsigned SI
5007
             )
5008
    : InheritableAttr(attr::NoThrow, R, SI, false, false)
5009
575k
  {
5010
575k
  }
5011
5012
  NoThrowAttr *clone(ASTContext &C) const;
5013
  void printPretty(raw_ostream &OS,
5014
                   const PrintingPolicy &Policy) const;
5015
  const char *getSpelling() const;
5016
5017
5018
1.18M
  static bool classof(const Attr *A) { return A->getKind() == attr::NoThrow; }
5019
};
5020
5021
class NonNullAttr : public InheritableParamAttr {
5022
  unsigned args_Size;
5023
  ParamIdx *args_;
5024
5025
public:
5026
  static NonNullAttr *CreateImplicit(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
5027
    auto *A = new (Ctx) NonNullAttr(Loc, Ctx, Args, ArgsSize, 0);
5028
    A->setImplicit(true);
5029
    return A;
5030
  }
5031
5032
  NonNullAttr(SourceRange R, ASTContext &Ctx
5033
              , ParamIdx *Args, unsigned ArgsSize
5034
              , unsigned SI
5035
             )
5036
    : InheritableParamAttr(attr::NonNull, R, SI, false, true)
5037
              , args_Size(ArgsSize), args_(new (Ctx, 16) ParamIdx[args_Size])
5038
8.67k
  {
5039
8.67k
    std::copy(Args, Args + args_Size, args_);
5040
8.67k
  }
5041
5042
  NonNullAttr(SourceRange R, ASTContext &Ctx
5043
              , unsigned SI
5044
             )
5045
    : InheritableParamAttr(attr::NonNull, R, SI, false, true)
5046
              , args_Size(0), args_(nullptr)
5047
  {
5048
  }
5049
5050
  NonNullAttr *clone(ASTContext &C) const;
5051
  void printPretty(raw_ostream &OS,
5052
                   const PrintingPolicy &Policy) const;
5053
  const char *getSpelling() const;
5054
  typedef ParamIdx* args_iterator;
5055
1.08k
  args_iterator args_begin() const { return args_; }
5056
1.19k
  args_iterator args_end() const { return args_ + args_Size; }
5057
1.53k
  unsigned args_size() const { return args_Size; }
5058
980
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
5059
5060
5061
5062
113
    bool isNonNull(unsigned IdxAST) const {
5063
113
      if (!args_size())
5064
6
        return true;
5065
107
      return args_end() != std::find_if(
5066
107
          args_begin(), args_end(),
5067
111
          [=](const ParamIdx &Idx) { return Idx.getASTIndex() == IdxAST; });
5068
107
    }
5069
  
5070
5071
3.73M
  static bool classof(const Attr *A) { return A->getKind() == attr::NonNull; }
5072
};
5073
5074
class NotTailCalledAttr : public InheritableAttr {
5075
public:
5076
  static NotTailCalledAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5077
    auto *A = new (Ctx) NotTailCalledAttr(Loc, Ctx, 0);
5078
    A->setImplicit(true);
5079
    return A;
5080
  }
5081
5082
  NotTailCalledAttr(SourceRange R, ASTContext &Ctx
5083
              , unsigned SI
5084
             )
5085
    : InheritableAttr(attr::NotTailCalled, R, SI, false, false)
5086
227
  {
5087
227
  }
5088
5089
  NotTailCalledAttr *clone(ASTContext &C) const;
5090
  void printPretty(raw_ostream &OS,
5091
                   const PrintingPolicy &Policy) const;
5092
  const char *getSpelling() const;
5093
5094
5095
8.08M
  static bool classof(const Attr *A) { return A->getKind() == attr::NotTailCalled; }
5096
};
5097
5098
class OMPCaptureKindAttr : public Attr {
5099
unsigned captureKind;
5100
5101
public:
5102
173k
  static OMPCaptureKindAttr *CreateImplicit(ASTContext &Ctx, unsigned CaptureKind, SourceRange Loc = SourceRange()) {
5103
173k
    auto *A = new (Ctx) OMPCaptureKindAttr(Loc, Ctx, CaptureKind, 0);
5104
173k
    A->setImplicit(true);
5105
173k
    return A;
5106
173k
  }
5107
5108
  OMPCaptureKindAttr(SourceRange R, ASTContext &Ctx
5109
              , unsigned CaptureKind
5110
              , unsigned SI
5111
             )
5112
    : Attr(attr::OMPCaptureKind, R, SI, false)
5113
              , captureKind(CaptureKind)
5114
178k
  {
5115
178k
  }
5116
5117
  OMPCaptureKindAttr *clone(ASTContext &C) const;
5118
  void printPretty(raw_ostream &OS,
5119
                   const PrintingPolicy &Policy) const;
5120
  const char *getSpelling() const;
5121
17.4k
  unsigned getCaptureKind() const {
5122
17.4k
    return captureKind;
5123
17.4k
  }
5124
5125
5126
5127
334
  static bool classof(const Attr *A) { return A->getKind() == attr::OMPCaptureKind; }
5128
};
5129
5130
class OMPCaptureNoInitAttr : public InheritableAttr {
5131
public:
5132
70
  static OMPCaptureNoInitAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5133
70
    auto *A = new (Ctx) OMPCaptureNoInitAttr(Loc, Ctx, 0);
5134
70
    A->setImplicit(true);
5135
70
    return A;
5136
70
  }
5137
5138
  OMPCaptureNoInitAttr(SourceRange R, ASTContext &Ctx
5139
              , unsigned SI
5140
             )
5141
    : InheritableAttr(attr::OMPCaptureNoInit, R, SI, false, false)
5142
88
  {
5143
88
  }
5144
5145
  OMPCaptureNoInitAttr *clone(ASTContext &C) const;
5146
  void printPretty(raw_ostream &OS,
5147
                   const PrintingPolicy &Policy) const;
5148
  const char *getSpelling() const;
5149
5150
5151
172
  static bool classof(const Attr *A) { return A->getKind() == attr::OMPCaptureNoInit; }
5152
};
5153
5154
class OMPDeclareSimdDeclAttr : public Attr {
5155
public:
5156
  enum BranchStateTy {
5157
    BS_Undefined,
5158
    BS_Inbranch,
5159
    BS_Notinbranch
5160
  };
5161
private:
5162
  BranchStateTy branchState;
5163
5164
Expr * simdlen;
5165
5166
  unsigned uniforms_Size;
5167
  Expr * *uniforms_;
5168
5169
  unsigned aligneds_Size;
5170
  Expr * *aligneds_;
5171
5172
  unsigned alignments_Size;
5173
  Expr * *alignments_;
5174
5175
  unsigned linears_Size;
5176
  Expr * *linears_;
5177
5178
  unsigned modifiers_Size;
5179
  unsigned *modifiers_;
5180
5181
  unsigned steps_Size;
5182
  Expr * *steps_;
5183
5184
public:
5185
306
  static OMPDeclareSimdDeclAttr *CreateImplicit(ASTContext &Ctx, BranchStateTy BranchState, Expr * Simdlen, Expr * *Uniforms, unsigned UniformsSize, Expr * *Aligneds, unsigned AlignedsSize, Expr * *Alignments, unsigned AlignmentsSize, Expr * *Linears, unsigned LinearsSize, unsigned *Modifiers, unsigned ModifiersSize, Expr * *Steps, unsigned StepsSize, SourceRange Loc = SourceRange()) {
5186
306
    auto *A = new (Ctx) OMPDeclareSimdDeclAttr(Loc, Ctx, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize, 0);
5187
306
    A->setImplicit(true);
5188
306
    return A;
5189
306
  }
5190
5191
  OMPDeclareSimdDeclAttr(SourceRange R, ASTContext &Ctx
5192
              , BranchStateTy BranchState
5193
              , Expr * Simdlen
5194
              , Expr * *Uniforms, unsigned UniformsSize
5195
              , Expr * *Aligneds, unsigned AlignedsSize
5196
              , Expr * *Alignments, unsigned AlignmentsSize
5197
              , Expr * *Linears, unsigned LinearsSize
5198
              , unsigned *Modifiers, unsigned ModifiersSize
5199
              , Expr * *Steps, unsigned StepsSize
5200
              , unsigned SI
5201
             )
5202
    : Attr(attr::OMPDeclareSimdDecl, R, SI, false)
5203
              , branchState(BranchState)
5204
              , simdlen(Simdlen)
5205
              , uniforms_Size(UniformsSize), uniforms_(new (Ctx, 16) Expr *[uniforms_Size])
5206
              , aligneds_Size(AlignedsSize), aligneds_(new (Ctx, 16) Expr *[aligneds_Size])
5207
              , alignments_Size(AlignmentsSize), alignments_(new (Ctx, 16) Expr *[alignments_Size])
5208
              , linears_Size(LinearsSize), linears_(new (Ctx, 16) Expr *[linears_Size])
5209
              , modifiers_Size(ModifiersSize), modifiers_(new (Ctx, 16) unsigned[modifiers_Size])
5210
              , steps_Size(StepsSize), steps_(new (Ctx, 16) Expr *[steps_Size])
5211
430
  {
5212
430
    std::copy(Uniforms, Uniforms + uniforms_Size, uniforms_);
5213
430
    std::copy(Aligneds, Aligneds + aligneds_Size, aligneds_);
5214
430
    std::copy(Alignments, Alignments + alignments_Size, alignments_);
5215
430
    std::copy(Linears, Linears + linears_Size, linears_);
5216
430
    std::copy(Modifiers, Modifiers + modifiers_Size, modifiers_);
5217
430
    std::copy(Steps, Steps + steps_Size, steps_);
5218
430
  }
5219
5220
  OMPDeclareSimdDeclAttr(SourceRange R, ASTContext &Ctx
5221
              , BranchStateTy BranchState
5222
              , Expr * Simdlen
5223
              , unsigned SI
5224
             )
5225
    : Attr(attr::OMPDeclareSimdDecl, R, SI, false)
5226
              , branchState(BranchState)
5227
              , simdlen(Simdlen)
5228
              , uniforms_Size(0), uniforms_(nullptr)
5229
              , aligneds_Size(0), aligneds_(nullptr)
5230
              , alignments_Size(0), alignments_(nullptr)
5231
              , linears_Size(0), linears_(nullptr)
5232
              , modifiers_Size(0), modifiers_(nullptr)
5233
              , steps_Size(0), steps_(nullptr)
5234
  {
5235
  }
5236
5237
  OMPDeclareSimdDeclAttr *clone(ASTContext &C) const;
5238
  void printPretty(raw_ostream &OS,
5239
                   const PrintingPolicy &Policy) const;
5240
  const char *getSpelling() const;
5241
414
  BranchStateTy getBranchState() const {
5242
414
    return branchState;
5243
414
  }
5244
5245
448
  static bool ConvertStrToBranchStateTy(StringRef Val, BranchStateTy &Out) {
5246
448
    Optional<BranchStateTy> R = llvm::StringSwitch<Optional<BranchStateTy>>(Val)
5247
448
      .Case("", OMPDeclareSimdDeclAttr::BS_Undefined)
5248
448
      .Case("inbranch", OMPDeclareSimdDeclAttr::BS_Inbranch)
5249
448
      .Case("notinbranch", OMPDeclareSimdDeclAttr::BS_Notinbranch)
5250
448
      .Default(Optional<BranchStateTy>());
5251
448
    if (R) {
5252
82
      Out = *R;
5253
82
      return true;
5254
82
    }
5255
366
    return false;
5256
366
  }
5257
5258
20
  static const char *ConvertBranchStateTyToStr(BranchStateTy Val) {
5259
20
    switch(Val) {
5260
20
    
case OMPDeclareSimdDeclAttr::BS_Undefined: return ""0
;
5261
20
    
case OMPDeclareSimdDeclAttr::BS_Inbranch: return "inbranch"10
;
5262
20
    
case OMPDeclareSimdDeclAttr::BS_Notinbranch: return "notinbranch"10
;
5263
0
    }
5264
0
    llvm_unreachable("No enumerator with that value");
5265
0
  }
5266
398
  Expr * getSimdlen() const {
5267
398
    return simdlen;
5268
398
  }
5269
5270
  typedef Expr ** uniforms_iterator;
5271
278
  uniforms_iterator uniforms_begin() const { return uniforms_; }
5272
278
  uniforms_iterator uniforms_end() const { return uniforms_ + uniforms_Size; }
5273
274
  unsigned uniforms_size() const { return uniforms_Size; }
5274
274
  llvm::iterator_range<uniforms_iterator> uniforms() const { return llvm::make_range(uniforms_begin(), uniforms_end()); }
5275
5276
5277
  typedef Expr ** aligneds_iterator;
5278
398
  aligneds_iterator aligneds_begin() const { return aligneds_; }
5279
398
  aligneds_iterator aligneds_end() const { return aligneds_ + aligneds_Size; }
5280
124
  unsigned aligneds_size() const { return aligneds_Size; }
5281
394
  llvm::iterator_range<aligneds_iterator> aligneds() const { return llvm::make_range(aligneds_begin(), aligneds_end()); }
5282
5283
5284
  typedef Expr ** alignments_iterator;
5285
398
  alignments_iterator alignments_begin() const { return alignments_; }
5286
128
  alignments_iterator alignments_end() const { return alignments_ + alignments_Size; }
5287
124
  unsigned alignments_size() const { return alignments_Size; }
5288
124
  llvm::iterator_range<alignments_iterator> alignments() const { return llvm::make_range(alignments_begin(), alignments_end()); }
5289
5290
5291
  typedef Expr ** linears_iterator;
5292
398
  linears_iterator linears_begin() const { return linears_; }
5293
398
  linears_iterator linears_end() const { return linears_ + linears_Size; }
5294
124
  unsigned linears_size() const { return linears_Size; }
5295
394
  llvm::iterator_range<linears_iterator> linears() const { return llvm::make_range(linears_begin(), linears_end()); }
5296
5297
5298
  typedef unsigned* modifiers_iterator;
5299
398
  modifiers_iterator modifiers_begin() const { return modifiers_; }
5300
186
  modifiers_iterator modifiers_end() const { return modifiers_ + modifiers_Size; }
5301
124
  unsigned modifiers_size() const { return modifiers_Size; }
5302
128
  llvm::iterator_range<modifiers_iterator> modifiers() const { return llvm::make_range(modifiers_begin(), modifiers_end()); }
5303
5304
5305
  typedef Expr ** steps_iterator;
5306
398
  steps_iterator steps_begin() const { return steps_; }
5307
128
  steps_iterator steps_end() const { return steps_ + steps_Size; }
5308
124
  unsigned steps_size() const { return steps_Size; }
5309
124
  llvm::iterator_range<steps_iterator> steps() const { return llvm::make_range(steps_begin(), steps_end()); }
5310
5311
5312
5313
    void printPrettyPragma(raw_ostream & OS, const PrintingPolicy &Policy)
5314
92
        const {
5315
92
      if (getBranchState() != BS_Undefined)
5316
16
        OS << ' ' << ConvertBranchStateTyToStr(getBranchState());
5317
92
      if (auto *E = getSimdlen()) {
5318
28
        OS << " simdlen(";
5319
28
        E->printPretty(OS, nullptr, Policy);
5320
28
        OS << ")";
5321
28
      }
5322
92
      if (uniforms_size() > 0) {
5323
20
        OS << " uniform";
5324
20
        StringRef Sep = "(";
5325
36
        for (auto *E : uniforms()) {
5326
36
          OS << Sep;
5327
36
          E->printPretty(OS, nullptr, Policy);
5328
36
          Sep = ", ";
5329
36
        }
5330
20
        OS << ")";
5331
20
      }
5332
92
      alignments_iterator NI = alignments_begin();
5333
92
      for (auto *E : aligneds()) {
5334
64
        OS << " aligned(";
5335
64
        E->printPretty(OS, nullptr, Policy);
5336
64
        if (*NI) {
5337
28
          OS << ": ";
5338
28
          (*NI)->printPretty(OS, nullptr, Policy);
5339
28
        }
5340
64
        OS << ")";
5341
64
        ++NI;
5342
64
      }
5343
92
      steps_iterator I = steps_begin();
5344
92
      modifiers_iterator MI = modifiers_begin();
5345
92
      for (auto *E : linears()) {
5346
52
        OS << " linear(";
5347
52
        if (*MI != OMPC_LINEAR_unknown)
5348
52
          OS << getOpenMPSimpleClauseTypeName(OMPC_linear, *MI) << "(";
5349
52
        E->printPretty(OS, nullptr, Policy);
5350
52
        if (*MI != OMPC_LINEAR_unknown)
5351
52
          OS << ")";
5352
52
        if (*I) {
5353
44
          OS << ": ";
5354
44
          (*I)->printPretty(OS, nullptr, Policy);
5355
44
        }
5356
52
        OS << ")";
5357
52
        ++I;
5358
52
        ++MI;
5359
52
      }
5360
92
    }
5361
  
5362
5363
1.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::OMPDeclareSimdDecl; }
5364
};
5365
5366
class OMPDeclareTargetDeclAttr : public Attr {
5367
public:
5368
  enum MapTypeTy {
5369
    MT_To,
5370
    MT_Link
5371
  };
5372
private:
5373
  MapTypeTy mapType;
5374
5375
public:
5376
248
  static OMPDeclareTargetDeclAttr *CreateImplicit(ASTContext &Ctx, MapTypeTy MapType, SourceRange Loc = SourceRange()) {
5377
248
    auto *A = new (Ctx) OMPDeclareTargetDeclAttr(Loc, Ctx, MapType, 0);
5378
248
    A->setImplicit(true);
5379
248
    return A;
5380
248
  }
5381
5382
  OMPDeclareTargetDeclAttr(SourceRange R, ASTContext &Ctx
5383
              , MapTypeTy MapType
5384
              , unsigned SI
5385
             )
5386
    : Attr(attr::OMPDeclareTargetDecl, R, SI, false)
5387
              , mapType(MapType)
5388
338
  {
5389
338
  }
5390
5391
  OMPDeclareTargetDeclAttr *clone(ASTContext &C) const;
5392
  void printPretty(raw_ostream &OS,
5393
                   const PrintingPolicy &Policy) const;
5394
  const char *getSpelling() const;
5395
580
  MapTypeTy getMapType() const {
5396
580
    return mapType;
5397
580
  }
5398
5399
48
  static bool ConvertStrToMapTypeTy(StringRef Val, MapTypeTy &Out) {
5400
48
    Optional<MapTypeTy> R = llvm::StringSwitch<Optional<MapTypeTy>>(Val)
5401
48
      .Case("to", OMPDeclareTargetDeclAttr::MT_To)
5402
48
      .Case("link", OMPDeclareTargetDeclAttr::MT_Link)
5403
48
      .Default(Optional<MapTypeTy>());
5404
48
    if (R) {
5405
46
      Out = *R;
5406
46
      return true;
5407
46
    }
5408
2
    return false;
5409
2
  }
5410
5411
12
  static const char *ConvertMapTypeTyToStr(MapTypeTy Val) {
5412
12
    switch(Val) {
5413
12
    
case OMPDeclareTargetDeclAttr::MT_To: return "to"0
;
5414
12
    case OMPDeclareTargetDeclAttr::MT_Link: return "link";
5415
0
    }
5416
0
    llvm_unreachable("No enumerator with that value");
5417
0
  }
5418
5419
92
    void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
5420
92
      // Use fake syntax because it is for testing and debugging purpose only.
5421
92
      if (getMapType() != MT_To)
5422
12
        OS << ' ' << ConvertMapTypeTyToStr(getMapType());
5423
92
    }
5424
  
5425
5426
232k
  static bool classof(const Attr *A) { return A->getKind() == attr::OMPDeclareTargetDecl; }
5427
};
5428
5429
class OMPReferencedVarAttr : public Attr {
5430
Expr * ref;
5431
5432
public:
5433
101k
  static OMPReferencedVarAttr *CreateImplicit(ASTContext &Ctx, Expr * Ref, SourceRange Loc = SourceRange()) {
5434
101k
    auto *A = new (Ctx) OMPReferencedVarAttr(Loc, Ctx, Ref, 0);
5435
101k
    A->setImplicit(true);
5436
101k
    return A;
5437
101k
  }
5438
5439
  OMPReferencedVarAttr(SourceRange R, ASTContext &Ctx
5440
              , Expr * Ref
5441
              , unsigned SI
5442
             )
5443
    : Attr(attr::OMPReferencedVar, R, SI, false)
5444
              , ref(Ref)
5445
109k
  {
5446
109k
  }
5447
5448
  OMPReferencedVarAttr *clone(ASTContext &C) const;
5449
  void printPretty(raw_ostream &OS,
5450
                   const PrintingPolicy &Policy) const;
5451
  const char *getSpelling() const;
5452
8.12k
  Expr * getRef() const {
5453
8.12k
    return ref;
5454
8.12k
  }
5455
5456
5457
5458
62
  static bool classof(const Attr *A) { return A->getKind() == attr::OMPReferencedVar; }
5459
};
5460
5461
class OMPThreadPrivateDeclAttr : public InheritableAttr {
5462
public:
5463
1.62k
  static OMPThreadPrivateDeclAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5464
1.62k
    auto *A = new (Ctx) OMPThreadPrivateDeclAttr(Loc, Ctx, 0);
5465
1.62k
    A->setImplicit(true);
5466
1.62k
    return A;
5467
1.62k
  }
5468
5469
  OMPThreadPrivateDeclAttr(SourceRange R, ASTContext &Ctx
5470
              , unsigned SI
5471
             )
5472
    : InheritableAttr(attr::OMPThreadPrivateDecl, R, SI, false, false)
5473
1.82k
  {
5474
1.82k
  }
5475
5476
  OMPThreadPrivateDeclAttr *clone(ASTContext &C) const;
5477
  void printPretty(raw_ostream &OS,
5478
                   const PrintingPolicy &Policy) const;
5479
  const char *getSpelling() const;
5480
5481
5482
26.0k
  static bool classof(const Attr *A) { return A->getKind() == attr::OMPThreadPrivateDecl; }
5483
};
5484
5485
class ObjCBoxableAttr : public Attr {
5486
public:
5487
  static ObjCBoxableAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5488
    auto *A = new (Ctx) ObjCBoxableAttr(Loc, Ctx, 0);
5489
    A->setImplicit(true);
5490
    return A;
5491
  }
5492
5493
  ObjCBoxableAttr(SourceRange R, ASTContext &Ctx
5494
              , unsigned SI
5495
             )
5496
    : Attr(attr::ObjCBoxable, R, SI, false)
5497
58
  {
5498
58
  }
5499
5500
  ObjCBoxableAttr *clone(ASTContext &C) const;
5501
  void printPretty(raw_ostream &OS,
5502
                   const PrintingPolicy &Policy) const;
5503
  const char *getSpelling() const;
5504
5505
5506
135
  static bool classof(const Attr *A) { return A->getKind() == attr::ObjCBoxable; }
5507
};
5508
5509
class ObjCBridgeAttr : public InheritableAttr {
5510
IdentifierInfo * bridgedType;
5511
5512
public:
5513
  static ObjCBridgeAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Loc = SourceRange()) {
5514
    auto *A = new (Ctx) ObjCBridgeAttr(Loc, Ctx, BridgedType, 0);
5515
    A->setImplicit(true);
5516
    return A;
5517
  }
5518
5519
  ObjCBridgeAttr(SourceRange R, ASTContext &Ctx
5520
              , IdentifierInfo * BridgedType
5521
              , unsigned SI
5522
             )
5523
    : InheritableAttr(attr::ObjCBridge, R, SI, false, false)
5524
              , bridgedType(BridgedType)
5525
1.42k
  {
5526
1.42k
  }
5527
5528
  ObjCBridgeAttr *clone(ASTContext &C) const;
5529
  void printPretty(raw_ostream &OS,
5530
                   const PrintingPolicy &Policy) const;
5531
  const char *getSpelling() const;
5532
19.2k
  IdentifierInfo * getBridgedType() const {
5533
19.2k
    return bridgedType;
5534
19.2k
  }
5535
5536
5537
5538
46.3k
  static bool classof(const Attr *A) { return A->getKind() == attr::ObjCBridge; }
5539
};
5540
5541
class ObjCBridgeMutableAttr : public InheritableAttr {
5542
IdentifierInfo * bridgedType;
5543
5544
public:
5545
  static ObjCBridgeMutableAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Loc = SourceRange()) {
5546
    auto *A = new (Ctx) ObjCBridgeMutableAttr(Loc, Ctx, BridgedType, 0);
5547
    A->setImplicit(true);
5548
    return A;
5549
  }
5550
5551
  ObjCBridgeMutableAttr(SourceRange R, ASTContext &Ctx
5552
              , IdentifierInfo * BridgedType
5553
              , unsigned SI
5554
             )
5555
    : InheritableAttr(attr::ObjCBridgeMutable, R, SI, false, false)
5556
              , bridgedType(BridgedType)
5557
969
  {
5558
969
  }
5559
5560
  ObjCBridgeMutableAttr *clone(ASTContext &C) const;
5561
  void printPretty(raw_ostream &OS,
5562
                   const PrintingPolicy &Policy) const;
5563
  const char *getSpelling() const;
5564
1.80k
  IdentifierInfo * getBridgedType() const {
5565
1.80k
    return bridgedType;
5566
1.80k
  }
5567
5568
5569
5570
9.77k
  static bool classof(const Attr *A) { return A->getKind() == attr::ObjCBridgeMutable; }
5571
};
5572
5573
class ObjCBridgeRelatedAttr : public InheritableAttr {
5574
IdentifierInfo * relatedClass;
5575
5576
IdentifierInfo * classMethod;
5577
5578
IdentifierInfo * instanceMethod;
5579
5580
public:
5581
  static ObjCBridgeRelatedAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, SourceRange Loc = SourceRange()) {
5582
    auto *A = new (Ctx) ObjCBridgeRelatedAttr(Loc, Ctx, RelatedClass, ClassMethod, InstanceMethod, 0);
5583
    A->setImplicit(true);
5584
    return A;
5585
  }
5586
5587
  ObjCBridgeRelatedAttr(SourceRange R, ASTContext &Ctx
5588
              , IdentifierInfo * RelatedClass
5589
              , IdentifierInfo * ClassMethod
5590
              , IdentifierInfo * InstanceMethod
5591
              , unsigned SI
5592
             )
5593
    : InheritableAttr(attr::ObjCBridgeRelated, R, SI, false, false)
5594
              , relatedClass(RelatedClass)
5595
              , classMethod(ClassMethod)
5596
              , instanceMethod(InstanceMethod)
5597
26
  {
5598
26
  }
5599
5600
  ObjCBridgeRelatedAttr *clone(ASTContext &C) const;
5601
  void printPretty(raw_ostream &OS,
5602
                   const PrintingPolicy &Policy) const;
5603
  const char *getSpelling() const;
5604
71
  IdentifierInfo * getRelatedClass() const {
5605
71
    return relatedClass;
5606
71
  }
5607
5608
69
  IdentifierInfo * getClassMethod() const {
5609
69
    return classMethod;
5610
69
  }
5611
5612
69
  IdentifierInfo * getInstanceMethod() const {
5613
69
    return instanceMethod;
5614
69
  }
5615
5616
5617
5618
550
  static bool classof(const Attr *A) { return A->getKind() == attr::ObjCBridgeRelated; }
5619
};
5620
5621
class ObjCDesignatedInitializerAttr : public Attr {
5622
public:
5623
  static ObjCDesignatedInitializerAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5624
    auto *A = new (Ctx) ObjCDesignatedInitializerAttr(Loc, Ctx, 0);
5625
    A->setImplicit(true);
5626
    return A;
5627
  }
5628
5629
  ObjCDesignatedInitializerAttr(SourceRange R, ASTContext &Ctx
5630
              , unsigned SI
5631
             )
5632
    : Attr(attr::ObjCDesignatedInitializer, R, SI, false)
5633
2.06k
  {
5634
2.06k
  }
5635
5636
  ObjCDesignatedInitializerAttr *clone(ASTContext &C) const;
5637
  void printPretty(raw_ostream &OS,
5638
                   const PrintingPolicy &Policy) const;
5639
  const char *getSpelling() const;
5640
5641
5642
76
  static bool classof(const Attr *A) { return A->getKind() == attr::ObjCDesignatedInitializer; }
5643
};
5644
5645
class ObjCExceptionAttr : public InheritableAttr {
5646
public:
5647
  static ObjCExceptionAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5648
    auto *A = new (Ctx) ObjCExceptionAttr(Loc, Ctx, 0);
5649
    A->setImplicit(true);
5650
    return A;
5651
  }
5652
5653
  ObjCExceptionAttr(SourceRange R, ASTContext &Ctx
5654
              , unsigned SI
5655
             )
5656
    : InheritableAttr(attr::ObjCException, R, SI, false, false)
5657