Coverage Report

Created: 2018-12-14 11:24

/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
318
  static bool classof(const Attr *A) { return A->getKind() == attr::AArch64VectorPcs; }
34
};
35
36
class AMDGPUFlatWorkGroupSizeAttr : public InheritableAttr {
37
unsigned min;
38
39
unsigned max;
40
41
public:
42
  static AMDGPUFlatWorkGroupSizeAttr *CreateImplicit(ASTContext &Ctx, unsigned Min, unsigned 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
              , unsigned Min
50
              , unsigned Max
51
              , unsigned SI
52
             )
53
    : InheritableAttr(attr::AMDGPUFlatWorkGroupSize, R, SI, false, false)
54
              , min(Min)
55
              , max(Max)
56
86
  {
57
86
  }
58
59
  AMDGPUFlatWorkGroupSizeAttr *clone(ASTContext &C) const;
60
  void printPretty(raw_ostream &OS,
61
                   const PrintingPolicy &Policy) const;
62
  const char *getSpelling() const;
63
47
  unsigned getMin() const {
64
47
    return min;
65
47
  }
66
67
47
  unsigned getMax() const {
68
47
    return max;
69
47
  }
70
71
72
73
6.48M
  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
6.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
6.48M
  static bool classof(const Attr *A) { return A->getKind() == attr::AMDGPUNumVGPR; }
138
};
139
140
class AMDGPUWavesPerEUAttr : public InheritableAttr {
141
unsigned min;
142
143
unsigned max;
144
145
public:
146
  static AMDGPUWavesPerEUAttr *CreateImplicit(ASTContext &Ctx, unsigned Min, unsigned 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
              , unsigned Min
154
              , unsigned Max
155
              , unsigned SI
156
             )
157
    : InheritableAttr(attr::AMDGPUWavesPerEU, R, SI, false, false)
158
              , min(Min)
159
              , max(Max)
160
107
  {
161
107
  }
162
163
  AMDGPUWavesPerEUAttr(SourceRange R, ASTContext &Ctx
164
              , unsigned 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
57
  unsigned getMin() const {
178
57
    return min;
179
57
  }
180
181
57
  unsigned getMax() const {
182
57
    return max;
183
57
  }
184
185
186
187
6.48M
  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
4.63M
  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
1.84M
  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
536
  {
395
536
    std::copy(Args, Args + args_Size, args_);
396
536
  }
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.77k
  bool isShared() const { return SpellingListIndex == 2 ||
422
1.77k
    
SpellingListIndex == 31.66k
||
423
1.77k
    
SpellingListIndex == 51.66k
; }
424
  typedef Expr ** args_iterator;
425
2.35k
  args_iterator args_begin() const { return args_; }
426
2.35k
  args_iterator args_end() const { return args_ + args_Size; }
427
1.90k
  unsigned args_size() const { return args_Size; }
428
2.34k
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
429
430
431
432
433
294k
  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
294k
  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
294k
  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
221
  {
543
221
  }
544
545
  AddressSpaceAttr *clone(ASTContext &C) const;
546
  void printPretty(raw_ostream &OS,
547
                   const PrintingPolicy &Policy) const;
548
  const char *getSpelling() const;
549
13
  int getAddressSpace() const {
550
13
    return addressSpace;
551
13
  }
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
142
  {
576
142
      if (!Aliasee.empty())
577
142
        std::memcpy(aliasee, Aliasee.data(), aliaseeLength);
578
142
  }
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
24.9M
  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
20.3k
  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
312
  {
643
312
  }
644
645
  AlignValueAttr *clone(ASTContext &C) const;
646
  void printPretty(raw_ostream &OS,
647
                   const PrintingPolicy &Policy) const;
648
  const char *getSpelling() const;
649
20
  Expr * getAlignment() const {
650
20
    return alignment;
651
20
  }
652
653
654
655
2.18M
  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
8
  static AlignedAttr *CreateImplicit(ASTContext &Ctx, Spelling S, bool IsAlignmentExpr, void *Alignment, SourceRange Loc = SourceRange()) {
675
8
    auto *A = new (Ctx) AlignedAttr(Loc, Ctx, IsAlignmentExpr, Alignment, S);
676
8
    A->setImplicit(true);
677
8
    return A;
678
8
  }
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
56.4k
  {
687
56.4k
    if (isalignmentExpr)
688
56.4k
       alignmentExpr = reinterpret_cast<Expr *>(Alignment);
689
0
    else
690
0
       alignmentType = reinterpret_cast<TypeSourceInfo *>(Alignment);
691
56.4k
  }
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
61.9k
  bool isAlignas() const { return SpellingListIndex == 3 ||
719
61.9k
    
SpellingListIndex == 445.3k
; }
720
0
  bool isDeclspec() const { return SpellingListIndex == 2; }
721
  bool isAlignmentDependent() const;
722
  unsigned getAlignment(ASTContext &Ctx) const;
723
781
  bool isAlignmentExpr() const {
724
781
    return isalignmentExpr;
725
781
  }
726
533
  Expr *getAlignmentExpr() const {
727
533
    assert(isalignmentExpr);
728
533
    return alignmentExpr;
729
533
  }
730
0
  TypeSourceInfo *getAlignmentType() const {
731
0
    assert(!isalignmentExpr);
732
0
    return alignmentType;
733
0
  }
734
735
736
737
4.23M
  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
48
  {
757
48
  }
758
759
  AllocAlignAttr *clone(ASTContext &C) const;
760
  void printPretty(raw_ostream &OS,
761
                   const PrintingPolicy &Policy) const;
762
  const char *getSpelling() const;
763
20
  ParamIdx getParamIndex() const {
764
20
    return paramIndex;
765
20
  }
766
767
768
769
2.53M
  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.31k
  ParamIdx getElemSizeParam() const {
810
3.31k
    return elemSizeParam;
811
3.31k
  }
812
813
4.14k
  ParamIdx getNumElemsParam() const {
814
4.14k
    return numElemsParam;
815
4.14k
  }
816
817
818
819
535k
  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.1k
  static AlwaysInlineAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
855
84.1k
    auto *A = new (Ctx) AlwaysInlineAttr(Loc, Ctx, S);
856
84.1k
    A->setImplicit(true);
857
84.1k
    return A;
858
84.1k
  }
859
860
  AlwaysInlineAttr(SourceRange R, ASTContext &Ctx
861
              , unsigned SI
862
             )
863
    : InheritableAttr(attr::AlwaysInline, R, SI, false, false)
864
982k
  {
865
982k
  }
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
868k
  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
6
  {
897
6
  }
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
189k
  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
331
  {
926
331
      if (!Annotation.empty())
927
331
        std::memcpy(annotation, Annotation.data(), annotationLength);
928
331
  }
929
930
  AnnotateAttr *clone(ASTContext &C) const;
931
  void printPretty(raw_ostream &OS,
932
                   const PrintingPolicy &Policy) const;
933
  const char *getSpelling() const;
934
705
  llvm::StringRef getAnnotation() const {
935
705
    return llvm::StringRef(annotation, annotationLength);
936
705
  }
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
497k
  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.06M
  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
25
  {
989
25
  }
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
527k
  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
527k
  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
3.69M
  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
34.3k
  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.9k
  {
1186
90.9k
      if (!Label.empty())
1187
90.9k
        std::memcpy(label, Label.data(), labelLength);
1188
90.9k
  }
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.57k
  llvm::StringRef getLabel() const {
1195
5.57k
    return llvm::StringRef(label, labelLength);
1196
5.57k
  }
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
4.98M
  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
46
  {
1386
46
  }
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
12
  Expr * getAlignment() const {
1403
12
    return alignment;
1404
12
  }
1405
1406
13
  Expr * getOffset() const {
1407
13
    return offset;
1408
13
  }
1409
1410
1411
1412
2.53M
  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
public:
1438
  static AvailabilityAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * Platform, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool Unavailable, llvm::StringRef Message, bool Strict, llvm::StringRef Replacement, SourceRange Loc = SourceRange()) {
1439
    auto *A = new (Ctx) AvailabilityAttr(Loc, Ctx, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, 0);
1440
    A->setImplicit(true);
1441
    return A;
1442
  }
1443
1444
  AvailabilityAttr(SourceRange R, ASTContext &Ctx
1445
              , IdentifierInfo * Platform
1446
              , VersionTuple Introduced
1447
              , VersionTuple Deprecated
1448
              , VersionTuple Obsoleted
1449
              , bool Unavailable
1450
              , llvm::StringRef Message
1451
              , bool Strict
1452
              , llvm::StringRef Replacement
1453
              , unsigned SI
1454
             )
1455
    : InheritableAttr(attr::Availability, R, SI, false, true)
1456
              , platform(Platform)
1457
              , introduced(Introduced)
1458
              , deprecated(Deprecated)
1459
              , obsoleted(Obsoleted)
1460
              , unavailable(Unavailable)
1461
              , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
1462
              , strict(Strict)
1463
              , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength])
1464
715k
  {
1465
715k
      if (!Message.empty())
1466
74.5k
        std::memcpy(message, Message.data(), messageLength);
1467
715k
      if (!Replacement.empty())
1468
4.38k
        std::memcpy(replacement, Replacement.data(), replacementLength);
1469
715k
  }
1470
1471
  AvailabilityAttr *clone(ASTContext &C) const;
1472
  void printPretty(raw_ostream &OS,
1473
                   const PrintingPolicy &Policy) const;
1474
  const char *getSpelling() const;
1475
1.09M
  IdentifierInfo * getPlatform() const {
1476
1.09M
    return platform;
1477
1.09M
  }
1478
1479
191k
  VersionTuple getIntroduced() const {
1480
191k
    return introduced;
1481
191k
  }
1482
  void setIntroduced(ASTContext &C, VersionTuple V) {
1483
    introduced = V;
1484
  }
1485
1486
127k
  VersionTuple getDeprecated() const {
1487
127k
    return deprecated;
1488
127k
  }
1489
  void setDeprecated(ASTContext &C, VersionTuple V) {
1490
    deprecated = V;
1491
  }
1492
1493
120k
  VersionTuple getObsoleted() const {
1494
120k
    return obsoleted;
1495
120k
  }
1496
  void setObsoleted(ASTContext &C, VersionTuple V) {
1497
    obsoleted = V;
1498
  }
1499
1500
100k
  bool getUnavailable() const {
1501
100k
    return unavailable;
1502
100k
  }
1503
1504
109k
  llvm::StringRef getMessage() const {
1505
109k
    return llvm::StringRef(message, messageLength);
1506
109k
  }
1507
  unsigned getMessageLength() const {
1508
    return messageLength;
1509
  }
1510
  void setMessage(ASTContext &C, llvm::StringRef S) {
1511
    messageLength = S.size();
1512
    this->message = new (C, 1) char [messageLength];
1513
    if (!S.empty())
1514
      std::memcpy(this->message, S.data(), messageLength);
1515
  }
1516
1517
10.5k
  bool getStrict() const {
1518
10.5k
    return strict;
1519
10.5k
  }
1520
1521
31.4k
  llvm::StringRef getReplacement() const {
1522
31.4k
    return llvm::StringRef(replacement, replacementLength);
1523
31.4k
  }
1524
  unsigned getReplacementLength() const {
1525
    return replacementLength;
1526
  }
1527
  void setReplacement(ASTContext &C, llvm::StringRef S) {
1528
    replacementLength = S.size();
1529
    this->replacement = new (C, 1) char [replacementLength];
1530
    if (!S.empty())
1531
      std::memcpy(this->replacement, S.data(), replacementLength);
1532
  }
1533
1534
1.47M
static llvm::StringRef getPrettyPlatformName(llvm::StringRef Platform) {
1535
1.47M
    return llvm::StringSwitch<llvm::StringRef>(Platform)
1536
1.47M
             .Case("android", "Android")
1537
1.47M
             .Case("ios", "iOS")
1538
1.47M
             .Case("macos", "macOS")
1539
1.47M
             .Case("tvos", "tvOS")
1540
1.47M
             .Case("watchos", "watchOS")
1541
1.47M
             .Case("ios_app_extension", "iOS (App Extension)")
1542
1.47M
             .Case("macos_app_extension", "macOS (App Extension)")
1543
1.47M
             .Case("tvos_app_extension", "tvOS (App Extension)")
1544
1.47M
             .Case("watchos_app_extension", "watchOS (App Extension)")
1545
1.47M
             .Case("swift", "Swift")
1546
1.47M
             .Default(llvm::StringRef());
1547
1.47M
}
1548
359
static llvm::StringRef getPlatformNameSourceSpelling(llvm::StringRef Platform) {
1549
359
    return llvm::StringSwitch<llvm::StringRef>(Platform)
1550
359
             .Case("ios", "iOS")
1551
359
             .Case("macos", "macOS")
1552
359
             .Case("tvos", "tvOS")
1553
359
             .Case("watchos", "watchOS")
1554
359
             .Case("ios_app_extension", "iOSApplicationExtension")
1555
359
             .Case("macos_app_extension", "macOSApplicationExtension")
1556
359
             .Case("tvos_app_extension", "tvOSApplicationExtension")
1557
359
             .Case("watchos_app_extension", "watchOSApplicationExtension")
1558
359
             .Default(Platform);
1559
359
}
1560
632k
static llvm::StringRef canonicalizePlatformName(llvm::StringRef Platform) {
1561
632k
    return llvm::StringSwitch<llvm::StringRef>(Platform)
1562
632k
             .Case("iOS", "ios")
1563
632k
             .Case("macOS", "macos")
1564
632k
             .Case("tvOS", "tvos")
1565
632k
             .Case("watchOS", "watchos")
1566
632k
             .Case("iOSApplicationExtension", "ios_app_extension")
1567
632k
             .Case("macOSApplicationExtension", "macos_app_extension")
1568
632k
             .Case("tvOSApplicationExtension", "tvos_app_extension")
1569
632k
             .Case("watchOSApplicationExtension", "watchos_app_extension")
1570
632k
             .Default(Platform);
1571
632k
} 
1572
1573
14.1M
  static bool classof(const Attr *A) { return A->getKind() == attr::Availability; }
1574
};
1575
1576
class BlocksAttr : public InheritableAttr {
1577
public:
1578
  enum BlockType {
1579
    ByRef
1580
  };
1581
private:
1582
  BlockType type;
1583
1584
public:
1585
  static BlocksAttr *CreateImplicit(ASTContext &Ctx, BlockType Type, SourceRange Loc = SourceRange()) {
1586
    auto *A = new (Ctx) BlocksAttr(Loc, Ctx, Type, 0);
1587
    A->setImplicit(true);
1588
    return A;
1589
  }
1590
1591
  BlocksAttr(SourceRange R, ASTContext &Ctx
1592
              , BlockType Type
1593
              , unsigned SI
1594
             )
1595
    : InheritableAttr(attr::Blocks, R, SI, false, false)
1596
              , type(Type)
1597
535
  {
1598
535
  }
1599
1600
  BlocksAttr *clone(ASTContext &C) const;
1601
  void printPretty(raw_ostream &OS,
1602
                   const PrintingPolicy &Policy) const;
1603
  const char *getSpelling() const;
1604
7
  BlockType getType() const {
1605
7
    return type;
1606
7
  }
1607
1608
527
  static bool ConvertStrToBlockType(StringRef Val, BlockType &Out) {
1609
527
    Optional<BlockType> R = llvm::StringSwitch<Optional<BlockType>>(Val)
1610
527
      .Case("byref", BlocksAttr::ByRef)
1611
527
      .Default(Optional<BlockType>());
1612
527
    if (R) {
1613
527
      Out = *R;
1614
527
      return true;
1615
527
    }
1616
0
    return false;
1617
0
  }
1618
1619
2
  static const char *ConvertBlockTypeToStr(BlockType Val) {
1620
2
    switch(Val) {
1621
2
    case BlocksAttr::ByRef: return "byref";
1622
0
    }
1623
0
    llvm_unreachable("No enumerator with that value");
1624
0
  }
1625
1626
1627
376k
  static bool classof(const Attr *A) { return A->getKind() == attr::Blocks; }
1628
};
1629
1630
class C11NoReturnAttr : public InheritableAttr {
1631
public:
1632
  static C11NoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1633
    auto *A = new (Ctx) C11NoReturnAttr(Loc, Ctx, 0);
1634
    A->setImplicit(true);
1635
    return A;
1636
  }
1637
1638
  C11NoReturnAttr(SourceRange R, ASTContext &Ctx
1639
              , unsigned SI
1640
             )
1641
    : InheritableAttr(attr::C11NoReturn, R, SI, false, false)
1642
37
  {
1643
37
  }
1644
1645
  C11NoReturnAttr *clone(ASTContext &C) const;
1646
  void printPretty(raw_ostream &OS,
1647
                   const PrintingPolicy &Policy) const;
1648
  const char *getSpelling() const;
1649
1650
1651
5.18M
  static bool classof(const Attr *A) { return A->getKind() == attr::C11NoReturn; }
1652
};
1653
1654
class CDeclAttr : public InheritableAttr {
1655
public:
1656
  static CDeclAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1657
    auto *A = new (Ctx) CDeclAttr(Loc, Ctx, 0);
1658
    A->setImplicit(true);
1659
    return A;
1660
  }
1661
1662
  CDeclAttr(SourceRange R, ASTContext &Ctx
1663
              , unsigned SI
1664
             )
1665
    : InheritableAttr(attr::CDecl, R, SI, false, false)
1666
385
  {
1667
385
  }
1668
1669
  CDeclAttr *clone(ASTContext &C) const;
1670
  void printPretty(raw_ostream &OS,
1671
                   const PrintingPolicy &Policy) const;
1672
  const char *getSpelling() const;
1673
1674
1675
  static bool classof(const Attr *A) { return A->getKind() == attr::CDecl; }
1676
};
1677
1678
class CFAuditedTransferAttr : public InheritableAttr {
1679
public:
1680
13.1k
  static CFAuditedTransferAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1681
13.1k
    auto *A = new (Ctx) CFAuditedTransferAttr(Loc, Ctx, 0);
1682
13.1k
    A->setImplicit(true);
1683
13.1k
    return A;
1684
13.1k
  }
1685
1686
  CFAuditedTransferAttr(SourceRange R, ASTContext &Ctx
1687
              , unsigned SI
1688
             )
1689
    : InheritableAttr(attr::CFAuditedTransfer, R, SI, false, false)
1690
13.1k
  {
1691
13.1k
  }
1692
1693
  CFAuditedTransferAttr *clone(ASTContext &C) const;
1694
  void printPretty(raw_ostream &OS,
1695
                   const PrintingPolicy &Policy) const;
1696
  const char *getSpelling() const;
1697
1698
1699
9.31k
  static bool classof(const Attr *A) { return A->getKind() == attr::CFAuditedTransfer; }
1700
};
1701
1702
class CFConsumedAttr : public InheritableParamAttr {
1703
public:
1704
  static CFConsumedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1705
    auto *A = new (Ctx) CFConsumedAttr(Loc, Ctx, 0);
1706
    A->setImplicit(true);
1707
    return A;
1708
  }
1709
1710
  CFConsumedAttr(SourceRange R, ASTContext &Ctx
1711
              , unsigned SI
1712
             )
1713
    : InheritableParamAttr(attr::CFConsumed, R, SI, false, false)
1714
416
  {
1715
416
  }
1716
1717
  CFConsumedAttr *clone(ASTContext &C) const;
1718
  void printPretty(raw_ostream &OS,
1719
                   const PrintingPolicy &Policy) const;
1720
  const char *getSpelling() const;
1721
1722
1723
2.18M
  static bool classof(const Attr *A) { return A->getKind() == attr::CFConsumed; }
1724
};
1725
1726
class CFReturnsNotRetainedAttr : public InheritableAttr {
1727
public:
1728
  static CFReturnsNotRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1729
    auto *A = new (Ctx) CFReturnsNotRetainedAttr(Loc, Ctx, 0);
1730
    A->setImplicit(true);
1731
    return A;
1732
  }
1733
1734
  CFReturnsNotRetainedAttr(SourceRange R, ASTContext &Ctx
1735
              , unsigned SI
1736
             )
1737
    : InheritableAttr(attr::CFReturnsNotRetained, R, SI, false, false)
1738
77
  {
1739
77
  }
1740
1741
  CFReturnsNotRetainedAttr *clone(ASTContext &C) const;
1742
  void printPretty(raw_ostream &OS,
1743
                   const PrintingPolicy &Policy) const;
1744
  const char *getSpelling() const;
1745
1746
1747
141
  static bool classof(const Attr *A) { return A->getKind() == attr::CFReturnsNotRetained; }
1748
};
1749
1750
class CFReturnsRetainedAttr : public InheritableAttr {
1751
public:
1752
  static CFReturnsRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1753
    auto *A = new (Ctx) CFReturnsRetainedAttr(Loc, Ctx, 0);
1754
    A->setImplicit(true);
1755
    return A;
1756
  }
1757
1758
  CFReturnsRetainedAttr(SourceRange R, ASTContext &Ctx
1759
              , unsigned SI
1760
             )
1761
    : InheritableAttr(attr::CFReturnsRetained, R, SI, false, false)
1762
503
  {
1763
503
  }
1764
1765
  CFReturnsRetainedAttr *clone(ASTContext &C) const;
1766
  void printPretty(raw_ostream &OS,
1767
                   const PrintingPolicy &Policy) const;
1768
  const char *getSpelling() const;
1769
1770
1771
186
  static bool classof(const Attr *A) { return A->getKind() == attr::CFReturnsRetained; }
1772
};
1773
1774
class CFUnknownTransferAttr : public InheritableAttr {
1775
public:
1776
  static CFUnknownTransferAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1777
    auto *A = new (Ctx) CFUnknownTransferAttr(Loc, Ctx, 0);
1778
    A->setImplicit(true);
1779
    return A;
1780
  }
