Coverage Report

Created: 2019-03-24 22:13

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