1781
1782
  CFUnknownTransferAttr(SourceRange R, ASTContext &Ctx
1783
              , unsigned SI
1784
             )
1785
    : InheritableAttr(attr::CFUnknownTransfer, R, SI, false, false)
1786
1
  {
1787
1
  }
1788
1789
  CFUnknownTransferAttr *clone(ASTContext &C) const;
1790
  void printPretty(raw_ostream &OS,
1791
                   const PrintingPolicy &Policy) const;
1792
  const char *getSpelling() const;
1793
1794
1795
8.98k
  static bool classof(const Attr *A) { return A->getKind() == attr::CFUnknownTransfer; }
1796
};
1797
1798
class CPUDispatchAttr : public InheritableAttr {
1799
  unsigned cpus_Size;
1800
  IdentifierInfo * *cpus_;
1801
1802
public:
1803
  static CPUDispatchAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Loc = SourceRange()) {
1804
    auto *A = new (Ctx) CPUDispatchAttr(Loc, Ctx, Cpus, CpusSize, 0);
1805
    A->setImplicit(true);
1806
    return A;
1807
  }
1808
1809
  CPUDispatchAttr(SourceRange R, ASTContext &Ctx
1810
              , IdentifierInfo * *Cpus, unsigned CpusSize
1811
              , unsigned SI
1812
             )
1813
    : InheritableAttr(attr::CPUDispatch, R, SI, false, false)
1814
              , cpus_Size(CpusSize), cpus_(new (Ctx, 16) IdentifierInfo *[cpus_Size])
1815
32
  {
1816
32
    std::copy(Cpus, Cpus + cpus_Size, cpus_);
1817
32
  }
1818
1819
  CPUDispatchAttr(SourceRange R, ASTContext &Ctx
1820
              , unsigned SI
1821
             )
1822
    : InheritableAttr(attr::CPUDispatch, R, SI, false, false)
1823
              , cpus_Size(0), cpus_(nullptr)
1824
  {
1825
  }
1826
1827
  CPUDispatchAttr *clone(ASTContext &C) const;
1828
  void printPretty(raw_ostream &OS,
1829
                   const PrintingPolicy &Policy) const;
1830
  const char *getSpelling() const;
1831
  typedef IdentifierInfo ** cpus_iterator;
1832
26
  cpus_iterator cpus_begin() const { return cpus_; }
1833
23
  cpus_iterator cpus_end() const { return cpus_ + cpus_Size; }
1834
6
  unsigned cpus_size() const { return cpus_Size; }
1835
20
  llvm::iterator_range<cpus_iterator> cpus() const { return llvm::make_range(cpus_begin(), cpus_end()); }
1836
1837
1838
1839
1840
16.0M
  static bool classof(const Attr *A) { return A->getKind() == attr::CPUDispatch; }
1841
};
1842
1843
class CPUSpecificAttr : public InheritableAttr {
1844
  unsigned cpus_Size;
1845
  IdentifierInfo * *cpus_;
1846
1847
public:
1848
  static CPUSpecificAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Loc = SourceRange()) {
1849
    auto *A = new (Ctx) CPUSpecificAttr(Loc, Ctx, Cpus, CpusSize, 0);
1850
    A->setImplicit(true);
1851
    return A;
1852
  }
1853
1854
  CPUSpecificAttr(SourceRange R, ASTContext &Ctx
1855
              , IdentifierInfo * *Cpus, unsigned CpusSize
1856
              , unsigned SI
1857
             )
1858
    : InheritableAttr(attr::CPUSpecific, R, SI, false, false)
1859
              , cpus_Size(CpusSize), cpus_(new (Ctx, 16) IdentifierInfo *[cpus_Size])
1860
67
  {
1861
67
    std::copy(Cpus, Cpus + cpus_Size, cpus_);
1862
67
  }
1863
1864
  CPUSpecificAttr(SourceRange R, ASTContext &Ctx
1865
              , unsigned SI
1866
             )
1867
    : InheritableAttr(attr::CPUSpecific, R, SI, false, false)
1868
              , cpus_Size(0), cpus_(nullptr)
1869
  {
1870
  }
1871
1872
  CPUSpecificAttr *clone(ASTContext &C) const;
1873
  void printPretty(raw_ostream &OS,
1874
                   const PrintingPolicy &Policy) const;
1875
  const char *getSpelling() const;
1876
  typedef IdentifierInfo ** cpus_iterator;
1877
156
  cpus_iterator cpus_begin() const { return cpus_; }
1878
63
  cpus_iterator cpus_end() const { return cpus_ + cpus_Size; }
1879
100
  unsigned cpus_size() const { return cpus_Size; }
1880
34
  llvm::iterator_range<cpus_iterator> cpus() const { return llvm::make_range(cpus_begin(), cpus_end()); }
1881
1882
1883
1884
64
    IdentifierInfo *getCPUName(unsigned Index) const {
1885
64
      return *(cpus_begin() + Index);
1886
64
    }
1887
  
1888
1889
11.7M
  static bool classof(const Attr *A) { return A->getKind() == attr::CPUSpecific; }
1890
};
1891
1892
class CUDAConstantAttr : public InheritableAttr {
1893
public:
1894
  static CUDAConstantAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1895
    auto *A = new (Ctx) CUDAConstantAttr(Loc, Ctx, 0);
1896
    A->setImplicit(true);
1897
    return A;
1898
  }
1899
1900
  CUDAConstantAttr(SourceRange R, ASTContext &Ctx
1901
              , unsigned SI
1902
             )
1903
    : InheritableAttr(attr::CUDAConstant, R, SI, false, false)
1904
125
  {
1905
125
  }
1906
1907
  CUDAConstantAttr *clone(ASTContext &C) const;
1908
  void printPretty(raw_ostream &OS,
1909
                   const PrintingPolicy &Policy) const;
1910
  const char *getSpelling() const;
1911
1912
1913
15.4k
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDAConstant; }
1914
};
1915
1916
class CUDADeviceAttr : public InheritableAttr {
1917
public:
1918
3.26k
  static CUDADeviceAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1919
3.26k
    auto *A = new (Ctx) CUDADeviceAttr(Loc, Ctx, 0);
1920
3.26k
    A->setImplicit(true);
1921
3.26k
    return A;
1922
3.26k
  }
1923
1924
  CUDADeviceAttr(SourceRange R, ASTContext &Ctx
1925
              , unsigned SI
1926
             )
1927
    : InheritableAttr(attr::CUDADevice, R, SI, false, false)
1928
4.74k
  {
1929
4.74k
  }
1930
1931
  CUDADeviceAttr *clone(ASTContext &C) const;
1932
  void printPretty(raw_ostream &OS,
1933
                   const PrintingPolicy &Policy) const;
1934
  const char *getSpelling() const;
1935
1936
1937
54.3k
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDADevice; }
1938
};
1939
1940
class CUDAGlobalAttr : public InheritableAttr {
1941
public:
1942
  static CUDAGlobalAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1943
    auto *A = new (Ctx) CUDAGlobalAttr(Loc, Ctx, 0);
1944
    A->setImplicit(true);
1945
    return A;
1946
  }
1947
1948
  CUDAGlobalAttr(SourceRange R, ASTContext &Ctx
1949
              , unsigned SI
1950
             )
1951
    : InheritableAttr(attr::CUDAGlobal, R, SI, false, false)
1952
159
  {
1953
159
  }
1954
1955
  CUDAGlobalAttr *clone(ASTContext &C) const;
1956
  void printPretty(raw_ostream &OS,
1957
                   const PrintingPolicy &Policy) const;
1958
  const char *getSpelling() const;
1959
1960
1961
7.03M
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDAGlobal; }
1962
};
1963
1964
class CUDAHostAttr : public InheritableAttr {
1965
public:
1966
2.27k
  static CUDAHostAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1967
2.27k
    auto *A = new (Ctx) CUDAHostAttr(Loc, Ctx, 0);
1968
2.27k
    A->setImplicit(true);
1969
2.27k
    return A;
1970
2.27k
  }
1971
1972
  CUDAHostAttr(SourceRange R, ASTContext &Ctx
1973
              , unsigned SI
1974
             )
1975
    : InheritableAttr(attr::CUDAHost, R, SI, false, false)
1976
2.98k
  {
1977
2.98k
  }
1978
1979
  CUDAHostAttr *clone(ASTContext &C) const;
1980
  void printPretty(raw_ostream &OS,
1981
                   const PrintingPolicy &Policy) const;
1982
  const char *getSpelling() const;
1983
1984
1985
42.2k
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDAHost; }
1986
};
1987
1988
class CUDAInvalidTargetAttr : public InheritableAttr {
1989
public:
1990
15
  static CUDAInvalidTargetAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1991
15
    auto *A = new (Ctx) CUDAInvalidTargetAttr(Loc, Ctx, 0);
1992
15
    A->setImplicit(true);
1993
15
    return A;
1994
15
  }
1995
1996
  CUDAInvalidTargetAttr(SourceRange R, ASTContext &Ctx
1997
              , unsigned SI
1998
             )
1999
    : InheritableAttr(attr::CUDAInvalidTarget, R, SI, false, false)
2000
15
  {
2001
15
  }
2002
2003
  CUDAInvalidTargetAttr *clone(ASTContext &C) const;
2004
  void printPretty(raw_ostream &OS,
2005
                   const PrintingPolicy &Policy) const;
2006
  const char *getSpelling() const;
2007
2008
2009
56.1k
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDAInvalidTarget; }
2010
};
2011
2012
class CUDALaunchBoundsAttr : public InheritableAttr {
2013
Expr * maxThreads;
2014
2015
Expr * minBlocks;
2016
2017
public:
2018
  static CUDALaunchBoundsAttr *CreateImplicit(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, SourceRange Loc = SourceRange()) {
2019
    auto *A = new (Ctx) CUDALaunchBoundsAttr(Loc, Ctx, MaxThreads, MinBlocks, 0);
2020
    A->setImplicit(true);
2021
    return A;
2022
  }
2023
2024
  CUDALaunchBoundsAttr(SourceRange R, ASTContext &Ctx
2025
              , Expr * MaxThreads
2026
              , Expr * MinBlocks
2027
              , unsigned SI
2028
             )
2029
    : InheritableAttr(attr::CUDALaunchBounds, R, SI, false, false)
2030
              , maxThreads(MaxThreads)
2031
              , minBlocks(MinBlocks)
2032
60
  {
2033
60
  }
2034
2035
  CUDALaunchBoundsAttr(SourceRange R, ASTContext &Ctx
2036
              , Expr * MaxThreads
2037
              , unsigned SI
2038
             )
2039
    : InheritableAttr(attr::CUDALaunchBounds, R, SI, false, false)
2040
              , maxThreads(MaxThreads)
2041
              , minBlocks()
2042
  {
2043
  }
2044
2045
  CUDALaunchBoundsAttr *clone(ASTContext &C) const;
2046
  void printPretty(raw_ostream &OS,
2047
                   const PrintingPolicy &Policy) const;
2048
  const char *getSpelling() const;
2049
14
  Expr * getMaxThreads() const {
2050
14
    return maxThreads;
2051
14
  }
2052
2053
24
  Expr * getMinBlocks() const {
2054
24
    return minBlocks;
2055
24
  }
2056
2057
2058
2059
2.18M
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDALaunchBounds; }
2060
};
2061
2062
class CUDASharedAttr : public InheritableAttr {
2063
public:
2064
  static CUDASharedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2065
    auto *A = new (Ctx) CUDASharedAttr(Loc, Ctx, 0);
2066
    A->setImplicit(true);
2067
    return A;
2068
  }
2069
2070
  CUDASharedAttr(SourceRange R, ASTContext &Ctx
2071
              , unsigned SI
2072
             )
2073
    : InheritableAttr(attr::CUDAShared, R, SI, false, false)
2074
196
  {
2075
196
  }
2076
2077
  CUDASharedAttr *clone(ASTContext &C) const;
2078
  void printPretty(raw_ostream &OS,
2079
                   const PrintingPolicy &Policy) const;
2080
  const char *getSpelling() const;
2081
2082
2083
15.8k
  static bool classof(const Attr *A) { return A->getKind() == attr::CUDAShared; }
2084
};
2085
2086
class CXX11NoReturnAttr : public InheritableAttr {
2087
public:
2088
  static CXX11NoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2089
    auto *A = new (Ctx) CXX11NoReturnAttr(Loc, Ctx, 0);
2090
    A->setImplicit(true);
2091
    return A;
2092
  }
2093
2094
  CXX11NoReturnAttr(SourceRange R, ASTContext &Ctx
2095
              , unsigned SI
2096
             )
2097
    : InheritableAttr(attr::CXX11NoReturn, R, SI, false, false)
2098
11.0k
  {
2099
11.0k
  }
2100
2101
  CXX11NoReturnAttr *clone(ASTContext &C) const;
2102
  void printPretty(raw_ostream &OS,
2103
                   const PrintingPolicy &Policy) const;
2104
  const char *getSpelling() const;
2105
2106
2107
5.25M
  static bool classof(const Attr *A) { return A->getKind() == attr::CXX11NoReturn; }
2108
};
2109
2110
class CallableWhenAttr : public InheritableAttr {
2111
public:
2112
  enum ConsumedState {
2113
    Unknown,
2114
    Consumed,
2115
    Unconsumed
2116
  };
2117
private:
2118
  unsigned callableStates_Size;
2119
  ConsumedState *callableStates_;
2120
2121
public:
2122
  static CallableWhenAttr *CreateImplicit(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, SourceRange Loc = SourceRange()) {
2123
    auto *A = new (Ctx) CallableWhenAttr(Loc, Ctx, CallableStates, CallableStatesSize, 0);
2124
    A->setImplicit(true);
2125
    return A;
2126
  }
2127
2128
  CallableWhenAttr(SourceRange R, ASTContext &Ctx
2129
              , ConsumedState *CallableStates, unsigned CallableStatesSize
2130
              , unsigned SI
2131
             )
2132
    : InheritableAttr(attr::CallableWhen, R, SI, false, false)
2133
              , callableStates_Size(CallableStatesSize), callableStates_(new (Ctx, 16) ConsumedState[callableStates_Size])
2134
18
  {
2135
18
    std::copy(CallableStates, CallableStates + callableStates_Size, callableStates_);
2136
18
  }
2137
2138
  CallableWhenAttr(SourceRange R, ASTContext &Ctx
2139
              , unsigned SI
2140
             )
2141
    : InheritableAttr(attr::CallableWhen, R, SI, false, false)
2142
              , callableStates_Size(0), callableStates_(nullptr)
2143
  {
2144
  }
2145
2146
  CallableWhenAttr *clone(ASTContext &C) const;
2147
  void printPretty(raw_ostream &OS,
2148
                   const PrintingPolicy &Policy) const;
2149
  const char *getSpelling() const;
2150
  typedef ConsumedState* callableStates_iterator;
2151
204
  callableStates_iterator callableStates_begin() const { return callableStates_; }
2152
204
  callableStates_iterator callableStates_end() const { return callableStates_ + callableStates_Size; }
2153
0
  unsigned callableStates_size() const { return callableStates_Size; }
2154
204
  llvm::iterator_range<callableStates_iterator> callableStates() const { return llvm::make_range(callableStates_begin(), callableStates_end()); }
2155
2156
2157
19
  static bool ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) {
2158
19
    Optional<ConsumedState> R = llvm::StringSwitch<Optional<ConsumedState>>(Val)
2159
19
      .Case("unknown", CallableWhenAttr::Unknown)
2160
19
      .Case("consumed", CallableWhenAttr::Consumed)
2161
19
      .Case("unconsumed", CallableWhenAttr::Unconsumed)
2162
19
      .Default(Optional<ConsumedState>());
2163
19
    if (R) {
2164
18
      Out = *R;
2165
18
      return true;
2166
18
    }
2167
1
    return false;
2168
1
  }
2169
2170
2
  static const char *ConvertConsumedStateToStr(ConsumedState Val) {
2171
2
    switch(Val) {
2172
2
    
case CallableWhenAttr::Unknown: return "unknown"0
;
2173
2
    
case CallableWhenAttr::Consumed: return "consumed"1
;
2174
2
    
case CallableWhenAttr::Unconsumed: return "unconsumed"1
;
2175
0
    }
2176
0
    llvm_unreachable("No enumerator with that value");
2177
0
  }
2178
2179
2180
474
  static bool classof(const Attr *A) { return A->getKind() == attr::CallableWhen; }
2181
};
2182
2183
class CapabilityAttr : public InheritableAttr {
2184
unsigned nameLength;
2185
char *name;
2186
2187
public:
2188
  enum Spelling {
2189
    GNU_capability = 0,
2190
    CXX11_clang_capability = 1,
2191
    GNU_shared_capability = 2,
2192
    CXX11_clang_shared_capability = 3
2193
  };
2194
2195
  static CapabilityAttr *CreateImplicit(ASTContext &Ctx, Spelling S, llvm::StringRef Name, SourceRange Loc = SourceRange()) {
2196
    auto *A = new (Ctx) CapabilityAttr(Loc, Ctx, Name, S);
2197
    A->setImplicit(true);
2198
    return A;
2199
  }
2200
2201
  CapabilityAttr(SourceRange R, ASTContext &Ctx
2202
              , llvm::StringRef Name
2203
              , unsigned SI
2204
             )
2205
    : InheritableAttr(attr::Capability, R, SI, false, false)
2206
              , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
2207
75
  {
2208
75
      if (!Name.empty())
2209
75
        std::memcpy(name, Name.data(), nameLength);
2210
75
  }
2211
2212
  CapabilityAttr *clone(ASTContext &C) const;
2213
  void printPretty(raw_ostream &OS,
2214
                   const PrintingPolicy &Policy) const;
2215
  const char *getSpelling() const;
2216
  Spelling getSemanticSpelling() const {
2217
  switch (SpellingListIndex) {
2218
    default: llvm_unreachable("Unknown spelling list index");
2219
    case 0: return GNU_capability;
2220
    case 1: return CXX11_clang_capability;
2221
    case 2: return GNU_shared_capability;
2222
    case 3: return CXX11_clang_shared_capability;
2223
  }
2224
  }
2225
  bool isShared() const { return SpellingListIndex == 2 ||
2226
    SpellingListIndex == 3; }
2227
3.83k
  llvm::StringRef getName() const {
2228
3.83k
    return llvm::StringRef(name, nameLength);
2229
3.83k
  }
2230
  unsigned getNameLength() const {
2231
    return nameLength;
2232
  }
2233
  void setName(ASTContext &C, llvm::StringRef S) {
2234
    nameLength = S.size();
2235
    this->name = new (C, 1) char [nameLength];
2236
    if (!S.empty())
2237
      std::memcpy(this->name, S.data(), nameLength);
2238
  }
2239
2240
2241
    bool isMutex() const { return getName().equals_lower("mutex"); }
2242
    bool isRole() const { return getName().equals_lower("role"); }
2243
  
2244
2245
10.4k
  static bool classof(const Attr *A) { return A->getKind() == attr::Capability; }
2246
};
2247
2248
class CapturedRecordAttr : public InheritableAttr {
2249
public:
2250
292k
  static CapturedRecordAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2251
292k
    auto *A = new (Ctx) CapturedRecordAttr(Loc, Ctx, 0);
2252
292k
    A->setImplicit(true);
2253
292k
    return A;
2254
292k
  }
2255
2256
  CapturedRecordAttr(SourceRange R, ASTContext &Ctx
2257
              , unsigned SI
2258
             )
2259
    : InheritableAttr(attr::CapturedRecord, R, SI, false, false)
2260
311k
  {
2261
311k
  }
2262
2263
  CapturedRecordAttr *clone(ASTContext &C) const;
2264
  void printPretty(raw_ostream &OS,
2265
                   const PrintingPolicy &Policy) const;
2266
  const char *getSpelling() const;
2267
2268
2269
0
  static bool classof(const Attr *A) { return A->getKind() == attr::CapturedRecord; }
2270
};
2271
2272
class CarriesDependencyAttr : public InheritableParamAttr {
2273
public:
2274
  static CarriesDependencyAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2275
    auto *A = new (Ctx) CarriesDependencyAttr(Loc, Ctx, 0);
2276
    A->setImplicit(true);
2277
    return A;
2278
  }
2279
2280
  CarriesDependencyAttr(SourceRange R, ASTContext &Ctx
2281
              , unsigned SI
2282
             )
2283
    : InheritableParamAttr(attr::CarriesDependency, R, SI, false, false)
2284
25
  {
2285
25
  }
2286
2287
  CarriesDependencyAttr *clone(ASTContext &C) const;
2288
  void printPretty(raw_ostream &OS,
2289
                   const PrintingPolicy &Policy) const;
2290
  const char *getSpelling() const;
2291
2292
2293
76.2k
  static bool classof(const Attr *A) { return A->getKind() == attr::CarriesDependency; }
2294
};
2295
2296
class CleanupAttr : public InheritableAttr {
2297
FunctionDecl * functionDecl;
2298
2299
public:
2300
  static CleanupAttr *CreateImplicit(ASTContext &Ctx, FunctionDecl * FunctionDecl, SourceRange Loc = SourceRange()) {
2301
    auto *A = new (Ctx) CleanupAttr(Loc, Ctx, FunctionDecl, 0);
2302
    A->setImplicit(true);
2303
    return A;
2304
  }
2305
2306
  CleanupAttr(SourceRange R, ASTContext &Ctx
2307
              , FunctionDecl * FunctionDecl
2308
              , unsigned SI
2309
             )
2310
    : InheritableAttr(attr::Cleanup, R, SI, false, false)
2311
              , functionDecl(FunctionDecl)
2312
27
  {
2313
27
  }
2314
2315
  CleanupAttr *clone(ASTContext &C) const;
2316
  void printPretty(raw_ostream &OS,
2317
                   const PrintingPolicy &Policy) const;
2318
  const char *getSpelling() const;
2319
8
  FunctionDecl * getFunctionDecl() const {
2320
8
    return functionDecl;
2321
8
  }
2322
2323
2324
2325
104k
  static bool classof(const Attr *A) { return A->getKind() == attr::Cleanup; }
2326
};
2327
2328
class CodeSegAttr : public InheritableAttr {
2329
unsigned nameLength;
2330
char *name;
2331
2332
public:
2333
  static CodeSegAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Loc = SourceRange()) {
2334
    auto *A = new (Ctx) CodeSegAttr(Loc, Ctx, Name, 0);
2335
    A->setImplicit(true);
2336
    return A;
2337
  }
2338
2339
  CodeSegAttr(SourceRange R, ASTContext &Ctx
2340
              , llvm::StringRef Name
2341
              , unsigned SI
2342
             )
2343
    : InheritableAttr(attr::CodeSeg, R, SI, false, false)
2344
              , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
2345
195
  {
2346
195
      if (!Name.empty())
2347
195
        std::memcpy(name, Name.data(), nameLength);
2348
195
  }
2349
2350
  CodeSegAttr *clone(ASTContext &C) const;
2351
  void printPretty(raw_ostream &OS,
2352
                   const PrintingPolicy &Policy) const;
2353
  const char *getSpelling() const;
2354
271
  llvm::StringRef getName() const {
2355
271
    return llvm::StringRef(name, nameLength);
2356
271
  }
2357
  unsigned getNameLength() const {
2358
    return nameLength;
2359
  }
2360
  void setName(ASTContext &C, llvm::StringRef S) {
2361
    nameLength = S.size();
2362
    this->name = new (C, 1) char [nameLength];
2363
    if (!S.empty())
2364
      std::memcpy(this->name, S.data(), nameLength);
2365
  }
2366
2367
2368
2369
1.86M
  static bool classof(const Attr *A) { return A->getKind() == attr::CodeSeg; }
2370
};
2371
2372
class ColdAttr : public InheritableAttr {
2373
public:
2374
  static ColdAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2375
    auto *A = new (Ctx) ColdAttr(Loc, Ctx, 0);
2376
    A->setImplicit(true);
2377
    return A;
2378
  }
2379
2380
  ColdAttr(SourceRange R, ASTContext &Ctx
2381
              , unsigned SI
2382
             )
2383
    : InheritableAttr(attr::Cold, R, SI, false, false)
2384
34
  {
2385
34
  }
2386
2387
  ColdAttr *clone(ASTContext &C) const;
2388
  void printPretty(raw_ostream &OS,
2389
                   const PrintingPolicy &Policy) const;
2390
  const char *getSpelling() const;
2391
2392
2393
673k
  static bool classof(const Attr *A) { return A->getKind() == attr::Cold; }
2394
};
2395
2396
class CommonAttr : public InheritableAttr {
2397
public:
2398
  static CommonAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2399
    auto *A = new (Ctx) CommonAttr(Loc, Ctx, 0);
2400
    A->setImplicit(true);
2401
    return A;
2402
  }
2403
2404
  CommonAttr(SourceRange R, ASTContext &Ctx
2405
              , unsigned SI
2406
             )
2407
    : InheritableAttr(attr::Common, R, SI, false, false)
2408
7
  {
2409
7
  }
2410
2411
  CommonAttr *clone(ASTContext &C) const;
2412
  void printPretty(raw_ostream &OS,
2413
                   const PrintingPolicy &Policy) const;
2414
  const char *getSpelling() const;
2415
2416
2417
334k
  static bool classof(const Attr *A) { return A->getKind() == attr::Common; }
2418
};
2419
2420
class ConstAttr : public InheritableAttr {
2421
public:
2422
351k
  static ConstAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2423
351k
    auto *A = new (Ctx) ConstAttr(Loc, Ctx, 0);
2424
351k
    A->setImplicit(true);
2425
351k
    return A;
2426
351k
  }
2427
2428
  ConstAttr(SourceRange R, ASTContext &Ctx
2429
              , unsigned SI
2430
             )
2431
    : InheritableAttr(attr::Const, R, SI, false, false)
2432
636k
  {
2433
636k
  }
2434
2435
  ConstAttr *clone(ASTContext &C) const;
2436
  void printPretty(raw_ostream &OS,
2437
                   const PrintingPolicy &Policy) const;
2438
  const char *getSpelling() const;
2439
2440
2441
1.50M
  static bool classof(const Attr *A) { return A->getKind() == attr::Const; }
2442
};
2443
2444
class ConstructorAttr : public InheritableAttr {
2445
int priority;
2446
2447
public:
2448
  static ConstructorAttr *CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Loc = SourceRange()) {
2449
    auto *A = new (Ctx) ConstructorAttr(Loc, Ctx, Priority, 0);
2450
    A->setImplicit(true);
2451
    return A;
2452
  }
2453
2454
  ConstructorAttr(SourceRange R, ASTContext &Ctx
2455
              , int Priority
2456
              , unsigned SI
2457
             )
2458
    : InheritableAttr(attr::Constructor, R, SI, false, false)
2459
              , priority(Priority)
2460
54
  {
2461
54
  }
2462
2463
  ConstructorAttr(SourceRange R, ASTContext &Ctx
2464
              , unsigned SI
2465
             )
2466
    : InheritableAttr(attr::Constructor, R, SI, false, false)
2467
              , priority()
2468
  {
2469
  }
2470
2471
  ConstructorAttr *clone(ASTContext &C) const;
2472
  void printPretty(raw_ostream &OS,
2473
                   const PrintingPolicy &Policy) const;
2474
  const char *getSpelling() const;
2475
20
  int getPriority() const {
2476
20
    return priority;
2477
20
  }
2478
2479
  static const int DefaultPriority = 65535;
2480
2481
2482
2483
6.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::Constructor; }
2484
};
2485
2486
class ConsumableAttr : public InheritableAttr {
2487
public:
2488
  enum ConsumedState {
2489
    Unknown,
2490
    Consumed,
2491
    Unconsumed
2492
  };
2493
private:
2494
  ConsumedState defaultState;
2495
2496
public:
2497
  static ConsumableAttr *CreateImplicit(ASTContext &Ctx, ConsumedState DefaultState, SourceRange Loc = SourceRange()) {
2498
    auto *A = new (Ctx) ConsumableAttr(Loc, Ctx, DefaultState, 0);
2499
    A->setImplicit(true);
2500
    return A;
2501
  }
2502
2503
  ConsumableAttr(SourceRange R, ASTContext &Ctx
2504
              , ConsumedState DefaultState
2505
              , unsigned SI
2506
             )
2507
    : InheritableAttr(attr::Consumable, R, SI, false, false)
2508
              , defaultState(DefaultState)
2509
8
  {
2510
8
  }
2511
2512
  ConsumableAttr *clone(ASTContext &C) const;
2513
  void printPretty(raw_ostream &OS,
2514
                   const PrintingPolicy &Policy) const;
2515
  const char *getSpelling() const;
2516
43
  ConsumedState getDefaultState() const {
2517
43
    return defaultState;
2518
43
  }
2519
2520
6
  static bool ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) {
2521
6
    Optional<ConsumedState> R = llvm::StringSwitch<Optional<ConsumedState>>(Val)
2522
6
      .Case("unknown", ConsumableAttr::Unknown)
2523
6
      .Case("consumed", ConsumableAttr::Consumed)
2524
6
      .Case("unconsumed", ConsumableAttr::Unconsumed)
2525
6
      .Default(Optional<ConsumedState>());
2526
6
    if (R) {
2527
6
      Out = *R;
2528
6
      return true;
2529
6
    }
2530
0
    return false;
2531
0
  }
2532
2533
1
  static const char *ConvertConsumedStateToStr(ConsumedState Val) {
2534
1
    switch(Val) {
2535
1
    case ConsumableAttr::Unknown: return "unknown";
2536
1
    
case ConsumableAttr::Consumed: return "consumed"0
;
2537
1
    
case ConsumableAttr::Unconsumed: return "unconsumed"0
;
2538
0
    }
2539
0
    llvm_unreachable("No enumerator with that value");
2540
0
  }
2541
2542
2543
323
  static bool classof(const Attr *A) { return A->getKind() == attr::Consumable; }
2544
};
2545
2546
class ConsumableAutoCastAttr : public InheritableAttr {
2547
public:
2548
  static ConsumableAutoCastAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2549
    auto *A = new (Ctx) ConsumableAutoCastAttr(Loc, Ctx, 0);
2550
    A->setImplicit(true);
2551
    return A;
2552
  }
2553
2554
  ConsumableAutoCastAttr(SourceRange R, ASTContext &Ctx
2555
              , unsigned SI
2556
             )
2557
    : InheritableAttr(attr::ConsumableAutoCast, R, SI, false, false)
2558
2
  {
2559
2
  }
2560
2561
  ConsumableAutoCastAttr *clone(ASTContext &C) const;
2562
  void printPretty(raw_ostream &OS,
2563
                   const PrintingPolicy &Policy) const;
2564
  const char *getSpelling() const;
2565
2566
2567
7
  static bool classof(const Attr *A) { return A->getKind() == attr::ConsumableAutoCast; }
2568
};
2569
2570
class ConsumableSetOnReadAttr : public InheritableAttr {
2571
public:
2572
  static ConsumableSetOnReadAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2573
    auto *A = new (Ctx) ConsumableSetOnReadAttr(Loc, Ctx, 0);
2574
    A->setImplicit(true);
2575
    return A;
2576
  }
2577
2578
  ConsumableSetOnReadAttr(SourceRange R, ASTContext &Ctx
2579
              , unsigned SI
2580
             )
2581
    : InheritableAttr(attr::ConsumableSetOnRead, R, SI, false, false)
2582
2
  {
2583
2
  }
2584
2585
  ConsumableSetOnReadAttr *clone(ASTContext &C) const;
2586
  void printPretty(raw_ostream &OS,
2587
                   const PrintingPolicy &Policy) const;
2588
  const char *getSpelling() const;
2589
2590
2591
32
  static bool classof(const Attr *A) { return A->getKind() == attr::ConsumableSetOnRead; }
2592
};
2593
2594
class ConvergentAttr : public InheritableAttr {
2595
public:
2596
  static ConvergentAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2597
    auto *A = new (Ctx) ConvergentAttr(Loc, Ctx, 0);
2598
    A->setImplicit(true);
2599
    return A;
2600
  }
2601
2602
  ConvergentAttr(SourceRange R, ASTContext &Ctx
2603
              , unsigned SI
2604
             )
2605
    : InheritableAttr(attr::Convergent, R, SI, false, false)
2606
3.71k
  {
2607
3.71k
  }
2608
2609
  ConvergentAttr *clone(ASTContext &C) const;
2610
  void printPretty(raw_ostream &OS,
2611
                   const PrintingPolicy &Policy) const;
2612
  const char *getSpelling() const;
2613
2614
2615
527k
  static bool classof(const Attr *A) { return A->getKind() == attr::Convergent; }
2616
};
2617
2618
class DLLExportAttr : public InheritableAttr {
2619
public:
2620
  static DLLExportAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2621
    auto *A = new (Ctx) DLLExportAttr(Loc, Ctx, 0);
2622
    A->setImplicit(true);
2623
    return A;
2624
  }
2625
2626
  DLLExportAttr(SourceRange R, ASTContext &Ctx
2627
              , unsigned SI
2628
             )
2629
    : InheritableAttr(attr::DLLExport, R, SI, false, false)
2630
7.03k
  {
2631
7.03k
  }
2632
2633
  DLLExportAttr *clone(ASTContext &C) const;
2634
  void printPretty(raw_ostream &OS,
2635
                   const PrintingPolicy &Policy) const;
2636
  const char *getSpelling() const;
2637
2638
2639
16.9M
  static bool classof(const Attr *A) { return A->getKind() == attr::DLLExport; }
2640
};
2641
2642
class DLLExportStaticLocalAttr : public InheritableAttr {
2643
public:
2644
  static DLLExportStaticLocalAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2645
    auto *A = new (Ctx) DLLExportStaticLocalAttr(Loc, Ctx, 0);
2646
    A->setImplicit(true);
2647
    return A;
2648
  }
2649
2650
  DLLExportStaticLocalAttr(SourceRange R, ASTContext &Ctx
2651
              , unsigned SI
2652
             )
2653
    : InheritableAttr(attr::DLLExportStaticLocal, R, SI, false, false)
2654
17
  {
2655
17
  }
2656
2657
  DLLExportStaticLocalAttr *clone(ASTContext &C) const;
2658
  void printPretty(raw_ostream &OS,
2659
                   const PrintingPolicy &Policy) const;
2660
  const char *getSpelling() const;
2661
2662
2663
2.06k
  static bool classof(const Attr *A) { return A->getKind() == attr::DLLExportStaticLocal; }
2664
};
2665
2666
class DLLImportAttr : public InheritableAttr {
2667
public:
2668
  static DLLImportAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2669
    auto *A = new (Ctx) DLLImportAttr(Loc, Ctx, 0);
2670
    A->setImplicit(true);
2671
    return A;
2672
  }
2673
2674
  DLLImportAttr(SourceRange R, ASTContext &Ctx
2675
              , unsigned SI
2676
             )
2677
    : InheritableAttr(attr::DLLImport, R, SI, false, false)
2678
6.67k
  {
2679
6.67k
  }
2680
2681
  DLLImportAttr *clone(ASTContext &C) const;
2682
  void printPretty(raw_ostream &OS,
2683
                   const PrintingPolicy &Policy) const;
2684
  const char *getSpelling() const;
2685
2686
private:
2687
  bool PropagatedToBaseTemplate = false;
2688
2689
public:
2690
50
  void setPropagatedToBaseTemplate() { PropagatedToBaseTemplate = true; }
2691
702
  bool wasPropagatedToBaseTemplate() { return PropagatedToBaseTemplate; }
2692
  
2693
2694
20.3M
  static bool classof(const Attr *A) { return A->getKind() == attr::DLLImport; }
2695
};
2696
2697
class DLLImportStaticLocalAttr : public InheritableAttr {
2698
public:
2699
  static DLLImportStaticLocalAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2700
    auto *A = new (Ctx) DLLImportStaticLocalAttr(Loc, Ctx, 0);
2701
    A->setImplicit(true);
2702
    return A;
2703
  }
2704
2705
  DLLImportStaticLocalAttr(SourceRange R, ASTContext &Ctx
2706
              , unsigned SI
2707
             )
2708
    : InheritableAttr(attr::DLLImportStaticLocal, R, SI, false, false)
2709
6
  {
2710
6
  }
2711
2712
  DLLImportStaticLocalAttr *clone(ASTContext &C) const;
2713
  void printPretty(raw_ostream &OS,
2714
                   const PrintingPolicy &Policy) const;
2715
  const char *getSpelling() const;
2716
2717
2718
2.05k
  static bool classof(const Attr *A) { return A->getKind() == attr::DLLImportStaticLocal; }
2719
};
2720
2721
class DeprecatedAttr : public InheritableAttr {
2722
unsigned messageLength;
2723
char *message;
2724
2725
unsigned replacementLength;
2726
char *replacement;
2727
2728
public:
2729
  static DeprecatedAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, SourceRange Loc = SourceRange()) {
2730
    auto *A = new (Ctx) DeprecatedAttr(Loc, Ctx, Message, Replacement, 0);
2731
    A->setImplicit(true);
2732
    return A;
2733
  }
2734
2735
  DeprecatedAttr(SourceRange R, ASTContext &Ctx
2736
              , llvm::StringRef Message
2737
              , llvm::StringRef Replacement
2738
              , unsigned SI
2739
             )
2740
    : InheritableAttr(attr::Deprecated, R, SI, false, false)
2741
              , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2742
              , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength])
2743
14.6k
  {
2744
14.6k
      if (!Message.empty())
2745
5.84k
        std::memcpy(message, Message.data(), messageLength);
2746
14.6k
      if (!Replacement.empty())
2747
79
        std::memcpy(replacement, Replacement.data(), replacementLength);
2748
14.6k
  }
2749
2750
  DeprecatedAttr(SourceRange R, ASTContext &Ctx
2751
              , unsigned SI
2752
             )
2753
    : InheritableAttr(attr::Deprecated, R, SI, false, false)
2754
              , messageLength(0),message(nullptr)
2755
              , replacementLength(0),replacement(nullptr)
2756
  {
2757
  }
2758
2759
  DeprecatedAttr *clone(ASTContext &C) const;
2760
  void printPretty(raw_ostream &OS,
2761
                   const PrintingPolicy &Policy) const;
2762
  const char *getSpelling() const;
2763
3.74k
  llvm::StringRef getMessage() const {
2764
3.74k
    return llvm::StringRef(message, messageLength);
2765
3.74k
  }
2766
  unsigned getMessageLength() const {
2767
    return messageLength;
2768
  }
2769
  void setMessage(ASTContext &C, llvm::StringRef S) {
2770
    messageLength = S.size();
2771
    this->message = new (C, 1) char [messageLength];
2772
    if (!S.empty())
2773
      std::memcpy(this->message, S.data(), messageLength);
2774
  }
2775
2776
2.35k
  llvm::StringRef getReplacement() const {
2777
2.35k
    return llvm::StringRef(replacement, replacementLength);
2778
2.35k
  }
2779
  unsigned getReplacementLength() const {
2780
    return replacementLength;
2781
  }
2782
  void setReplacement(ASTContext &C, llvm::StringRef S) {
2783
    replacementLength = S.size();
2784
    this->replacement = new (C, 1) char [replacementLength];
2785
    if (!S.empty())
2786
      std::memcpy(this->replacement, S.data(), replacementLength);
2787
  }
2788
2789
2790
2791
7.24M
  static bool classof(const Attr *A) { return A->getKind() == attr::Deprecated; }
2792
};
2793
2794
class DestructorAttr : public InheritableAttr {
2795
int priority;
2796
2797
public:
2798
  static DestructorAttr *CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Loc = SourceRange()) {
2799
    auto *A = new (Ctx) DestructorAttr(Loc, Ctx, Priority, 0);
2800
    A->setImplicit(true);
2801
    return A;
2802
  }
2803
2804
  DestructorAttr(SourceRange R, ASTContext &Ctx
2805
              , int Priority
2806
              , unsigned SI
2807
             )
2808
    : InheritableAttr(attr::Destructor, R, SI, false, false)
2809
              , priority(Priority)
2810
35
  {
2811
35
  }
2812
2813
  DestructorAttr(SourceRange R, ASTContext &Ctx
2814
              , unsigned SI
2815
             )
2816
    : InheritableAttr(attr::Destructor, R, SI, false, false)
2817
              , priority()
2818
  {
2819
  }
2820
2821
  DestructorAttr *clone(ASTContext &C) const;
2822
  void printPretty(raw_ostream &OS,
2823
                   const PrintingPolicy &Policy) const;
2824
  const char *getSpelling() const;
2825
16
  int getPriority() const {
2826
16
    return priority;
2827
16
  }
2828
2829
  static const int DefaultPriority = 65535;
2830
2831
2832
2833
6.81M
  static bool classof(const Attr *A) { return A->getKind() == attr::Destructor; }
2834
};
2835
2836
class DiagnoseIfAttr : public InheritableAttr {
2837
Expr * cond;
2838
2839
unsigned messageLength;
2840
char *message;
2841
2842
public:
2843
  enum DiagnosticType {
2844
    DT_Error,
2845
    DT_Warning
2846
  };
2847
private:
2848
  DiagnosticType diagnosticType;
2849
2850
bool argDependent;
2851
2852
NamedDecl * parent;
2853
2854
public:
2855
  static DiagnoseIfAttr *CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, SourceRange Loc = SourceRange()) {
2856
    auto *A = new (Ctx) DiagnoseIfAttr(Loc, Ctx, Cond, Message, DiagnosticType, ArgDependent, Parent, 0);
2857
    A->setImplicit(true);
2858
    return A;
2859
  }
2860
2861
  static DiagnoseIfAttr *CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, SourceRange Loc = SourceRange()) {
2862
    auto *A = new (Ctx) DiagnoseIfAttr(Loc, Ctx, Cond, Message, DiagnosticType, 0);
2863
    A->setImplicit(true);
2864
    return A;
2865
  }
2866
2867
  DiagnoseIfAttr(SourceRange R, ASTContext &Ctx
2868
              , Expr * Cond
2869
              , llvm::StringRef Message
2870
              , DiagnosticType DiagnosticType
2871
              , bool ArgDependent
2872
              , NamedDecl * Parent
2873
              , unsigned SI
2874
             )
2875
    : InheritableAttr(attr::DiagnoseIf, R, SI, true, true)
2876
              , cond(Cond)
2877
              , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2878
              , diagnosticType(DiagnosticType)
2879
              , argDependent(ArgDependent)
2880
              , parent(Parent)
2881
5.82k
  {
2882
5.82k
      if (!Message.empty())
2883
5.82k
        std::memcpy(message, Message.data(), messageLength);
2884
5.82k
  }
2885
2886
  DiagnoseIfAttr(SourceRange R, ASTContext &Ctx
2887
              , Expr * Cond
2888
              , llvm::StringRef Message
2889
              , DiagnosticType DiagnosticType
2890
              , unsigned SI
2891
             )
2892
    : InheritableAttr(attr::DiagnoseIf, R, SI, true, true)
2893
              , cond(Cond)
2894
              , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2895
              , diagnosticType(DiagnosticType)
2896
              , argDependent()
2897
              , parent()
2898
  {
2899
      if (!Message.empty())
2900
        std::memcpy(message, Message.data(), messageLength);
2901
  }
2902
2903
  DiagnoseIfAttr *clone(ASTContext &C) const;
2904
  void printPretty(raw_ostream &OS,
2905
                   const PrintingPolicy &Policy) const;
2906
  const char *getSpelling() const;
2907
1.30k
  Expr * getCond() const {
2908
1.30k
    return cond;
2909
1.30k
  }
2910
2911
675
  llvm::StringRef getMessage() const {
2912
675
    return llvm::StringRef(message, messageLength);
2913
675
  }
2914
  unsigned getMessageLength() const {
2915
    return messageLength;
2916
  }
2917
  void setMessage(ASTContext &C, llvm::StringRef S) {
2918
    messageLength = S.size();
2919
    this->message = new (C, 1) char [messageLength];
2920
    if (!S.empty())
2921
      std::memcpy(this->message, S.data(), messageLength);
2922
  }
2923
2924
550
  DiagnosticType getDiagnosticType() const {
2925
550
    return diagnosticType;
2926
550
  }
2927
2928
5.27k
  static bool ConvertStrToDiagnosticType(StringRef Val, DiagnosticType &Out) {
2929
5.27k
    Optional<DiagnosticType> R = llvm::StringSwitch<Optional<DiagnosticType>>(Val)
2930
5.27k
      .Case("error", DiagnoseIfAttr::DT_Error)
2931
5.27k
      .Case("warning", DiagnoseIfAttr::DT_Warning)
2932
5.27k
      .Default(Optional<DiagnosticType>());
2933
5.27k
    if (R) {
2934
5.27k
      Out = *R;
2935
5.27k
      return true;
2936
5.27k
    }
2937
3
    return false;
2938
3
  }
2939
2940
0
  static const char *ConvertDiagnosticTypeToStr(DiagnosticType Val) {
2941
0
    switch(Val) {
2942
0
    case DiagnoseIfAttr::DT_Error: return "error";
2943
0
    case DiagnoseIfAttr::DT_Warning: return "warning";
2944
0
    }
2945
0
    llvm_unreachable("No enumerator with that value");
2946
0
  }
2947
1.82k
  bool getArgDependent() const {
2948
1.82k
    return argDependent;
2949
1.82k
  }
2950
2951
341
  NamedDecl * getParent() const {
2952
341
    return parent;
2953
341
  }
2954
2955
2956
654
    bool isError() const { return diagnosticType == DT_Error; }
2957
    bool isWarning() const { return diagnosticType == DT_Warning; }
2958
  
2959
2960
11.1M
  static bool classof(const Attr *A) { return A->getKind() == attr::DiagnoseIf; }
2961
};
2962
2963
class DisableTailCallsAttr : public InheritableAttr {
2964
public:
2965
  static DisableTailCallsAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2966
    auto *A = new (Ctx) DisableTailCallsAttr(Loc, Ctx, 0);
2967
    A->setImplicit(true);
2968
    return A;
2969
  }
2970
2971
  DisableTailCallsAttr(SourceRange R, ASTContext &Ctx
2972
              , unsigned SI
2973
             )
2974
    : InheritableAttr(attr::DisableTailCalls, R, SI, false, false)
2975
55
  {
2976
55
  }
2977
2978
  DisableTailCallsAttr *clone(ASTContext &C) const;
2979
  void printPretty(raw_ostream &OS,
2980
                   const PrintingPolicy &Policy) const;
2981
  const char *getSpelling() const;
2982
2983
2984
165k
  static bool classof(const Attr *A) { return A->getKind() == attr::DisableTailCalls; }
2985
};
2986
2987
class EmptyBasesAttr : public InheritableAttr {
2988
public:
2989
  static EmptyBasesAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2990
    auto *A = new (Ctx) EmptyBasesAttr(Loc, Ctx, 0);
2991
    A->setImplicit(true);
2992
    return A;
2993
  }
2994
2995
  EmptyBasesAttr(SourceRange R, ASTContext &Ctx
2996
              , unsigned SI
2997
             )
2998
    : InheritableAttr(attr::EmptyBases, R, SI, false, false)
2999
9
  {
3000
9
  }
3001
3002
  EmptyBasesAttr *clone(ASTContext &C) const;
3003
  void printPretty(raw_ostream &OS,
3004
                   const PrintingPolicy &Policy) const;
3005
  const char *getSpelling() const;
3006
3007
3008
916
  static bool classof(const Attr *A) { return A->getKind() == attr::EmptyBases; }
3009
};
3010
3011
class EnableIfAttr : public InheritableAttr {
3012
Expr * cond;
3013
3014
unsigned messageLength;
3015
char *message;
3016
3017
public:
3018
  static EnableIfAttr *CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, SourceRange Loc = SourceRange()) {
3019
    auto *A = new (Ctx) EnableIfAttr(Loc, Ctx, Cond, Message, 0);
3020
    A->setImplicit(true);
3021
    return A;
3022
  }
3023
3024
  EnableIfAttr(SourceRange R, ASTContext &Ctx
3025
              , Expr * Cond
3026
              , llvm::StringRef Message
3027
              , unsigned SI
3028
             )
3029
    : InheritableAttr(attr::EnableIf, R, SI, false, false)
3030
              , cond(Cond)
3031
              , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
3032
13.0k
  {
3033
13.0k
      if (!Message.empty())
3034
13.0k
        std::memcpy(message, Message.data(), messageLength);
3035
13.0k
  }
3036
3037
  EnableIfAttr *clone(ASTContext &C) const;
3038
  void printPretty(raw_ostream &OS,
3039
                   const PrintingPolicy &Policy) const;
3040
  const char *getSpelling() const;
3041
14.7k
  Expr * getCond() const {
3042
14.7k
    return cond;
3043
14.7k
  }
3044
3045
410
  llvm::StringRef getMessage() const {
3046
410
    return llvm::StringRef(message, messageLength);
3047
410
  }
3048
  unsigned getMessageLength() const {
3049
    return messageLength;
3050
  }
3051
  void setMessage(ASTContext &C, llvm::StringRef S) {
3052
    messageLength = S.size();
3053
    this->message = new (C, 1) char [messageLength];
3054
    if (!S.empty())
3055
      std::memcpy(this->message, S.data(), messageLength);
3056
  }
3057
3058
3059
3060
9.44M
  static bool classof(const Attr *A) { return A->getKind() == attr::EnableIf; }
3061
};
3062
3063
class EnumExtensibilityAttr : public InheritableAttr {
3064
public:
3065
  enum Kind {
3066
    Closed,
3067
    Open
3068
  };
3069
private:
3070
  Kind extensibility;
3071
3072
public:
3073
  static EnumExtensibilityAttr *CreateImplicit(ASTContext &Ctx, Kind Extensibility, SourceRange Loc = SourceRange()) {
3074
    auto *A = new (Ctx) EnumExtensibilityAttr(Loc, Ctx, Extensibility, 0);
3075
    A->setImplicit(true);
3076
    return A;
3077
  }
3078
3079
  EnumExtensibilityAttr(SourceRange R, ASTContext &Ctx
3080
              , Kind Extensibility
3081
              , unsigned SI
3082
             )
3083
    : InheritableAttr(attr::EnumExtensibility, R, SI, false, false)
3084
              , extensibility(Extensibility)
3085
5.01k
  {
3086
5.01k
  }
3087
3088
  EnumExtensibilityAttr *clone(ASTContext &C) const;
3089
  void printPretty(raw_ostream &OS,
3090
                   const PrintingPolicy &Policy) const;
3091
  const char *getSpelling() const;
3092
2.81k
  Kind getExtensibility() const {
3093
2.81k
    return extensibility;
3094
2.81k
  }
3095
3096
2.75k
  static bool ConvertStrToKind(StringRef Val, Kind &Out) {
3097
2.75k
    Optional<Kind> R = llvm::StringSwitch<Optional<Kind>>(Val)
3098
2.75k
      .Case("closed", EnumExtensibilityAttr::Closed)
3099
2.75k
      .Case("open", EnumExtensibilityAttr::Open)
3100
2.75k
      .Default(Optional<Kind>());
3101
2.75k
    if (R) {
3102
2.75k
      Out = *R;
3103
2.75k
      return true;
3104
2.75k
    }
3105
1
    return false;
3106
1
  }
3107
3108
0
  static const char *ConvertKindToStr(Kind Val) {
3109
0
    switch(Val) {
3110
0
    case EnumExtensibilityAttr::Closed: return "closed";
3111
0
    case EnumExtensibilityAttr::Open: return "open";
3112
0
    }
3113
0
    llvm_unreachable("No enumerator with that value");
3114
0
  }
3115
3116
3117
9.62k
  static bool classof(const Attr *A) { return A->getKind() == attr::EnumExtensibility; }
3118
};
3119
3120
class ExcludeFromExplicitInstantiationAttr : public InheritableAttr {
3121
public:
3122
  static ExcludeFromExplicitInstantiationAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3123
    auto *A = new (Ctx) ExcludeFromExplicitInstantiationAttr(Loc, Ctx, 0);
3124
    A->setImplicit(true);
3125
    return A;
3126
  }
3127
3128
  ExcludeFromExplicitInstantiationAttr(SourceRange R, ASTContext &Ctx
3129
              , unsigned SI
3130
             )
3131
    : InheritableAttr(attr::ExcludeFromExplicitInstantiation, R, SI, false, false)
3132
1.79M
  {
3133
1.79M
  }
3134
3135
  ExcludeFromExplicitInstantiationAttr *clone(ASTContext &C) const;
3136
  void printPretty(raw_ostream &OS,
3137
                   const PrintingPolicy &Policy) const;
3138
  const char *getSpelling() const;
3139
3140
3141
149k
  static bool classof(const Attr *A) { return A->getKind() == attr::ExcludeFromExplicitInstantiation; }
3142
};
3143
3144
class ExclusiveTrylockFunctionAttr : public InheritableAttr {
3145
Expr * successValue;
3146
3147
  unsigned args_Size;
3148
  Expr * *args_;
3149
3150
public:
3151
  static ExclusiveTrylockFunctionAttr *CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
3152
    auto *A = new (Ctx) ExclusiveTrylockFunctionAttr(Loc, Ctx, SuccessValue, Args, ArgsSize, 0);
3153
    A->setImplicit(true);
3154
    return A;
3155
  }
3156
3157
  ExclusiveTrylockFunctionAttr(SourceRange R, ASTContext &Ctx
3158
              , Expr * SuccessValue
3159
              , Expr * *Args, unsigned ArgsSize
3160
              , unsigned SI
3161
             )
3162
    : InheritableAttr(attr::ExclusiveTrylockFunction, R, SI, true, true)
3163
              , successValue(SuccessValue)
3164
              , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
3165
78
  {
3166
78
    std::copy(Args, Args + args_Size, args_);
3167
78
  }
3168
3169
  ExclusiveTrylockFunctionAttr(SourceRange R, ASTContext &Ctx
3170
              , Expr * SuccessValue
3171
              , unsigned SI
3172
             )
3173
    : InheritableAttr(attr::ExclusiveTrylockFunction, R, SI, true, true)
3174
              , successValue(SuccessValue)
3175
              , args_Size(0), args_(nullptr)
3176
  {
3177
  }
3178
3179
  ExclusiveTrylockFunctionAttr *clone(ASTContext &C) const;
3180
  void printPretty(raw_ostream &OS,
3181
                   const PrintingPolicy &Policy) const;
3182
  const char *getSpelling() const;
3183
157
  Expr * getSuccessValue() const {
3184
157
    return successValue;
3185
157
  }
3186
3187
  typedef Expr ** args_iterator;
3188
179
  args_iterator args_begin() const { return args_; }
3189
179
  args_iterator args_end() const { return args_ + args_Size; }
3190
79
  unsigned args_size() const { return args_Size; }
3191
179
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
3192
3193
3194
3195
3196
294k
  static bool classof(const Attr *A) { return A->getKind() == attr::ExclusiveTrylockFunction; }
3197
};
3198
3199
class ExternalSourceSymbolAttr : public InheritableAttr {
3200
unsigned languageLength;
3201
char *language;
3202
3203
unsigned definedInLength;
3204
char *definedIn;
3205
3206
bool generatedDeclaration;
3207
3208
public:
3209
  static ExternalSourceSymbolAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, SourceRange Loc = SourceRange()) {
3210
    auto *A = new (Ctx) ExternalSourceSymbolAttr(Loc, Ctx, Language, DefinedIn, GeneratedDeclaration, 0);
3211
    A->setImplicit(true);
3212
    return A;
3213
  }
3214
3215
  ExternalSourceSymbolAttr(SourceRange R, ASTContext &Ctx
3216
              , llvm::StringRef Language
3217
              , llvm::StringRef DefinedIn
3218
              , bool GeneratedDeclaration
3219
              , unsigned SI
3220
             )
3221
    : InheritableAttr(attr::ExternalSourceSymbol, R, SI, false, false)
3222
              , languageLength(Language.size()),language(new (Ctx, 1) char[languageLength])
3223
              , definedInLength(DefinedIn.size()),definedIn(new (Ctx, 1) char[definedInLength])
3224
              , generatedDeclaration(GeneratedDeclaration)
3225
60
  {
3226
60
      if (!Language.empty())
3227
49
        std::memcpy(language, Language.data(), languageLength);
3228
60
      if (!DefinedIn.empty())
3229
47
        std::memcpy(definedIn, DefinedIn.data(), definedInLength);
3230
60
  }
3231
3232
  ExternalSourceSymbolAttr(SourceRange R, ASTContext &Ctx
3233
              , unsigned SI
3234
             )
3235
    : InheritableAttr(attr::ExternalSourceSymbol, R, SI, false, false)
3236
              , languageLength(0),language(nullptr)
3237
              , definedInLength(0),definedIn(nullptr)
3238
              , generatedDeclaration()
3239
  {
3240
  }
3241
3242
  ExternalSourceSymbolAttr *clone(ASTContext &C) const;
3243
  void printPretty(raw_ostream &OS,
3244
                   const PrintingPolicy &Policy) const;
3245
  const char *getSpelling() const;
3246
28
  llvm::StringRef getLanguage() const {
3247
28
    return llvm::StringRef(language, languageLength);
3248
28
  }
3249
  unsigned getLanguageLength() const {
3250
    return languageLength;
3251
  }
3252
  void setLanguage(ASTContext &C, llvm::StringRef S) {
3253
    languageLength = S.size();
3254
    this->language = new (C, 1) char [languageLength];
3255
    if (!S.empty())
3256
      std::memcpy(this->language, S.data(), languageLength);
3257
  }
3258
3259
46
  llvm::StringRef getDefinedIn() const {
3260
46
    return llvm::StringRef(definedIn, definedInLength);
3261
46
  }
3262
  unsigned getDefinedInLength() const {
3263
    return definedInLength;
3264
  }
3265
  void setDefinedIn(ASTContext &C, llvm::StringRef S) {
3266
    definedInLength = S.size();
3267
    this->definedIn = new (C, 1) char [definedInLength];
3268
    if (!S.empty())
3269
      std::memcpy(this->definedIn, S.data(), definedInLength);
3270
  }
3271
3272
19
  bool getGeneratedDeclaration() const {
3273
19
    return generatedDeclaration;
3274
19
  }
3275
3276
3277
3278
907
  static bool classof(const Attr *A) { return A->getKind() == attr::ExternalSourceSymbol; }
3279
};
3280
3281
class FallThroughAttr : public StmtAttr {
3282
public:
3283
0
  static FallThroughAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3284
0
    auto *A = new (Ctx) FallThroughAttr(Loc, Ctx, 0);
3285
0
    A->setImplicit(true);
3286
0
    return A;
3287
0
  }
3288
3289
  FallThroughAttr(SourceRange R, ASTContext &Ctx
3290
              , unsigned SI
3291
             )
3292
    : StmtAttr(attr::FallThrough, R, SI, false)
3293
903
  {
3294
903
  }
3295
3296
  FallThroughAttr *clone(ASTContext &C) const;
3297
  void printPretty(raw_ostream &OS,
3298
                   const PrintingPolicy &Policy) const;
3299
  const char *getSpelling() const;
3300
3301
3302
92
  static bool classof(const Attr *A) { return A->getKind() == attr::FallThrough; }
3303
};
3304
3305
class FastCallAttr : public InheritableAttr {
3306
public:
3307
  static FastCallAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3308
    auto *A = new (Ctx) FastCallAttr(Loc, Ctx, 0);
3309
    A->setImplicit(true);
3310
    return A;
3311
  }
3312
3313
  FastCallAttr(SourceRange R, ASTContext &Ctx
3314
              , unsigned SI
3315
             )
3316
    : InheritableAttr(attr::FastCall, R, SI, false, false)
3317
184
  {
3318
184
  }
3319
3320
  FastCallAttr *clone(ASTContext &C) const;
3321
  void printPretty(raw_ostream &OS,
3322
                   const PrintingPolicy &Policy) const;
3323
  const char *getSpelling() const;
3324
3325
3326
318
  static bool classof(const Attr *A) { return A->getKind() == attr::FastCall; }
3327
};
3328
3329
class FinalAttr : public InheritableAttr {
3330
public:
3331
  enum Spelling {
3332
    Keyword_final = 0,
3333
    Keyword_sealed = 1
3334
  };
3335
3336
  static FinalAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
3337
    auto *A = new (Ctx) FinalAttr(Loc, Ctx, S);
3338
    A->setImplicit(true);
3339
    return A;
3340
  }
3341
3342
  FinalAttr(SourceRange R, ASTContext &Ctx
3343
              , unsigned SI
3344
             )
3345
    : InheritableAttr(attr::Final, R, SI, false, false)
3346
4.16k
  {
3347
4.16k
  }
3348
3349
  FinalAttr *clone(ASTContext &C) const;
3350
  void printPretty(raw_ostream &OS,
3351
                   const PrintingPolicy &Policy) const;
3352
  const char *getSpelling() const;
3353
  Spelling getSemanticSpelling() const {
3354
  switch (SpellingListIndex) {
3355
    default: llvm_unreachable("Unknown spelling list index");
3356
    case 0: return Keyword_final;
3357
    case 1: return Keyword_sealed;
3358
  }
3359
  }
3360
27
  bool isSpelledAsSealed() const { return SpellingListIndex == 1; }
3361
3362
3363
1.86M
  static bool classof(const Attr *A) { return A->getKind() == attr::Final; }
3364
};
3365
3366
class FlagEnumAttr : public InheritableAttr {
3367
public:
3368
  static FlagEnumAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3369
    auto *A = new (Ctx) FlagEnumAttr(Loc, Ctx, 0);
3370
    A->setImplicit(true);
3371
    return A;
3372
  }
3373
3374
  FlagEnumAttr(SourceRange R, ASTContext &Ctx
3375
              , unsigned SI
3376
             )
3377
    : InheritableAttr(attr::FlagEnum, R, SI, false, false)
3378
1.91k
  {
3379
1.91k
  }
3380
3381
  FlagEnumAttr *clone(ASTContext &C) const;
3382
  void printPretty(raw_ostream &OS,
3383
                   const PrintingPolicy &Policy) const;
3384
  const char *getSpelling() const;
3385
3386
3387
1.88k
  static bool classof(const Attr *A) { return A->getKind() == attr::FlagEnum; }
3388
};
3389
3390
class FlattenAttr : public InheritableAttr {
3391
public:
3392
  static FlattenAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3393
    auto *A = new (Ctx) FlattenAttr(Loc, Ctx, 0);
3394
    A->setImplicit(true);
3395
    return A;
3396
  }
3397
3398
  FlattenAttr(SourceRange R, ASTContext &Ctx
3399
              , unsigned SI
3400
             )
3401
    : InheritableAttr(attr::Flatten, R, SI, false, false)
3402
10
  {
3403
10
  }
3404
3405
  FlattenAttr *clone(ASTContext &C) const;
3406
  void printPretty(raw_ostream &OS,
3407
                   const PrintingPolicy &Policy) const;
3408
  const char *getSpelling() const;
3409
3410
3411
149k
  static bool classof(const Attr *A) { return A->getKind() == attr::Flatten; }
3412
};
3413
3414
class FormatAttr : public InheritableAttr {
3415
IdentifierInfo * type;
3416
3417
int formatIdx;
3418
3419
int firstArg;
3420
3421
public:
3422
23.6k
  static FormatAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, SourceRange Loc = SourceRange()) {
3423
23.6k
    auto *A = new (Ctx) FormatAttr(Loc, Ctx, Type, FormatIdx, FirstArg, 0);
3424
23.6k
    A->setImplicit(true);
3425
23.6k
    return A;
3426
23.6k
  }
3427
3428
  FormatAttr(SourceRange R, ASTContext &Ctx
3429
              , IdentifierInfo * Type
3430
              , int FormatIdx
3431
              , int FirstArg
3432
              , unsigned SI
3433
             )
3434
    : InheritableAttr(attr::Format, R, SI, false, false)
3435
              , type(Type)
3436
              , formatIdx(FormatIdx)
3437
              , firstArg(FirstArg)
3438
74.1k
  {
3439
74.1k
  }
3440
3441
  FormatAttr *clone(ASTContext &C) const;
3442
  void printPretty(raw_ostream &OS,
3443
                   const PrintingPolicy &Policy) const;
3444
  const char *getSpelling() const;
3445
88.7k
  IdentifierInfo * getType() const {
3446
88.7k
    return type;
3447
88.7k
  }
3448
3449
87.9k
  int getFormatIdx() const {
3450
87.9k
    return formatIdx;
3451
87.9k
  }
3452
3453
129k
  int getFirstArg() const {
3454
129k
    return firstArg;
3455
129k
  }
3456
3457
3458
3459
4.24M
  static bool classof(const Attr *A) { return A->getKind() == attr::Format; }
3460
};
3461
3462
class FormatArgAttr : public InheritableAttr {
3463
ParamIdx formatIdx;
3464
3465
public:
3466
1
  static FormatArgAttr *CreateImplicit(ASTContext &Ctx, ParamIdx FormatIdx, SourceRange Loc = SourceRange()) {
3467
1
    auto *A = new (Ctx) FormatArgAttr(Loc, Ctx, FormatIdx, 0);
3468
1
    A->setImplicit(true);
3469
1
    return A;
3470
1
  }
3471
3472
  FormatArgAttr(SourceRange R, ASTContext &Ctx
3473
              , ParamIdx FormatIdx
3474
              , unsigned SI
3475
             )
3476
    : InheritableAttr(attr::FormatArg, R, SI, false, false)
3477
              , formatIdx(FormatIdx)
3478
333
  {
3479
333
  }
3480
3481
  FormatArgAttr *clone(ASTContext &C) const;
3482
  void printPretty(raw_ostream &OS,
3483
                   const PrintingPolicy &Policy) const;
3484
  const char *getSpelling() const;
3485
35
  ParamIdx getFormatIdx() const {
3486
35
    return formatIdx;
3487
35
  }
3488
3489
3490
3491
81
  static bool classof(const Attr *A) { return A->getKind() == attr::FormatArg; }
3492
};
3493
3494
class GNUInlineAttr : public InheritableAttr {
3495
public:
3496
  static GNUInlineAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3497
    auto *A = new (Ctx) GNUInlineAttr(Loc, Ctx, 0);
3498
    A->setImplicit(true);
3499
    return A;
3500
  }
3501
3502
  GNUInlineAttr(SourceRange R, ASTContext &Ctx
3503
              , unsigned SI
3504
             )
3505
    : InheritableAttr(attr::GNUInline, R, SI, false, false)
3506
113
  {
3507
113
  }
3508
3509
  GNUInlineAttr *clone(ASTContext &C) const;
3510
  void printPretty(raw_ostream &OS,
3511
                   const PrintingPolicy &Policy) const;
3512
  const char *getSpelling() const;
3513
3514
3515
3.44M
  static bool classof(const Attr *A) { return A->getKind() == attr::GNUInline; }
3516
};
3517
3518
class GuardedByAttr : public InheritableAttr {
3519
Expr * arg;
3520
3521
public:
3522
  static GuardedByAttr *CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Loc = SourceRange()) {
3523
    auto *A = new (Ctx) GuardedByAttr(Loc, Ctx, Arg, 0);
3524
    A->setImplicit(true);
3525
    return A;
3526
  }
3527
3528
  GuardedByAttr(SourceRange R, ASTContext &Ctx
3529
              , Expr * Arg
3530
              , unsigned SI
3531
             )
3532
    : InheritableAttr(attr::GuardedBy, R, SI, true, true)
3533
              , arg(Arg)
3534
572
  {
3535
572
  }
3536
3537
  GuardedByAttr *clone(ASTContext &C) const;
3538
  void printPretty(raw_ostream &OS,
3539
                   const PrintingPolicy &Policy) const;
3540
  const char *getSpelling() const;
3541
3.75k
  Expr * getArg() const {
3542
3.75k
    return arg;
3543
3.75k
  }
3544
3545
3546
3547
298k
  static bool classof(const Attr *A) { return A->getKind() == attr::GuardedBy; }
3548
};
3549
3550
class GuardedVarAttr : public InheritableAttr {
3551
public:
3552
  static GuardedVarAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3553
    auto *A = new (Ctx) GuardedVarAttr(Loc, Ctx, 0);
3554
    A->setImplicit(true);
3555
    return A;
3556
  }
3557
3558
  GuardedVarAttr(SourceRange R, ASTContext &Ctx
3559
              , unsigned SI
3560
             )
3561
    : InheritableAttr(attr::GuardedVar, R, SI, false, false)
3562
14
  {
3563
14
  }
3564
3565
  GuardedVarAttr *clone(ASTContext &C) const;
3566
  void printPretty(raw_ostream &OS,
3567
                   const PrintingPolicy &Policy) const;
3568
  const char *getSpelling() const;
3569
3570
3571
2.70k
  static bool classof(const Attr *A) { return A->getKind() == attr::GuardedVar; }
3572
};
3573
3574
class HotAttr : public InheritableAttr {
3575
public:
3576
  static HotAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3577
    auto *A = new (Ctx) HotAttr(Loc, Ctx, 0);
3578
    A->setImplicit(true);
3579
    return A;
3580
  }
3581
3582
  HotAttr(SourceRange R, ASTContext &Ctx
3583
              , unsigned SI
3584
             )
3585
    : InheritableAttr(attr::Hot, R, SI, false, false)
3586
2
  {
3587
2
  }
3588
3589
  HotAttr *clone(ASTContext &C) const;
3590
  void printPretty(raw_ostream &OS,
3591
                   const PrintingPolicy &Policy) const;
3592
  const char *getSpelling() const;
3593
3594
3595
5
  static bool classof(const Attr *A) { return A->getKind() == attr::Hot; }
3596
};
3597
3598
class IBActionAttr : public InheritableAttr {
3599
public:
3600
  static IBActionAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3601
    auto *A = new (Ctx) IBActionAttr(Loc, Ctx, 0);
3602
    A->setImplicit(true);
3603
    return A;
3604
  }
3605
3606
  IBActionAttr(SourceRange R, ASTContext &Ctx
3607
              , unsigned SI
3608
             )
3609
    : InheritableAttr(attr::IBAction, R, SI, false, false)
3610
57
  {
3611
57
  }
3612
3613
  IBActionAttr *clone(ASTContext &C) const;
3614
  void printPretty(raw_ostream &OS,
3615
                   const PrintingPolicy &Policy) const;
3616
  const char *getSpelling() const;
3617
3618
3619
  static bool classof(const Attr *A) { return A->getKind() == attr::IBAction; }
3620
};
3621
3622
class IBOutletAttr : public InheritableAttr {
3623
public:
3624
  static IBOutletAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3625
    auto *A = new (Ctx) IBOutletAttr(Loc, Ctx, 0);
3626
    A->setImplicit(true);
3627
    return A;
3628
  }
3629
3630
  IBOutletAttr(SourceRange R, ASTContext &Ctx
3631
              , unsigned SI
3632
             )
3633
    : InheritableAttr(attr::IBOutlet, R, SI, false, false)
3634
38
  {
3635
38
  }
3636
3637
  IBOutletAttr *clone(ASTContext &C) const;
3638
  void printPretty(raw_ostream &OS,
3639
                   const PrintingPolicy &Policy) const;
3640
  const char *getSpelling() const;
3641
3642
3643
32
  static bool classof(const Attr *A) { return A->getKind() == attr::IBOutlet; }
3644
};
3645
3646
class IBOutletCollectionAttr : public InheritableAttr {
3647
TypeSourceInfo * interface_;
3648
3649
public:
3650
  static IBOutletCollectionAttr *CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Interface, SourceRange Loc = SourceRange()) {
3651
    auto *A = new (Ctx) IBOutletCollectionAttr(Loc, Ctx, Interface, 0);
3652
    A->setImplicit(true);
3653
    return A;
3654
  }
3655
3656
  IBOutletCollectionAttr(SourceRange R, ASTContext &Ctx
3657
              , TypeSourceInfo * Interface
3658
              , unsigned SI
3659
             )
3660
    : InheritableAttr(attr::IBOutletCollection, R, SI, false, false)
3661
              , interface_(Interface)
3662
28
  {
3663
28
  }
3664
3665
  IBOutletCollectionAttr(SourceRange R, ASTContext &Ctx
3666
              , unsigned SI
3667
             )
3668
    : InheritableAttr(attr::IBOutletCollection, R, SI, false, false)
3669
              , interface_()
3670
  {
3671
  }
3672
3673
  IBOutletCollectionAttr *clone(ASTContext &C) const;
3674
  void printPretty(raw_ostream &OS,
3675
                   const PrintingPolicy &Policy) const;
3676
  const char *getSpelling() const;
3677
12
  QualType getInterface() const {
3678
12
    return interface_->getType();
3679
12
  }  TypeSourceInfo * getInterfaceLoc() const {
3680
10
    return interface_;
3681
10
  }
3682
3683
3684
3685
182
  static bool classof(const Attr *A) { return A->getKind() == attr::IBOutletCollection; }
3686
};
3687
3688
class IFuncAttr : public Attr {
3689
unsigned resolverLength;
3690
char *resolver;
3691
3692
public:
3693
  static IFuncAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Resolver, SourceRange Loc = SourceRange()) {
3694
    auto *A = new (Ctx) IFuncAttr(Loc, Ctx, Resolver, 0);
3695
    A->setImplicit(true);
3696
    return A;
3697
  }
3698
3699
  IFuncAttr(SourceRange R, ASTContext &Ctx
3700
              , llvm::StringRef Resolver
3701
              , unsigned SI
3702
             )
3703
    : Attr(attr::IFunc, R, SI, false)
3704
              , resolverLength(Resolver.size()),resolver(new (Ctx, 1) char[resolverLength])
3705
11
  {
3706
11
      if (!Resolver.empty())
3707
11
        std::memcpy(resolver, Resolver.data(), resolverLength);
3708
11
  }
3709
3710
  IFuncAttr *clone(ASTContext &C) const;
3711
  void printPretty(raw_ostream &OS,
3712
                   const PrintingPolicy &Policy) const;
3713
  const char *getSpelling() const;
3714
19
  llvm::StringRef getResolver() const {
3715
19
    return llvm::StringRef(resolver, resolverLength);
3716
19
  }
3717
  unsigned getResolverLength() const {
3718
    return resolverLength;
3719
  }
3720
  void setResolver(ASTContext &C, llvm::StringRef S) {
3721
    resolverLength = S.size();
3722
    this->resolver = new (C, 1) char [resolverLength];
3723
    if (!S.empty())
3724
      std::memcpy(this->resolver, S.data(), resolverLength);
3725
  }
3726
3727
3728
3729
18.6M
  static bool classof(const Attr *A) { return A->getKind() == attr::IFunc; }
3730
};
3731
3732
class InitPriorityAttr : public InheritableAttr {
3733
unsigned priority;
3734
3735
public:
3736
  static InitPriorityAttr *CreateImplicit(ASTContext &Ctx, unsigned Priority, SourceRange Loc = SourceRange()) {
3737
    auto *A = new (Ctx) InitPriorityAttr(Loc, Ctx, Priority, 0);
3738
    A->setImplicit(true);
3739
    return A;
3740
  }
3741
3742
  InitPriorityAttr(SourceRange R, ASTContext &Ctx
3743
              , unsigned Priority
3744
              , unsigned SI
3745
             )
3746
    : InheritableAttr(attr::InitPriority, R, SI, false, false)
3747
              , priority(Priority)
3748
820
  {
3749
820
  }
3750
3751
  InitPriorityAttr *clone(ASTContext &C) const;
3752
  void printPretty(raw_ostream &OS,
3753
                   const PrintingPolicy &Policy) const;
3754
  const char *getSpelling() const;
3755
711
  unsigned getPriority() const {
3756
711
    return priority;
3757
711
  }
3758
3759
3760
3761
1.29k
  static bool classof(const Attr *A) { return A->getKind() == attr::InitPriority; }
3762
};
3763
3764
class InitSegAttr : public Attr {
3765
unsigned sectionLength;
3766
char *section;
3767
3768
public:
3769
10
  static InitSegAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Section, SourceRange Loc = SourceRange()) {
3770
10
    auto *A = new (Ctx) InitSegAttr(Loc, Ctx, Section, 0);
3771
10
    A->setImplicit(true);
3772
10
    return A;
3773
10
  }
3774
3775
  InitSegAttr(SourceRange R, ASTContext &Ctx
3776
              , llvm::StringRef Section
3777
              , unsigned SI
3778
             )
3779
    : Attr(attr::InitSeg, R, SI, false)
3780
              , sectionLength(Section.size()),section(new (Ctx, 1) char[sectionLength])
3781
12
  {
3782
12
      if (!Section.empty())
3783
12
        std::memcpy(section, Section.data(), sectionLength);
3784
12
  }
3785
3786
  InitSegAttr *clone(ASTContext &C) const;
3787
  void printPretty(raw_ostream &OS,
3788
                   const PrintingPolicy &Policy) const;
3789
  const char *getSpelling() const;
3790
9
  llvm::StringRef getSection() const {
3791
9
    return llvm::StringRef(section, sectionLength);
3792
9
  }
3793
  unsigned getSectionLength() const {
3794
    return sectionLength;
3795
  }
3796
  void setSection(ASTContext &C, llvm::StringRef S) {
3797
    sectionLength = S.size();
3798
    this->section = new (C, 1) char [sectionLength];
3799
    if (!S.empty())
3800
      std::memcpy(this->section, S.data(), sectionLength);
3801
  }
3802
3803
3804
1
  void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
3805
1
    OS << " (" << getSection() << ')';
3806
1
  }
3807
  
3808
3809
827
  static bool classof(const Attr *A) { return A->getKind() == attr::InitSeg; }
3810
};
3811
3812
class IntelOclBiccAttr : public InheritableAttr {
3813
public:
3814
  static IntelOclBiccAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3815
    auto *A = new (Ctx) IntelOclBiccAttr(Loc, Ctx, 0);
3816
    A->setImplicit(true);
3817
    return A;
3818
  }
3819
3820
  IntelOclBiccAttr(SourceRange R, ASTContext &Ctx
3821
              , unsigned SI
3822
             )
3823
    : InheritableAttr(attr::IntelOclBicc, R, SI, false, false)
3824
6
  {
3825
6
  }
3826
3827
  IntelOclBiccAttr *clone(ASTContext &C) const;
3828
  void printPretty(raw_ostream &OS,
3829
                   const PrintingPolicy &Policy) const;
3830
  const char *getSpelling() const;
3831
3832
3833
318
  static bool classof(const Attr *A) { return A->getKind() == attr::IntelOclBicc; }
3834
};
3835
3836
class InternalLinkageAttr : public InheritableAttr {
3837
public:
3838
  static InternalLinkageAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3839
    auto *A = new (Ctx) InternalLinkageAttr(Loc, Ctx, 0);
3840
    A->setImplicit(true);
3841
    return A;
3842
  }
3843
3844
  InternalLinkageAttr(SourceRange R, ASTContext &Ctx
3845
              , unsigned SI
3846
             )
3847
    : InheritableAttr(attr::InternalLinkage, R, SI, false, false)
3848
157
  {
3849
157
  }
3850
3851
  InternalLinkageAttr *clone(ASTContext &C) const;
3852
  void printPretty(raw_ostream &OS,
3853
                   const PrintingPolicy &Policy) const;
3854
  const char *getSpelling() const;
3855
3856
3857
67.7M
  static bool classof(const Attr *A) { return A->getKind() == attr::InternalLinkage; }
3858
};
3859
3860
class LTOVisibilityPublicAttr : public InheritableAttr {
3861
public:
3862
  static LTOVisibilityPublicAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3863
    auto *A = new (Ctx) LTOVisibilityPublicAttr(Loc, Ctx, 0);
3864
    A->setImplicit(true);
3865
    return A;
3866
  }
3867
3868
  LTOVisibilityPublicAttr(SourceRange R, ASTContext &Ctx
3869
              , unsigned SI
3870
             )
3871
    : InheritableAttr(attr::LTOVisibilityPublic, R, SI, false, false)
3872
5
  {
3873
5
  }
3874
3875
  LTOVisibilityPublicAttr *clone(ASTContext &C) const;
3876
  void printPretty(raw_ostream &OS,
3877
                   const PrintingPolicy &Policy) const;
3878
  const char *getSpelling() const;
3879
3880
3881
14
  static bool classof(const Attr *A) { return A->getKind() == attr::LTOVisibilityPublic; }
3882
};
3883
3884
class LayoutVersionAttr : public InheritableAttr {
3885
unsigned version;
3886
3887
public:
3888
  static LayoutVersionAttr *CreateImplicit(ASTContext &Ctx, unsigned Version, SourceRange Loc = SourceRange()) {
3889
    auto *A = new (Ctx) LayoutVersionAttr(Loc, Ctx, Version, 0);
3890
    A->setImplicit(true);
3891
    return A;
3892
  }
3893
3894
  LayoutVersionAttr(SourceRange R, ASTContext &Ctx
3895
              , unsigned Version
3896
              , unsigned SI
3897
             )
3898
    : InheritableAttr(attr::LayoutVersion, R, SI, false, false)
3899
              , version(Version)
3900
1
  {
3901
1
  }
3902
3903
  LayoutVersionAttr *clone(ASTContext &C) const;
3904
  void printPretty(raw_ostream &OS,
3905
                   const PrintingPolicy &Policy) const;
3906
  const char *getSpelling() const;
3907
0
  unsigned getVersion() const {
3908
0
    return version;
3909
0
  }
3910
3911
3912
3913
900
  static bool classof(const Attr *A) { return A->getKind() == attr::LayoutVersion; }
3914
};
3915
3916
class LifetimeBoundAttr : public InheritableAttr {
3917
public:
3918
  static LifetimeBoundAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3919
    auto *A = new (Ctx) LifetimeBoundAttr(Loc, Ctx, 0);
3920
    A->setImplicit(true);
3921
    return A;
3922
  }
3923
3924
  LifetimeBoundAttr(SourceRange R, ASTContext &Ctx
3925
              , unsigned SI
3926
             )
3927
    : InheritableAttr(attr::LifetimeBound, R, SI, false, false)
3928
21
  {
3929
21
  }
3930
3931
  LifetimeBoundAttr *clone(ASTContext &C) const;
3932
  void printPretty(raw_ostream &OS,
3933
                   const PrintingPolicy &Policy) const;
3934
  const char *getSpelling() const;
3935
3936
3937
3.03k
  static bool classof(const Attr *A) { return A->getKind() == attr::LifetimeBound; }
3938
};
3939
3940
class LockReturnedAttr : public InheritableAttr {
3941
Expr * arg;
3942
3943
public:
3944
  static LockReturnedAttr *CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Loc = SourceRange()) {
3945
    auto *A = new (Ctx) LockReturnedAttr(Loc, Ctx, Arg, 0);
3946
    A->setImplicit(true);
3947
    return A;
3948
  }
3949
3950
  LockReturnedAttr(SourceRange R, ASTContext &Ctx
3951
              , Expr * Arg
3952
              , unsigned SI
3953
             )
3954
    : InheritableAttr(attr::LockReturned, R, SI, true, false)
3955
              , arg(Arg)
3956
87
  {
3957
87
  }
3958
3959
  LockReturnedAttr *clone(ASTContext &C) const;
3960
  void printPretty(raw_ostream &OS,
3961
                   const PrintingPolicy &Policy) const;
3962
  const char *getSpelling() const;
3963
183
  Expr * getArg() const {
3964
183
    return arg;
3965
183
  }
3966
3967
3968
3969
294k
  static bool classof(const Attr *A) { return A->getKind() == attr::LockReturned; }
3970
};
3971
3972
class LocksExcludedAttr : public InheritableAttr {
3973
  unsigned args_Size;
3974
  Expr * *args_;
3975
3976
public:
3977
  static LocksExcludedAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
3978
    auto *A = new (Ctx) LocksExcludedAttr(Loc, Ctx, Args, ArgsSize, 0);
3979
    A->setImplicit(true);
3980
    return A;
3981
  }
3982
3983
  LocksExcludedAttr(SourceRange R, ASTContext &Ctx
3984
              , Expr * *Args, unsigned ArgsSize
3985
              , unsigned SI
3986
             )
3987
    : InheritableAttr(attr::LocksExcluded, R, SI, true, true)
3988
              , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
3989
156
  {
3990
156
    std::copy(Args, Args + args_Size, args_);
3991
156
  }
3992
3993
  LocksExcludedAttr(SourceRange R, ASTContext &Ctx
3994
              , unsigned SI
3995
             )
3996
    : InheritableAttr(attr::LocksExcluded, R, SI, true, true)
3997
              , args_Size(0), args_(nullptr)
3998
  {
3999
  }
4000
4001
  LocksExcludedAttr *clone(ASTContext &C) const;
4002
  void printPretty(raw_ostream &OS,
4003
                   const PrintingPolicy &Policy) const;
4004
  const char *getSpelling() const;
4005
  typedef Expr ** args_iterator;
4006
246
  args_iterator args_begin() const { return args_; }
4007
246
  args_iterator args_end() const { return args_ + args_Size; }
4008
8
  unsigned args_size() const { return args_Size; }
4009
242
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
4010
4011
4012
4013
4014
294k
  static bool classof(const Attr *A) { return A->getKind() == attr::LocksExcluded; }
4015
};
4016
4017
class LoopHintAttr : public Attr {
4018
public:
4019
  enum OptionType {
4020
    Vectorize,
4021
    VectorizeWidth,
4022
    Interleave,
4023
    InterleaveCount,
4024
    Unroll,
4025
    UnrollCount,
4026
    UnrollAndJam,
4027
    UnrollAndJamCount,
4028
    Distribute
4029
  };
4030
private:
4031
  OptionType option;
4032
4033
public:
4034
  enum LoopHintState {
4035
    Enable,
4036
    Disable,
4037
    Numeric,
4038
    AssumeSafety,
4039
    Full
4040
  };
4041
private:
4042
  LoopHintState state;
4043
4044
Expr * value;
4045
4046
public:
4047
  enum Spelling {
4048
    Pragma_clang_loop = 0,
4049
    Pragma_unroll = 1,
4050
    Pragma_nounroll = 2,
4051
    Pragma_unroll_and_jam = 3,
4052
    Pragma_nounroll_and_jam = 4
4053
  };
4054
4055
240
  static LoopHintAttr *CreateImplicit(ASTContext &Ctx, Spelling S, OptionType Option, LoopHintState State, Expr * Value, SourceRange Loc = SourceRange()) {
4056
240
    auto *A = new (Ctx) LoopHintAttr(Loc, Ctx, Option, State, Value, S);
4057
240
    A->setImplicit(true);
4058
240
    return A;
4059
240
  }
4060
4061
  LoopHintAttr(SourceRange R, ASTContext &Ctx
4062
              , OptionType Option
4063
              , LoopHintState State
4064
              , Expr * Value
4065
              , unsigned SI
4066
             )
4067
    : Attr(attr::LoopHint, R, SI, false)
4068
              , option(Option)
4069
              , state(State)
4070
              , value(Value)
4071
258
  {
4072
258
  }
4073
4074
  LoopHintAttr *clone(ASTContext &C) const;
4075
  void printPretty(raw_ostream &OS,
4076
                   const PrintingPolicy &Policy) const;
4077
  const char *getSpelling() const;
4078
27
  Spelling getSemanticSpelling() const {
4079
27
  switch (SpellingListIndex) {
4080
27
    
default: 0
llvm_unreachable0
("Unknown spelling list index");
4081
27
    case 0: return Pragma_clang_loop;
4082
27
    
case 1: return Pragma_unroll0
;
4083
27
    
case 2: return Pragma_nounroll0
;
4084
27
    
case 3: return Pragma_unroll_and_jam0
;
4085
27
    
case 4: return Pragma_nounroll_and_jam0
;
4086
27
  }
4087
27
  }
4088
335
  OptionType getOption() const {
4089
335
    return option;
4090
335
  }
4091
4092
  static bool ConvertStrToOptionType(StringRef Val, OptionType &Out) {
4093
    Optional<OptionType> R = llvm::StringSwitch<Optional<OptionType>>(Val)
4094
      .Case("vectorize", LoopHintAttr::Vectorize)
4095
      .Case("vectorize_width", LoopHintAttr::VectorizeWidth)
4096
      .Case("interleave", LoopHintAttr::Interleave)
4097
      .Case("interleave_count", LoopHintAttr::InterleaveCount)
4098
      .Case("unroll", LoopHintAttr::Unroll)
4099
      .Case("unroll_count", LoopHintAttr::UnrollCount)
4100
      .Case("unroll_and_jam", LoopHintAttr::UnrollAndJam)
4101
      .Case("unroll_and_jam_count", LoopHintAttr::UnrollAndJamCount)
4102
      .Case("distribute", LoopHintAttr::Distribute)
4103
      .Default(Optional<OptionType>());
4104
    if (R) {
4105
      Out = *R;
4106
      return true;
4107
    }
4108
    return false;
4109
  }
4110
4111
  static const char *ConvertOptionTypeToStr(OptionType Val) {
4112
    switch(Val) {
4113
    case LoopHintAttr::Vectorize: return "vectorize";
4114
    case LoopHintAttr::VectorizeWidth: return "vectorize_width";
4115
    case LoopHintAttr::Interleave: return "interleave";
4116
    case LoopHintAttr::InterleaveCount: return "interleave_count";
4117
    case LoopHintAttr::Unroll: return "unroll";
4118
    case LoopHintAttr::UnrollCount: return "unroll_count";
4119
    case LoopHintAttr::UnrollAndJam: return "unroll_and_jam";
4120
    case LoopHintAttr::UnrollAndJamCount: return "unroll_and_jam_count";
4121
    case LoopHintAttr::Distribute: return "distribute";
4122
    }
4123
    llvm_unreachable("No enumerator with that value");
4124
  }
4125
128
  LoopHintState getState() const {
4126
128
    return state;
4127
128
  }
4128
4129
  static bool ConvertStrToLoopHintState(StringRef Val, LoopHintState &Out) {
4130
    Optional<LoopHintState> R = llvm::StringSwitch<Optional<LoopHintState>>(Val)
4131
      .Case("enable", LoopHintAttr::Enable)
4132
      .Case("disable", LoopHintAttr::Disable)
4133
      .Case("numeric", LoopHintAttr::Numeric)
4134
      .Case("assume_safety", LoopHintAttr::AssumeSafety)
4135
      .Case("full", LoopHintAttr::Full)
4136
      .Default(Optional<LoopHintState>());
4137
    if (R) {
4138
      Out = *R;
4139
      return true;
4140
    }
4141
    return false;
4142
  }
4143
4144
  static const char *ConvertLoopHintStateToStr(LoopHintState Val) {
4145
    switch(Val) {
4146
    case LoopHintAttr::Enable: return "enable";
4147
    case LoopHintAttr::Disable: return "disable";
4148
    case LoopHintAttr::Numeric: return "numeric";
4149
    case LoopHintAttr::AssumeSafety: return "assume_safety";
4150
    case LoopHintAttr::Full: return "full";
4151
    }
4152
    llvm_unreachable("No enumerator with that value");
4153
  }
4154
173
  Expr * getValue() const {
4155
173
    return value;
4156
173
  }
4157
4158
4159
76
  static const char *getOptionName(int Option) {
4160
76
    switch(Option) {
4161
76
    
case Vectorize: return "vectorize"12
;
4162
76
    
case VectorizeWidth: return "vectorize_width"13
;
4163
76
    
case Interleave: return "interleave"12
;
4164
76
    
case InterleaveCount: return "interleave_count"13
;
4165
76
    
case Unroll: return "unroll"11
;
4166
76
    
case UnrollCount: return "unroll_count"7
;
4167
76
    
case UnrollAndJam: return "unroll_and_jam"0
;
4168
76
    
case UnrollAndJamCount: return "unroll_and_jam_count"0
;
4169
76
    
case Distribute: return "distribute"8
;
4170
0
    }
4171
0
    llvm_unreachable("Unhandled LoopHint option.");
4172
0
  }
4173
4174
42
  void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
4175
42
    unsigned SpellingIndex = getSpellingListIndex();
4176
42
    // For "#pragma unroll" and "#pragma nounroll" the string "unroll" or
4177
42
    // "nounroll" is already emitted as the pragma name.
4178
42
    if (SpellingIndex == Pragma_nounroll || 
SpellingIndex == Pragma_nounroll_and_jam41
)
4179
1
      return;
4180
41
    else if (SpellingIndex == Pragma_unroll || 
SpellingIndex == Pragma_unroll_and_jam39
) {
4181
2
      OS << ' ' << getValueString(Policy);
4182
2
      return;
4183
2
    }
4184
39
4185
39
    assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
4186
39
    OS << ' ' << getOptionName(option) << getValueString(Policy);
4187
39
  }
4188
4189
  // Return a string containing the loop hint argument including the
4190
  // enclosing parentheses.
4191
85
  std::string getValueString(const PrintingPolicy &Policy) const {
4192
85
    std::string ValueName;
4193
85
    llvm::raw_string_ostream OS(ValueName);
4194
85
    OS << "(";
4195
85
    if (state == Numeric)
4196
41
      value->printPretty(OS, nullptr, Policy);
4197
44
    else if (state == Enable)
4198
16
      OS << "enable";
4199
28
    else if (state == Full)
4200
5
      OS << "full";
4201
23
    else if (state == AssumeSafety)
4202
2
      OS << "assume_safety";
4203
21
    else
4204
21
      OS << "disable";
4205
85
    OS << ")";
4206
85
    return OS.str();
4207
85
  }
4208
4209
  // Return a string suitable for identifying this attribute in diagnostics.
4210
52
  std::string getDiagnosticName(const PrintingPolicy &Policy) const {
4211
52
    unsigned SpellingIndex = getSpellingListIndex();
4212
52
    if (SpellingIndex == Pragma_nounroll)
4213
3
      return "#pragma nounroll";
4214
49
    else if (SpellingIndex == Pragma_unroll)
4215
10
      return "#pragma unroll" + (option == UnrollCount ? 
getValueString(Policy)6
:
""4
);
4216
39
    else if (SpellingIndex == Pragma_nounroll_and_jam)
4217
1
      return "#pragma nounroll_and_jam";
4218
38
    else if (SpellingIndex == Pragma_unroll_and_jam)
4219
1
      return "#pragma unroll_and_jam" +
4220
1
        (option == UnrollAndJamCount ? getValueString(Policy) : 
""0
);
4221
37
4222
37
    assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
4223
37
    return getOptionName(option) + getValueString(Policy);
4224
37
  }
4225
  
4226
4227
1.22k
  static bool classof(const Attr *A) { return A->getKind() == attr::LoopHint; }
4228
};
4229
4230
class MSABIAttr : public InheritableAttr {
4231
public:
4232
  static MSABIAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4233
    auto *A = new (Ctx) MSABIAttr(Loc, Ctx, 0);
4234
    A->setImplicit(true);
4235
    return A;
4236
  }
4237
4238
  MSABIAttr(SourceRange R, ASTContext &Ctx
4239
              , unsigned SI
4240
             )
4241
    : InheritableAttr(attr::MSABI, R, SI, false, false)
4242
36
  {
4243
36
  }
4244
4245
  MSABIAttr *clone(ASTContext &C) const;
4246
  void printPretty(raw_ostream &OS,
4247
                   const PrintingPolicy &Policy) const;
4248
  const char *getSpelling() const;
4249
4250
4251
318
  static bool classof(const Attr *A) { return A->getKind() == attr::MSABI; }
4252
};
4253
4254
class MSInheritanceAttr : public InheritableAttr {
4255
bool bestCase;
4256
4257
public:
4258
  enum Spelling {
4259
    Keyword_single_inheritance = 0,
4260
    Keyword_multiple_inheritance = 1,
4261
    Keyword_virtual_inheritance = 2,
4262
    Keyword_unspecified_inheritance = 3
4263
  };
4264
4265
557
  static MSInheritanceAttr *CreateImplicit(ASTContext &Ctx, Spelling S, bool BestCase, SourceRange Loc = SourceRange()) {
4266
557
    auto *A = new (Ctx) MSInheritanceAttr(Loc, Ctx, BestCase, S);
4267
557
    A->setImplicit(true);
4268
557
    return A;
4269
557
  }
4270
4271
0
  static MSInheritanceAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
4272
0
    auto *A = new (Ctx) MSInheritanceAttr(Loc, Ctx, S);
4273
0
    A->setImplicit(true);
4274
0
    return A;
4275
0
  }
4276
4277
  MSInheritanceAttr(SourceRange R, ASTContext &Ctx
4278
              , bool BestCase
4279
              , unsigned SI
4280
             )
4281
    : InheritableAttr(attr::MSInheritance, R, SI, false, false)
4282
              , bestCase(BestCase)
4283
632
  {
4284
632
  }
4285
4286
  MSInheritanceAttr(SourceRange R, ASTContext &Ctx
4287
              , unsigned SI
4288
             )
4289
    : InheritableAttr(attr::MSInheritance, R, SI, false, false)
4290
              , bestCase()
4291
  {
4292
  }
4293
4294
  MSInheritanceAttr *clone(ASTContext &C) const;
4295
  void printPretty(raw_ostream &OS,
4296
                   const PrintingPolicy &Policy) const;
4297
  const char *getSpelling() const;
4298
2.51k
  Spelling getSemanticSpelling() const {
4299
2.51k
  switch (SpellingListIndex) {
4300
2.51k
    
default: 0
llvm_unreachable0
("Unknown spelling list index");
4301
2.51k
    
case 0: return Keyword_single_inheritance1.75k
;
4302
2.51k
    
case 1: return Keyword_multiple_inheritance200
;
4303
2.51k
    
case 2: return Keyword_virtual_inheritance147
;
4304
2.51k
    
case 3: return Keyword_unspecified_inheritance414
;
4305
2.51k
  }
4306
2.51k
  }
4307
74
  bool getBestCase() const {
4308
74
    return bestCase;
4309
74
  }
4310
4311
  static const bool DefaultBestCase = true;
4312
4313
4314
1.51k
  static bool hasVBPtrOffsetField(Spelling Inheritance) {
4315
1.51k
    return Inheritance == Keyword_unspecified_inheritance;
4316
1.51k
  }
4317
4318
  // Only member pointers to functions need a this adjustment, since it can be
4319
  // combined with the field offset for data pointers.
4320
1.41k
  static bool hasNVOffsetField(bool IsMemberFunction, Spelling Inheritance) {
4321
1.41k
    return IsMemberFunction && 
Inheritance >= Keyword_multiple_inheritance1.14k
;
4322
1.41k
  }
4323
4324
1.56k
  static bool hasVBTableOffsetField(Spelling Inheritance) {
4325
1.56k
    return Inheritance >= Keyword_virtual_inheritance;
4326
1.56k
  }
4327
4328
  static bool hasOnlyOneField(bool IsMemberFunction,
4329
626
                              Spelling Inheritance) {
4330
626
    if (IsMemberFunction)
4331
493
      return Inheritance <= Keyword_single_inheritance;
4332
133
    return Inheritance <= Keyword_multiple_inheritance;
4333
133
  }
4334
  
4335
4336
1.03M
  static bool classof(const Attr *A) { return A->getKind() == attr::MSInheritance; }
4337
};
4338
4339
class MSNoVTableAttr : public InheritableAttr {
4340
public:
4341
  static MSNoVTableAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4342
    auto *A = new (Ctx) MSNoVTableAttr(Loc, Ctx, 0);
4343
    A->setImplicit(true);
4344
    return A;
4345
  }
4346
4347
  MSNoVTableAttr(SourceRange R, ASTContext &Ctx
4348
              , unsigned SI
4349
             )
4350
    : InheritableAttr(attr::MSNoVTable, R, SI, false, false)
4351
6
  {
4352
6
  }
4353
4354
  MSNoVTableAttr *clone(ASTContext &C) const;
4355
  void printPretty(raw_ostream &OS,
4356
                   const PrintingPolicy &Policy) const;
4357
  const char *getSpelling() const;
4358
4359
4360
170
  static bool classof(const Attr *A) { return A->getKind() == attr::MSNoVTable; }
4361
};
4362
4363
class MSP430InterruptAttr : public InheritableAttr {
4364
unsigned number;
4365
4366
public:
4367
  static MSP430InterruptAttr *CreateImplicit(ASTContext &Ctx, unsigned Number, SourceRange Loc = SourceRange()) {
4368
    auto *A = new (Ctx) MSP430InterruptAttr(Loc, Ctx, Number, 0);
4369
    A->setImplicit(true);
4370
    return A;
4371
  }
4372
4373
  MSP430InterruptAttr(SourceRange R, ASTContext &Ctx
4374
              , unsigned Number
4375
              , unsigned SI
4376
             )
4377
    : InheritableAttr(attr::MSP430Interrupt, R, SI, false, false)
4378
              , number(Number)
4379
2
  {
4380
2
  }
4381
4382
  MSP430InterruptAttr *clone(ASTContext &C) const;
4383
  void printPretty(raw_ostream &OS,
4384
                   const PrintingPolicy &Policy) const;
4385
  const char *getSpelling() const;
4386
1
  unsigned getNumber() const {
4387
1
    return number;
4388
1
  }
4389
4390
4391
4392
0
  static bool classof(const Attr *A) { return A->getKind() == attr::MSP430Interrupt; }
4393
};
4394
4395
class MSStructAttr : public InheritableAttr {
4396
public:
4397
21
  static MSStructAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4398
21
    auto *A = new (Ctx) MSStructAttr(Loc, Ctx, 0);
4399
21
    A->setImplicit(true);
4400
21
    return A;
4401
21
  }
4402
4403
  MSStructAttr(SourceRange R, ASTContext &Ctx
4404
              , unsigned SI
4405
             )
4406
    : InheritableAttr(attr::MSStruct, R, SI, false, false)
4407
96
  {
4408
96
  }
4409
4410
  MSStructAttr *clone(ASTContext &C) const;
4411
  void printPretty(raw_ostream &OS,
4412
                   const PrintingPolicy &Policy) const;
4413
  const char *getSpelling() const;
4414
4415
4416
268k
  static bool classof(const Attr *A) { return A->getKind() == attr::MSStruct; }
4417
};
4418
4419
class MSVtorDispAttr : public InheritableAttr {
4420
unsigned vdm;
4421
4422
public:
4423
29
  static MSVtorDispAttr *CreateImplicit(ASTContext &Ctx, unsigned Vdm, SourceRange Loc = SourceRange()) {
4424
29
    auto *A = new (Ctx) MSVtorDispAttr(Loc, Ctx, Vdm, 0);
4425
29
    A->setImplicit(true);
4426
29
    return A;
4427
29
  }
4428
4429
  MSVtorDispAttr(SourceRange R, ASTContext &Ctx
4430
              , unsigned Vdm
4431
              , unsigned SI
4432
             )
4433
    : InheritableAttr(attr::MSVtorDisp, R, SI, false, false)
4434
              , vdm(Vdm)
4435
31
  {
4436
31
  }
4437
4438
  MSVtorDispAttr *clone(ASTContext &C) const;
4439
  void printPretty(raw_ostream &OS,
4440
                   const PrintingPolicy &Policy) const;
4441
  const char *getSpelling() const;
4442
0
  unsigned getVdm() const {
4443
0
    return vdm;
4444
0
  }
4445
4446
4447
  enum Mode {
4448
    Never,
4449
    ForVBaseOverride,
4450
    ForVFTable
4451
  };
4452
4453
26
  Mode getVtorDispMode() const { return Mode(vdm); }
4454
  
4455
4456
170
  static bool classof(const Attr *A) { return A->getKind() == attr::MSVtorDisp; }
4457
};
4458
4459
class MaxFieldAlignmentAttr : public InheritableAttr {
4460
unsigned alignment;
4461
4462
public:
4463
44.7k
  static MaxFieldAlignmentAttr *CreateImplicit(ASTContext &Ctx, unsigned Alignment, SourceRange Loc = SourceRange()) {
4464
44.7k
    auto *A = new (Ctx) MaxFieldAlignmentAttr(Loc, Ctx, Alignment, 0);
4465
44.7k
    A->setImplicit(true);
4466
44.7k
    return A;
4467
44.7k
  }
4468
4469
  MaxFieldAlignmentAttr(SourceRange R, ASTContext &Ctx
4470
              , unsigned Alignment
4471
              , unsigned SI
4472
             )
4473
    : InheritableAttr(attr::MaxFieldAlignment, R, SI, false, false)
4474
              , alignment(Alignment)
4475
44.7k
  {
4476
44.7k
  }
4477
4478
  MaxFieldAlignmentAttr *clone(ASTContext &C) const;
4479
  void printPretty(raw_ostream &OS,
4480
                   const PrintingPolicy &Policy) const;
4481
  const char *getSpelling() const;
4482
1.28k
  unsigned getAlignment() const {
4483
1.28k
    return alignment;
4484
1.28k
  }
4485
4486
4487
4488
22.6k
  static bool classof(const Attr *A) { return A->getKind() == attr::MaxFieldAlignment; }
4489
};
4490
4491
class MayAliasAttr : public InheritableAttr {
4492
public:
4493
  static MayAliasAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4494
    auto *A = new (Ctx) MayAliasAttr(Loc, Ctx, 0);
4495
    A->setImplicit(true);
4496
    return A;
4497
  }
4498
4499
  MayAliasAttr(SourceRange R, ASTContext &Ctx
4500
              , unsigned SI
4501
             )
4502
    : InheritableAttr(attr::MayAlias, R, SI, false, false)
4503
10.3k
  {
4504
10.3k
  }
4505
4506
  MayAliasAttr *clone(ASTContext &C) const;
4507
  void printPretty(raw_ostream &OS,
4508
                   const PrintingPolicy &Policy) const;
4509
  const char *getSpelling() const;
4510
4511
4512
81.5k
  static bool classof(const Attr *A) { return A->getKind() == attr::MayAlias; }
4513
};
4514
4515
class MicroMipsAttr : public InheritableAttr {
4516
public:
4517
  static MicroMipsAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4518
    auto *A = new (Ctx) MicroMipsAttr(Loc, Ctx, 0);
4519
    A->setImplicit(true);
4520
    return A;
4521
  }
4522
4523
  MicroMipsAttr(SourceRange R, ASTContext &Ctx
4524
              , unsigned SI
4525
             )
4526
    : InheritableAttr(attr::MicroMips, R, SI, false, false)
4527
3
  {
4528
3
  }
4529
4530
  MicroMipsAttr *clone(ASTContext &C) const;
4531
  void printPretty(raw_ostream &OS,
4532
                   const PrintingPolicy &Policy) const;
4533
  const char *getSpelling() const;
4534
4535
4536
66
  static bool classof(const Attr *A) { return A->getKind() == attr::MicroMips; }
4537
};
4538
4539
class MinSizeAttr : public InheritableAttr {
4540
public:
4541
  static MinSizeAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4542
    auto *A = new (Ctx) MinSizeAttr(Loc, Ctx, 0);
4543
    A->setImplicit(true);
4544
    return A;
4545
  }
4546
4547
  MinSizeAttr(SourceRange R, ASTContext &Ctx
4548
              , unsigned SI
4549
             )
4550
    : InheritableAttr(attr::MinSize, R, SI, false, false)
4551
35
  {
4552
35
  }
4553
4554
  MinSizeAttr *clone(ASTContext &C) const;
4555
  void printPretty(raw_ostream &OS,
4556
                   const PrintingPolicy &Policy) const;
4557
  const char *getSpelling() const;
4558
4559
4560
626k
  static bool classof(const Attr *A) { return A->getKind() == attr::MinSize; }
4561
};
4562
4563
class MinVectorWidthAttr : public InheritableAttr {
4564
unsigned vectorWidth;
4565
4566
public:
4567
  static MinVectorWidthAttr *CreateImplicit(ASTContext &Ctx, unsigned VectorWidth, SourceRange Loc = SourceRange()) {
4568
    auto *A = new (Ctx) MinVectorWidthAttr(Loc, Ctx, VectorWidth, 0);
4569
    A->setImplicit(true);
4570
    return A;
4571
  }
4572
4573
  MinVectorWidthAttr(SourceRange R, ASTContext &Ctx
4574
              , unsigned VectorWidth
4575
              , unsigned SI
4576
             )
4577
    : InheritableAttr(attr::MinVectorWidth, R, SI, false, false)
4578
              , vectorWidth(VectorWidth)
4579
524k
  {
4580
524k
  }
4581
4582
  MinVectorWidthAttr *clone(ASTContext &C) const;
4583
  void printPretty(raw_ostream &OS,
4584
                   const PrintingPolicy &Policy) const;
4585
  const char *getSpelling() const;
4586
20.7k
  unsigned getVectorWidth() const {
4587
20.7k
    return vectorWidth;
4588
20.7k
  }
4589
4590
4591
4592
1.74M
  static bool classof(const Attr *A) { return A->getKind() == attr::MinVectorWidth; }
4593
};
4594
4595
class Mips16Attr : public InheritableAttr {
4596
public:
4597
  static Mips16Attr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4598
    auto *A = new (Ctx) Mips16Attr(Loc, Ctx, 0);
4599
    A->setImplicit(true);
4600
    return A;
4601
  }
4602
4603
  Mips16Attr(SourceRange R, ASTContext &Ctx
4604
              , unsigned SI
4605
             )
4606
    : InheritableAttr(attr::Mips16, R, SI, false, false)
4607
9
  {
4608
9
  }
4609
4610
  Mips16Attr *clone(ASTContext &C) const;
4611
  void printPretty(raw_ostream &OS,
4612
                   const PrintingPolicy &Policy) const;
4613
  const char *getSpelling() const;
4614
4615
4616
70
  static bool classof(const Attr *A) { return A->getKind() == attr::Mips16; }
4617
};
4618
4619
class MipsInterruptAttr : public InheritableAttr {
4620
public:
4621
  enum InterruptType {
4622
    sw0,
4623
    sw1,
4624
    hw0,
4625
    hw1,
4626
    hw2,
4627
    hw3,
4628
    hw4,
4629
    hw5,
4630
    eic
4631
  };
4632
private:
4633
  InterruptType interrupt;
4634
4635
public:
4636
  static MipsInterruptAttr *CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, SourceRange Loc = SourceRange()) {
4637
    auto *A = new (Ctx) MipsInterruptAttr(Loc, Ctx, Interrupt, 0);
4638
    A->setImplicit(true);
4639
    return A;
4640
  }
4641
4642
  MipsInterruptAttr(SourceRange R, ASTContext &Ctx
4643
              , InterruptType Interrupt
4644
              , unsigned SI
4645
             )
4646
    : InheritableAttr(attr::MipsInterrupt, R, SI, false, false)
4647
              , interrupt(Interrupt)
4648
20
  {
4649
20
  }
4650
4651
  MipsInterruptAttr *clone(ASTContext &C) const;
4652
  void printPretty(raw_ostream &OS,
4653
                   const PrintingPolicy &Policy) const;
4654
  const char *getSpelling() const;
4655
9
  InterruptType getInterrupt() const {
4656
9
    return interrupt;
4657
9
  }
4658
4659
21
  static bool ConvertStrToInterruptType(StringRef Val, InterruptType &Out) {
4660
21
    Optional<InterruptType> R = llvm::StringSwitch<Optional<InterruptType>>(Val)
4661
21
      .Case("vector=sw0", MipsInterruptAttr::sw0)
4662
21
      .Case("vector=sw1", MipsInterruptAttr::sw1)
4663
21
      .Case("vector=hw0", MipsInterruptAttr::hw0)
4664
21
      .Case("vector=hw1", MipsInterruptAttr::hw1)
4665
21
      .Case("vector=hw2", MipsInterruptAttr::hw2)
4666
21
      .Case("vector=hw3", MipsInterruptAttr::hw3)
4667
21
      .Case("vector=hw4", MipsInterruptAttr::hw4)
4668
21
      .Case("vector=hw5", MipsInterruptAttr::hw5)
4669
21
      .Case("eic", MipsInterruptAttr::eic)
4670
21
      .Case("", MipsInterruptAttr::eic)
4671
21
      .Default(Optional<InterruptType>());
4672
21
    if (R) {
4673
20
      Out = *R;
4674
20
      return true;
4675
20
    }
4676
1
    return false;
4677
1
  }
4678
4679
0
  static const char *ConvertInterruptTypeToStr(InterruptType Val) {
4680
0
    switch(Val) {
4681
0
    case MipsInterruptAttr::sw0: return "vector=sw0";
4682
0
    case MipsInterruptAttr::sw1: return "vector=sw1";
4683
0
    case MipsInterruptAttr::hw0: return "vector=hw0";
4684
0
    case MipsInterruptAttr::hw1: return "vector=hw1";
4685
0
    case MipsInterruptAttr::hw2: return "vector=hw2";
4686
0
    case MipsInterruptAttr::hw3: return "vector=hw3";
4687
0
    case MipsInterruptAttr::hw4: return "vector=hw4";
4688
0
    case MipsInterruptAttr::hw5: return "vector=hw5";
4689
0
    case MipsInterruptAttr::eic: return "eic";
4690
0
    }
4691
0
    llvm_unreachable("No enumerator with that value");
4692
0
  }
4693
4694
4695
75
  static bool classof(const Attr *A) { return A->getKind() == attr::MipsInterrupt; }
4696
};
4697
4698
class MipsLongCallAttr : public InheritableAttr {
4699
public:
4700
  enum Spelling {
4701
    GNU_long_call = 0,
4702
    CXX11_gnu_long_call = 1,
4703
    GNU_far = 2,
4704
    CXX11_gnu_far = 3
4705
  };
4706
4707
  static MipsLongCallAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
4708
    auto *A = new (Ctx) MipsLongCallAttr(Loc, Ctx, S);
4709
    A->setImplicit(true);
4710
    return A;
4711
  }
4712
4713
  MipsLongCallAttr(SourceRange R, ASTContext &Ctx
4714
              , unsigned SI
4715
             )
4716
    : InheritableAttr(attr::MipsLongCall, R, SI, false, false)
4717
14
  {
4718
14
  }
4719
4720
  MipsLongCallAttr *clone(ASTContext &C) const;
4721
  void printPretty(raw_ostream &OS,
4722
                   const PrintingPolicy &Policy) const;
4723
  const char *getSpelling() const;
4724
  Spelling getSemanticSpelling() const {
4725
  switch (SpellingListIndex) {
4726
    default: llvm_unreachable("Unknown spelling list index");
4727
    case 0: return GNU_long_call;
4728
    case 1: return CXX11_gnu_long_call;
4729
    case 2: return GNU_far;
4730
    case 3: return CXX11_gnu_far;
4731
  }
4732
  }
4733
4734
4735
143
  static bool classof(const Attr *A) { return A->getKind() == attr::MipsLongCall; }
4736
};
4737
4738
class MipsShortCallAttr : public InheritableAttr {
4739
public:
4740
  enum Spelling {
4741
    GNU_short_call = 0,
4742
    CXX11_gnu_short_call = 1,
4743
    GNU_near = 2,
4744
    CXX11_gnu_near = 3
4745
  };
4746
4747
  static MipsShortCallAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
4748
    auto *A = new (Ctx) MipsShortCallAttr(Loc, Ctx, S);
4749
    A->setImplicit(true);
4750
    return A;
4751
  }
4752
4753
  MipsShortCallAttr(SourceRange R, ASTContext &Ctx
4754
              , unsigned SI
4755
             )
4756
    : InheritableAttr(attr::MipsShortCall, R, SI, false, false)
4757
14
  {
4758
14
  }
4759
4760
  MipsShortCallAttr *clone(ASTContext &C) const;
4761
  void printPretty(raw_ostream &OS,
4762
                   const PrintingPolicy &Policy) const;
4763
  const char *getSpelling() const;
4764
  Spelling getSemanticSpelling() const {
4765
  switch (SpellingListIndex) {
4766
    default: llvm_unreachable("Unknown spelling list index");
4767
    case 0: return GNU_short_call;
4768
    case 1: return CXX11_gnu_short_call;
4769
    case 2: return GNU_near;
4770
    case 3: return CXX11_gnu_near;
4771
  }
4772
  }
4773
4774
4775
137
  static bool classof(const Attr *A) { return A->getKind() == attr::MipsShortCall; }
4776
};
4777
4778
class ModeAttr : public Attr {
4779
IdentifierInfo * mode;
4780
4781
public:
4782
  static ModeAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * Mode, SourceRange Loc = SourceRange()) {
4783
    auto *A = new (Ctx) ModeAttr(Loc, Ctx, Mode, 0);
4784
    A->setImplicit(true);
4785
    return A;
4786
  }
4787
4788
  ModeAttr(SourceRange R, ASTContext &Ctx
4789
              , IdentifierInfo * Mode
4790
              , unsigned SI
4791
             )
4792
    : Attr(attr::Mode, R, SI, false)
4793
              , mode(Mode)
4794
2.41k
  {
4795
2.41k
  }
4796
4797
  ModeAttr *clone(ASTContext &C) const;
4798
  void printPretty(raw_ostream &OS,
4799
                   const PrintingPolicy &Policy) const;
4800
  const char *getSpelling() const;
4801
90
  IdentifierInfo * getMode() const {
4802
90
    return mode;
4803
90
  }
4804
4805
4806
4807
2.18M
  static bool classof(const Attr *A) { return A->getKind() == attr::Mode; }
4808
};
4809
4810
class NSConsumedAttr : public InheritableParamAttr {
4811
public:
4812
163
  static NSConsumedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4813
163
    auto *A = new (Ctx) NSConsumedAttr(Loc, Ctx, 0);
4814
163
    A->setImplicit(true);
4815
163
    return A;
4816
163
  }
4817
4818
  NSConsumedAttr(SourceRange R, ASTContext &Ctx
4819
              , unsigned SI
4820
             )
4821
    : InheritableParamAttr(attr::NSConsumed, R, SI, false, false)
4822
384
  {
4823
384
  }
4824
4825
  NSConsumedAttr *clone(ASTContext &C) const;
4826
  void printPretty(raw_ostream &OS,
4827
                   const PrintingPolicy &Policy) const;
4828
  const char *getSpelling() const;
4829
4830
4831
2.18M
  static bool classof(const Attr *A) { return A->getKind() == attr::NSConsumed; }
4832
};
4833
4834
class NSConsumesSelfAttr : public InheritableAttr {
4835
public:
4836
513
  static NSConsumesSelfAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4837
513
    auto *A = new (Ctx) NSConsumesSelfAttr(Loc, Ctx, 0);
4838
513
    A->setImplicit(true);
4839
513
    return A;
4840
513
  }
4841
4842
  NSConsumesSelfAttr(SourceRange R, ASTContext &Ctx
4843
              , unsigned SI
4844
             )
4845
    : InheritableAttr(attr::NSConsumesSelf, R, SI, false, false)
4846
693
  {
4847
693
  }
4848
4849
  NSConsumesSelfAttr *clone(ASTContext &C) const;
4850
  void printPretty(raw_ostream &OS,
4851
                   const PrintingPolicy &Policy) const;
4852
  const char *getSpelling() const;
4853
4854
4855
1.05k
  static bool classof(const Attr *A) { return A->getKind() == attr::NSConsumesSelf; }
4856
};
4857
4858
class NSReturnsAutoreleasedAttr : public InheritableAttr {
4859
public:
4860
  static NSReturnsAutoreleasedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4861
    auto *A = new (Ctx) NSReturnsAutoreleasedAttr(Loc, Ctx, 0);
4862
    A->setImplicit(true);
4863
    return A;
4864
  }
4865
4866
  NSReturnsAutoreleasedAttr(SourceRange R, ASTContext &Ctx
4867
              , unsigned SI
4868
             )
4869
    : InheritableAttr(attr::NSReturnsAutoreleased, R, SI, false, false)
4870
5
  {
4871
5
  }
4872
4873
  NSReturnsAutoreleasedAttr *clone(ASTContext &C) const;
4874
  void printPretty(raw_ostream &OS,
4875
                   const PrintingPolicy &Policy) const;
4876
  const char *getSpelling() const;
4877
4878
4879
44
  static bool classof(const Attr *A) { return A->getKind() == attr::NSReturnsAutoreleased; }
4880
};
4881
4882
class NSReturnsNotRetainedAttr : public InheritableAttr {
4883
public:
4884
3
  static NSReturnsNotRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4885
3
    auto *A = new (Ctx) NSReturnsNotRetainedAttr(Loc, Ctx, 0);
4886
3
    A->setImplicit(true);
4887
3
    return A;
4888
3
  }
4889
4890
  NSReturnsNotRetainedAttr(SourceRange R, ASTContext &Ctx
4891
              , unsigned SI
4892
             )
4893
    : InheritableAttr(attr::NSReturnsNotRetained, R, SI, false, false)
4894
120
  {
4895
120
  }
4896
4897
  NSReturnsNotRetainedAttr *clone(ASTContext &C) const;
4898
  void printPretty(raw_ostream &OS,
4899
                   const PrintingPolicy &Policy) const;
4900
  const char *getSpelling() const;
4901
4902
4903
32.5k
  static bool classof(const Attr *A) { return A->getKind() == attr::NSReturnsNotRetained; }
4904
};
4905
4906
class NSReturnsRetainedAttr : public InheritableAttr {
4907
public:
4908
906
  static NSReturnsRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4909
906
    auto *A = new (Ctx) NSReturnsRetainedAttr(Loc, Ctx, 0);
4910
906
    A->setImplicit(true);
4911
906
    return A;
4912
906
  }
4913
4914
  NSReturnsRetainedAttr(SourceRange R, ASTContext &Ctx
4915
              , unsigned SI
4916
             )
4917
    : InheritableAttr(attr::NSReturnsRetained, R, SI, false, false)
4918
2.77k
  {
4919
2.77k
  }
4920
4921
  NSReturnsRetainedAttr *clone(ASTContext &C) const;
4922
  void printPretty(raw_ostream &OS,
4923
                   const PrintingPolicy &Policy) const;
4924
  const char *getSpelling() const;
4925
4926
4927
18.7k
  static bool classof(const Attr *A) { return A->getKind() == attr::NSReturnsRetained; }
4928
};
4929
4930
class NakedAttr : public InheritableAttr {
4931
public:
4932
  static NakedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4933
    auto *A = new (Ctx) NakedAttr(Loc, Ctx, 0);
4934
    A->setImplicit(true);
4935
    return A;
4936
  }
4937
4938
  NakedAttr(SourceRange R, ASTContext &Ctx
4939
              , unsigned SI
4940
             )
4941
    : InheritableAttr(attr::Naked, R, SI, false, false)
4942
30
  {
4943
30
  }
4944
4945
  NakedAttr *clone(ASTContext &C) const;
4946
  void printPretty(raw_ostream &OS,
4947
                   const PrintingPolicy &Policy) const;
4948
  const char *getSpelling() const;
4949
4950
4951
10.1M
  static bool classof(const Attr *A) { return A->getKind() == attr::Naked; }
4952
};
4953
4954
class NoAliasAttr : public InheritableAttr {
4955
public:
4956
  static NoAliasAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4957
    auto *A = new (Ctx) NoAliasAttr(Loc, Ctx, 0);
4958
    A->setImplicit(true);
4959
    return A;
4960
  }
4961
4962
  NoAliasAttr(SourceRange R, ASTContext &Ctx
4963
              , unsigned SI
4964
             )
4965
    : InheritableAttr(attr::NoAlias, R, SI, false, false)
4966
2
  {
4967
2
  }
4968
4969
  NoAliasAttr *clone(ASTContext &C) const;
4970
  void printPretty(raw_ostream &OS,
4971
                   const PrintingPolicy &Policy) const;
4972
  const char *getSpelling() const;
4973
4974
4975
521k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoAlias; }
4976
};
4977
4978
class NoCommonAttr : public InheritableAttr {
4979
public:
4980
  static NoCommonAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4981
    auto *A = new (Ctx) NoCommonAttr(Loc, Ctx, 0);
4982
    A->setImplicit(true);
4983
    return A;
4984
  }
4985
4986
  NoCommonAttr(SourceRange R, ASTContext &Ctx
4987
              , unsigned SI
4988
             )
4989
    : InheritableAttr(attr::NoCommon, R, SI, false, false)
4990
4
  {
4991
4
  }
4992
4993
  NoCommonAttr *clone(ASTContext &C) const;
4994
  void printPretty(raw_ostream &OS,
4995
                   const PrintingPolicy &Policy) const;
4996
  const char *getSpelling() const;
4997
4998
4999
854
  static bool classof(const Attr *A) { return A->getKind() == attr::NoCommon; }
5000
};
5001
5002
class NoDebugAttr : public InheritableAttr {
5003
public:
5004
  static NoDebugAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5005
    auto *A = new (Ctx) NoDebugAttr(Loc, Ctx, 0);
5006
    A->setImplicit(true);
5007
    return A;
5008
  }
5009
5010
  NoDebugAttr(SourceRange R, ASTContext &Ctx
5011
              , unsigned SI
5012
             )
5013
    : InheritableAttr(attr::NoDebug, R, SI, false, false)
5014
764k
  {
5015
764k
  }
5016
5017
  NoDebugAttr *clone(ASTContext &C) const;
5018
  void printPretty(raw_ostream &OS,
5019
                   const PrintingPolicy &Policy) const;
5020
  const char *getSpelling() const;
5021
5022
5023
134k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoDebug; }
5024
};
5025
5026
class NoDerefAttr : public TypeAttr {
5027
public:
5028
  static NoDerefAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5029
    auto *A = new (Ctx) NoDerefAttr(Loc, Ctx, 0);
5030
    A->setImplicit(true);
5031
    return A;
5032
  }
5033
5034
  NoDerefAttr(SourceRange R, ASTContext &Ctx
5035
              , unsigned SI
5036
             )
5037
    : TypeAttr(attr::NoDeref, R, SI, false)
5038
65
  {
5039
65
  }
5040
5041
  NoDerefAttr *clone(ASTContext &C) const;
5042
  void printPretty(raw_ostream &OS,
5043
                   const PrintingPolicy &Policy) const;
5044
  const char *getSpelling() const;
5045
5046
5047
  static bool classof(const Attr *A) { return A->getKind() == attr::NoDeref; }
5048
};
5049
5050
class NoDestroyAttr : public InheritableAttr {
5051
public:
5052
  static NoDestroyAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5053
    auto *A = new (Ctx) NoDestroyAttr(Loc, Ctx, 0);
5054
    A->setImplicit(true);
5055
    return A;
5056
  }
5057
5058
  NoDestroyAttr(SourceRange R, ASTContext &Ctx
5059
              , unsigned SI
5060
             )
5061
    : InheritableAttr(attr::NoDestroy, R, SI, false, false)
5062
12
  {
5063
12
  }
5064
5065
  NoDestroyAttr *clone(ASTContext &C) const;
5066
  void printPretty(raw_ostream &OS,
5067
                   const PrintingPolicy &Policy) const;
5068
  const char *getSpelling() const;
5069
5070
5071
2.21k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoDestroy; }
5072
};
5073
5074
class NoDuplicateAttr : public InheritableAttr {
5075
public:
5076
  static NoDuplicateAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5077
    auto *A = new (Ctx) NoDuplicateAttr(Loc, Ctx, 0);
5078
    A->setImplicit(true);
5079
    return A;
5080
  }
5081
5082
  NoDuplicateAttr(SourceRange R, ASTContext &Ctx
5083
              , unsigned SI
5084
             )
5085
    : InheritableAttr(attr::NoDuplicate, R, SI, false, false)
5086
5
  {
5087
5
  }
5088
5089
  NoDuplicateAttr *clone(ASTContext &C) const;
5090
  void printPretty(raw_ostream &OS,
5091
                   const PrintingPolicy &Policy) const;
5092
  const char *getSpelling() const;
5093
5094
5095
669k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoDuplicate; }
5096
};
5097
5098
class NoEscapeAttr : public Attr {
5099
public:
5100
  static NoEscapeAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5101
    auto *A = new (Ctx) NoEscapeAttr(Loc, Ctx, 0);
5102
    A->setImplicit(true);
5103
    return A;
5104
  }
5105
5106
  NoEscapeAttr(SourceRange R, ASTContext &Ctx
5107
              , unsigned SI
5108
             )
5109
    : Attr(attr::NoEscape, R, SI, false)
5110
1.68k
  {
5111
1.68k
  }
5112
5113
  NoEscapeAttr *clone(ASTContext &C) const;
5114
  void printPretty(raw_ostream &OS,
5115
                   const PrintingPolicy &Policy) const;
5116
  const char *getSpelling() const;
5117
5118
5119
9.78k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoEscape; }
5120
};
5121
5122
class NoInlineAttr : public InheritableAttr {
5123
public:
5124
22
  static NoInlineAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5125
22
    auto *A = new (Ctx) NoInlineAttr(Loc, Ctx, 0);
5126
22
    A->setImplicit(true);
5127
22
    return A;
5128
22
  }
5129
5130
  NoInlineAttr(SourceRange R, ASTContext &Ctx
5131
              , unsigned SI
5132
             )
5133
    : InheritableAttr(attr::NoInline, R, SI, false, false)
5134
15.0k
  {
5135
15.0k
  }
5136
5137
  NoInlineAttr *clone(ASTContext &C) const;
5138
  void printPretty(raw_ostream &OS,
5139
                   const PrintingPolicy &Policy) const;
5140
  const char *getSpelling() const;
5141
5142
5143
141k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoInline; }
5144
};
5145
5146
class NoInstrumentFunctionAttr : public InheritableAttr {
5147
public:
5148
  static NoInstrumentFunctionAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5149
    auto *A = new (Ctx) NoInstrumentFunctionAttr(Loc, Ctx, 0);
5150
    A->setImplicit(true);
5151
    return A;
5152
  }
5153
5154
  NoInstrumentFunctionAttr(SourceRange R, ASTContext &Ctx
5155
              , unsigned SI
5156
             )
5157
    : InheritableAttr(attr::NoInstrumentFunction, R, SI, false, false)
5158
30
  {
5159
30
  }
5160
5161
  NoInstrumentFunctionAttr *clone(ASTContext &C) const;
5162
  void printPretty(raw_ostream &OS,
5163
                   const PrintingPolicy &Policy) const;
5164
  const char *getSpelling() const;
5165
5166
5167
27
  static bool classof(const Attr *A) { return A->getKind() == attr::NoInstrumentFunction; }
5168
};
5169
5170
class NoMicroMipsAttr : public InheritableAttr {
5171
public:
5172
  static NoMicroMipsAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5173
    auto *A = new (Ctx) NoMicroMipsAttr(Loc, Ctx, 0);
5174
    A->setImplicit(true);
5175
    return A;
5176
  }
5177
5178
  NoMicroMipsAttr(SourceRange R, ASTContext &Ctx
5179
              , unsigned SI
5180
             )
5181
    : InheritableAttr(attr::NoMicroMips, R, SI, false, false)
5182
2
  {
5183
2
  }
5184
5185
  NoMicroMipsAttr *clone(ASTContext &C) const;
5186
  void printPretty(raw_ostream &OS,
5187
                   const PrintingPolicy &Policy) const;
5188
  const char *getSpelling() const;
5189
5190
5191
61
  static bool classof(const Attr *A) { return A->getKind() == attr::NoMicroMips; }
5192
};
5193
5194
class NoMips16Attr : public InheritableAttr {
5195
public:
5196
  static NoMips16Attr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5197
    auto *A = new (Ctx) NoMips16Attr(Loc, Ctx, 0);
5198
    A->setImplicit(true);
5199
    return A;
5200
  }
5201
5202
  NoMips16Attr(SourceRange R, ASTContext &Ctx
5203
              , unsigned SI
5204
             )
5205
    : InheritableAttr(attr::NoMips16, R, SI, false, false)
5206
6
  {
5207
6
  }
5208
5209
  NoMips16Attr *clone(ASTContext &C) const;
5210
  void printPretty(raw_ostream &OS,
5211
                   const PrintingPolicy &Policy) const;
5212
  const char *getSpelling() const;
5213
5214
5215
61
  static bool classof(const Attr *A) { return A->getKind() == attr::NoMips16; }
5216
};
5217
5218
class NoReturnAttr : public InheritableAttr {
5219
public:
5220
  static NoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5221
    auto *A = new (Ctx) NoReturnAttr(Loc, Ctx, 0);
5222
    A->setImplicit(true);
5223
    return A;
5224
  }
5225
5226
  NoReturnAttr(SourceRange R, ASTContext &Ctx
5227
              , unsigned SI
5228
             )
5229
    : InheritableAttr(attr::NoReturn, R, SI, false, false)
5230
14
  {
5231
14
  }
5232
5233
  NoReturnAttr *clone(ASTContext &C) const;
5234
  void printPretty(raw_ostream &OS,
5235
                   const PrintingPolicy &Policy) const;
5236
  const char *getSpelling() const;
5237
5238
5239
5.71M
  static bool classof(const Attr *A) { return A->getKind() == attr::NoReturn; }
5240
};
5241
5242
class NoSanitizeAttr : public InheritableAttr {
5243
  unsigned sanitizers_Size;
5244
  StringRef *sanitizers_;
5245
5246
public:
5247
  static NoSanitizeAttr *CreateImplicit(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, SourceRange Loc = SourceRange()) {
5248
    auto *A = new (Ctx) NoSanitizeAttr(Loc, Ctx, Sanitizers, SanitizersSize, 0);
5249
    A->setImplicit(true);
5250
    return A;
5251
  }
5252
5253
  NoSanitizeAttr(SourceRange R, ASTContext &Ctx
5254
              , StringRef *Sanitizers, unsigned SanitizersSize
5255
              , unsigned SI
5256
             )
5257
    : InheritableAttr(attr::NoSanitize, R, SI, false, false)
5258
              , sanitizers_Size(SanitizersSize), sanitizers_(new (Ctx, 16) StringRef[sanitizers_Size])
5259
12.2k
  {
5260
24.4k
    for (size_t I = 0, E = sanitizers_Size; I != E;
5261
12.2k
         ++I) {
5262
12.2k
      StringRef Ref = Sanitizers[I];
5263
12.2k
      if (!Ref.empty()) {
5264
12.2k
        char *Mem = new (Ctx, 1) char[Ref.size()];
5265
12.2k
        std::memcpy(Mem, Ref.data(), Ref.size());
5266
12.2k
        sanitizers_[I] = StringRef(Mem, Ref.size());
5267
12.2k
      }
5268
12.2k
    }
5269
12.2k
  }
5270
5271
  NoSanitizeAttr(SourceRange R, ASTContext &Ctx
5272
              , unsigned SI
5273
             )
5274
    : InheritableAttr(attr::NoSanitize, R, SI, false, false)
5275
              , sanitizers_Size(0), sanitizers_(nullptr)
5276
  {
5277
  }
5278
5279
  NoSanitizeAttr *clone(ASTContext &C) const;
5280
  void printPretty(raw_ostream &OS,
5281
                   const PrintingPolicy &Policy) const;
5282
  const char *getSpelling() const;
5283
  typedef StringRef* sanitizers_iterator;
5284
1.10k
  sanitizers_iterator sanitizers_begin() const { return sanitizers_; }
5285
1.10k
  sanitizers_iterator sanitizers_end() const { return sanitizers_ + sanitizers_Size; }
5286
1
  unsigned sanitizers_size() const { return sanitizers_Size; }
5287
1.10k
  llvm::iterator_range<sanitizers_iterator> sanitizers() const { return llvm::make_range(sanitizers_begin(), sanitizers_end()); }
5288
5289
5290
5291
1.08k
    SanitizerMask getMask() const {
5292
1.08k
      SanitizerMask Mask = 0;
5293
1.08k
      for (auto SanitizerName : sanitizers()) {
5294
1.08k
        SanitizerMask ParsedMask =
5295
1.08k
            parseSanitizerValue(SanitizerName, /*AllowGroups=*/true);
5296
1.08k
        Mask |= expandSanitizerGroups(ParsedMask);
5297
1.08k
      }
5298
1.08k
      return Mask;
5299
1.08k
    }
5300
  
5301
5302
147k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoSanitize; }
5303
};
5304
5305
class NoSplitStackAttr : public InheritableAttr {
5306
public:
5307
  static NoSplitStackAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5308
    auto *A = new (Ctx) NoSplitStackAttr(Loc, Ctx, 0);
5309
    A->setImplicit(true);
5310
    return A;
5311
  }
5312
5313
  NoSplitStackAttr(SourceRange R, ASTContext &Ctx
5314
              , unsigned SI
5315
             )
5316
    : InheritableAttr(attr::NoSplitStack, R, SI, false, false)
5317
16
  {
5318
16
  }
5319
5320
  NoSplitStackAttr *clone(ASTContext &C) const;
5321
  void printPretty(raw_ostream &OS,
5322
                   const PrintingPolicy &Policy) const;
5323
  const char *getSpelling() const;
5324
5325
5326
4
  static bool classof(const Attr *A) { return A->getKind() == attr::NoSplitStack; }
5327
};
5328
5329
class NoStackProtectorAttr : public InheritableAttr {
5330
public:
5331
  static NoStackProtectorAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5332
    auto *A = new (Ctx) NoStackProtectorAttr(Loc, Ctx, 0);
5333
    A->setImplicit(true);
5334
    return A;
5335
  }
5336
5337
  NoStackProtectorAttr(SourceRange R, ASTContext &Ctx
5338
              , unsigned SI
5339
             )
5340
    : InheritableAttr(attr::NoStackProtector, R, SI, false, false)
5341
10
  {
5342
10
  }
5343
5344
  NoStackProtectorAttr *clone(ASTContext &C) const;
5345
  void printPretty(raw_ostream &OS,
5346
                   const PrintingPolicy &Policy) const;
5347
  const char *getSpelling() const;
5348
5349
5350
145k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoStackProtector; }
5351
};
5352
5353
class NoThreadSafetyAnalysisAttr : public InheritableAttr {
5354
public:
5355
  static NoThreadSafetyAnalysisAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5356
    auto *A = new (Ctx) NoThreadSafetyAnalysisAttr(Loc, Ctx, 0);
5357
    A->setImplicit(true);
5358
    return A;
5359
  }
5360
5361
  NoThreadSafetyAnalysisAttr(SourceRange R, ASTContext &Ctx
5362
              , unsigned SI
5363
             )
5364
    : InheritableAttr(attr::NoThreadSafetyAnalysis, R, SI, false, false)
5365
70
  {
5366
70
  }
5367
5368
  NoThreadSafetyAnalysisAttr *clone(ASTContext &C) const;
5369
  void printPretty(raw_ostream &OS,
5370
                   const PrintingPolicy &Policy) const;
5371
  const char *getSpelling() const;
5372
5373
5374
5.04k
  static bool classof(const Attr *A) { return A->getKind() == attr::NoThreadSafetyAnalysis; }
5375
};
5376
5377
class NoThrowAttr : public InheritableAttr {
5378
public:
5379
470k
  static NoThrowAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5380
470k
    auto *A = new (Ctx) NoThrowAttr(Loc, Ctx, 0);
5381
470k
    A->setImplicit(true);
5382
470k
    return A;
5383
470k
  }
5384
5385
  NoThrowAttr(SourceRange R, ASTContext &Ctx
5386
              , unsigned SI
5387
             )
5388
    : InheritableAttr(attr::NoThrow, R, SI, false, false)
5389
593k
  {
5390
593k
  }
5391
5392
  NoThrowAttr *clone(ASTContext &C) const;
5393
  void printPretty(raw_ostream &OS,
5394
                   const PrintingPolicy &Policy) const;
5395
  const char *getSpelling() const;
5396
5397
5398
1.17M
  static bool classof(const Attr *A) { return A->getKind() == attr::NoThrow; }
5399
};
5400
5401
class NonNullAttr : public InheritableParamAttr {
5402
  unsigned args_Size;
5403
  ParamIdx *args_;
5404
5405
public:
5406
  static NonNullAttr *CreateImplicit(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
5407
    auto *A = new (Ctx) NonNullAttr(Loc, Ctx, Args, ArgsSize, 0);
5408
    A->setImplicit(true);
5409
    return A;
5410
  }
5411
5412
  NonNullAttr(SourceRange R, ASTContext &Ctx
5413
              , ParamIdx *Args, unsigned ArgsSize
5414
              , unsigned SI
5415
             )
5416
    : InheritableParamAttr(attr::NonNull, R, SI, false, true)
5417
              , args_Size(ArgsSize), args_(new (Ctx, 16) ParamIdx[args_Size])
5418
7.25k
  {
5419
7.25k
    std::copy(Args, Args + args_Size, args_);
5420
7.25k
  }
5421
5422
  NonNullAttr(SourceRange R, ASTContext &Ctx
5423
              , unsigned SI
5424
             )
5425
    : InheritableParamAttr(attr::NonNull, R, SI, false, true)
5426
              , args_Size(0), args_(nullptr)
5427
  {
5428
  }
5429
5430
  NonNullAttr *clone(ASTContext &C) const;
5431
  void printPretty(raw_ostream &OS,
5432
                   const PrintingPolicy &Policy) const;
5433
  const char *getSpelling() const;
5434
  typedef ParamIdx* args_iterator;
5435
1.06k
  args_iterator args_begin() const { return args_; }
5436
1.15k
  args_iterator args_end() const { return args_ + args_Size; }
5437
1.51k
  unsigned args_size() const { return args_Size; }
5438
971
  llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
5439
5440
5441
5442
102
    bool isNonNull(unsigned IdxAST) const {
5443
102
      if (!args_size())
5444
10
        return true;
5445
92
      return args_end() != std::find_if(
5446
92
          args_begin(), args_end(),
5447
96
          [=](const ParamIdx &Idx) { return Idx.getASTIndex() == IdxAST; });
5448
92
    }
5449
  
5450
5451
3.78M
  static bool classof(const Attr *A) { return A->getKind() == attr::NonNull; }
5452
};
5453
5454
class NotTailCalledAttr : public InheritableAttr {
5455
public:
5456
  static NotTailCalledAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5457
    auto *A = new (Ctx) NotTailCalledAttr(Loc, Ctx, 0);
5458
    A->setImplicit(true);
5459
    return A;
5460
  }
5461
5462
  NotTailCalledAttr(SourceRange R, ASTContext &Ctx
5463
              , unsigned SI
5464
             )
5465
    : InheritableAttr(attr::NotTailCalled, R, SI, false, false)
5466
206
  {
5467
206
  }
5468
5469
  NotTailCalledAttr *clone(ASTContext &C) const;
5470
  void printPretty(raw_ostream &OS,
5471
                   const PrintingPolicy &Policy) const;
5472
  const char *getSpelling() const;
5473
5474
5475
6.86M
  static bool classof(const Attr *A) { return A->getKind() == attr::NotTailCalled; }
5476
};
5477
5478
class OMPCaptureKindAttr : public Attr {
5479
unsigned captureKind;
5480
5481
public:
5482
163k
  static OMPCaptureKindAttr *CreateImplicit(ASTContext &Ctx, unsigned CaptureKind, SourceRange Loc = SourceRange()) {
5483
163k
    auto *A = new (Ctx) OMPCaptureKindAttr(Loc, Ctx, CaptureKind, 0);
5484
163k
    A->setImplicit(true);
5485
163k
    return A;
5486
163k
  }
5487
5488
  OMPCaptureKindAttr(SourceRange R, ASTContext &Ctx
5489
              , unsigned CaptureKind
5490
              , unsigned SI
5491
             )
5492
    : Attr(attr::OMPCaptureKind, R, SI, false)
5493
              , captureKind(CaptureKind)
5494
168k
  {
5495
168k
  }
5496
5497
  OMPCaptureKindAttr *clone(ASTContext &C) const;
5498
  void printPretty(raw_ostream &OS,
5499
                   const PrintingPolicy &Policy) const;
5500
  const char *getSpelling() const;
5501
17.5k
  unsigned getCaptureKind() const {
5502
17.5k
    return captureKind;
5503
17.5k
  }
5504
5505
5506
5507
324
  static bool classof(const Attr *A) { return A->getKind() == attr::OMPCaptureKind; }
5508
};
5509
5510
class OMPCaptureNoInitAttr : public InheritableAttr {
5511
public:
5512
70
  static OMPCaptureNoInitAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5513
70
    auto *A = new (Ctx) OMPCaptureNoInitAttr(Loc, Ctx, 0);
5514
70
    A->setImplicit(true);
5515
70
    return A;
5516
70
  }
5517
5518
  OMPCaptureNoInitAttr(SourceRange R, ASTContext &Ctx
5519
              , unsigned SI
5520
             )
5521
    : InheritableAttr(attr::OMPCaptureNoInit, R, SI, false, false)
5522
88
  {
5523
88
  }
5524
5525
  OMPCaptureNoInitAttr *clone(ASTContext &C) const;
5526
  void printPretty(raw_ostream &OS,
5527
                   const PrintingPolicy &Policy) const;
5528
  const char *getSpelling() const;
5529
5530
5531
170
  static bool classof(const Attr *A) { return A->getKind() == attr::OMPCaptureNoInit; }
5532
};
5533
5534
class OMPDeclareSimdDeclAttr : public Attr {
5535
public:
5536
  enum BranchStateTy {
5537
    BS_Undefined,
5538
    BS_Inbranch,
5539
    BS_Notinbranch
5540
  };
5541
private:
5542
  BranchStateTy branchState;
5543
5544
Expr * simdlen;
5545
5546
  unsigned uniforms_Size;
5547
  Expr * *uniforms_;
5548
5549
  unsigned aligneds_Size;
5550
  Expr * *aligneds_;
5551
5552
  unsigned alignments_Size;
5553
  Expr * *alignments_;
5554
5555
  unsigned linears_Size;
5556
  Expr * *linears_;
5557
5558
  unsigned modifiers_Size;
5559
  unsigned *modifiers_;
5560
5561
  unsigned steps_Size;
5562
  Expr * *steps_;
5563
5564
public:
5565
306
  static OMPDeclareSimdDeclAttr *CreateImplicit(ASTContext &Ctx, BranchStateTy BranchState, Expr * Simdlen, Expr * *Uniforms, unsigned UniformsSize, Expr * *Aligneds, unsigned AlignedsSize, Expr * *Alignments, unsigned AlignmentsSize, Expr * *Linears, unsigned LinearsSize, unsigned *Modifiers, unsigned ModifiersSize, Expr * *Steps, unsigned StepsSize, SourceRange Loc = SourceRange()) {
5566
306
    auto *A = new (Ctx) OMPDeclareSimdDeclAttr(Loc, Ctx, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize, 0);
5567
306
    A->setImplicit(true);
5568
306
    return A;
5569
306
  }
5570
5571
  OMPDeclareSimdDeclAttr(SourceRange R, ASTContext &Ctx
5572
              , BranchStateTy BranchState
5573
              , Expr * Simdlen
5574
              , Expr * *Uniforms, unsigned UniformsSize
5575
              , Expr * *Aligneds, unsigned AlignedsSize
5576
              , Expr * *Alignments, unsigned AlignmentsSize
5577
              , Expr * *Linears, unsigned LinearsSize
5578
              , unsigned *Modifiers, unsigned ModifiersSize
5579
              , Expr * *Steps, unsigned StepsSize
5580
              , unsigned SI
5581
             )
5582
    : Attr(attr::OMPDeclareSimdDecl, R, SI, false)
5583
              , branchState(BranchState)
5584
              , simdlen(Simdlen)
5585
              , uniforms_Size(UniformsSize), uniforms_(new (Ctx, 16) Expr *[uniforms_Size])
5586
              , aligneds_Size(AlignedsSize), aligneds_(new (Ctx, 16) Expr *[aligneds_Size])
5587
              , alignments_Size(AlignmentsSize), alignments_(new (Ctx, 16) Expr *[alignments_Size])
5588
              , linears_Size(LinearsSize), linears_(new (Ctx, 16) Expr *[linears_Size])
5589
              , modifiers_Size(ModifiersSize), modifiers_(new (Ctx, 16) unsigned[modifiers_Size])
5590
              , steps_Size(StepsSize), steps_(new (Ctx, 16) Expr *[steps_Size])
5591
430
  {
5592
430
    std::copy(Uniforms, Uniforms + uniforms_Size, uniforms_);
5593
430
    std::copy(Aligneds, Aligneds + aligneds_Size, aligneds_);
5594
430
    std::copy(Alignments, Alignments + alignments_Size, alignments_);
5595
430
    std::copy(Linears, Linears + linears_Size, linears_);
5596
430
    std::copy(Modifiers, Modifiers + modifiers_Size, modifiers_);
5597
430
    std::copy(Steps, Steps + steps_Size, steps_);
5598
430
  }
5599
5600
  OMPDeclareSimdDeclAttr(SourceRange R, ASTContext &Ctx
5601
              , BranchStateTy BranchState
5602
              , Expr * Simdlen
5603
              , unsigned SI
5604
             )
5605
    : Attr(attr::OMPDeclareSimdDecl, R, SI, false)
5606
              , branchState(BranchState)
5607
              , simdlen(Simdlen)
5608
              , uniforms_Size(0), uniforms_(nullptr)
5609
              , aligneds_Size(0), aligneds_(nullptr)
5610
              , alignments_Size(0), alignments_(nullptr)
5611
              , linears_Size(0), linears_(nullptr)
5612
              , modifiers_Size(0), modifiers_(nullptr)
5613
              , steps_Size(0), steps_(nullptr)
5614
  {
5615
  }
5616
5617
  OMPDeclareSimdDeclAttr *clone(ASTContext &C) const;
5618
  void printPretty(raw_ostream &OS,
5619
                   const PrintingPolicy &Policy) const;
5620
  const char *getSpelling() const;
5621
414
  BranchStateTy getBranchState() const {
5622
414
    return branchState;
5623
414
  }
5624
5625
448
  static bool ConvertStrToBranchStateTy(StringRef Val, BranchStateTy &Out) {
5626
448
    Optional<BranchStateTy> R = llvm::StringSwitch<Optional<BranchStateTy>>(Val)
5627
448
      .Case("", OMPDeclareSimdDeclAttr::BS_Undefined)
5628
448
      .Case("inbranch", OMPDeclareSimdDeclAttr::BS_Inbranch)
5629
448
      .Case("notinbranch", OMPDeclareSimdDeclAttr::BS_Notinbranch)
5630
448
      .Default(Optional<BranchStateTy>());
5631
448
    if (R) {
5632
82
      Out = *R;
5633
82
      return true;
5634
82
    }
5635
366
    return false;
5636
366
  }
5637
5638
20
  static const char *ConvertBranchStateTyToStr(BranchStateTy Val) {
5639
20
    switch(Val) {
5640
20
    
case OMPDeclareSimdDeclAttr::BS_Undefined: return ""0
;
5641
20
    
case OMPDeclareSimdDeclAttr::BS_Inbranch: return "inbranch"10
;
5642
20
    
case OMPDeclareSimdDeclAttr::BS_Notinbranch: return "notinbranch"10
;
5643
0
    }
5644
0
    llvm_unreachable("No enumerator with that value");
5645
0
  }
5646
398
  Expr * getSimdlen() const {
5647
398
    return simdlen;
5648
398
  }
5649
5650
  typedef Expr ** uniforms_iterator;
5651
278
  uniforms_iterator uniforms_begin() const { return uniforms_; }
5652
278
  uniforms_iterator uniforms_end() const { return uniforms_ + uniforms_Size; }
5653
274
  unsigned uniforms_size() const { return uniforms_Size; }
5654
274
  llvm::iterator_range<uniforms_iterator> uniforms() const { return llvm::make_range(uniforms_begin(), uniforms_end()); }
5655
5656
5657
  typedef Expr ** aligneds_iterator;
5658
398
  aligneds_iterator aligneds_begin() const { return aligneds_; }
5659
398
  aligneds_iterator aligneds_end() const { return aligneds_ + aligneds_Size; }
5660
124
  unsigned aligneds_size() const { return aligneds_Size; }
5661
39