Line data Source code
1 : /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2 : |* *|
3 : |* Attribute classes' definitions *|
4 : |* *|
5 : |* Automatically generated file, do not edit! *|
6 : |* *|
7 : \*===----------------------------------------------------------------------===*/
8 :
9 : #ifndef LLVM_CLANG_ATTR_CLASSES_INC
10 : #define LLVM_CLANG_ATTR_CLASSES_INC
11 :
12 : class AMDGPUFlatWorkGroupSizeAttr : public InheritableAttr {
13 : unsigned min;
14 :
15 : unsigned max;
16 :
17 : public:
18 : static AMDGPUFlatWorkGroupSizeAttr *CreateImplicit(ASTContext &Ctx, unsigned Min, unsigned Max, SourceRange Loc = SourceRange()) {
19 : auto *A = new (Ctx) AMDGPUFlatWorkGroupSizeAttr(Loc, Ctx, Min, Max, 0);
20 : A->setImplicit(true);
21 : return A;
22 : }
23 :
24 : AMDGPUFlatWorkGroupSizeAttr(SourceRange R, ASTContext &Ctx
25 : , unsigned Min
26 : , unsigned Max
27 : , unsigned SI
28 : )
29 86 : : InheritableAttr(attr::AMDGPUFlatWorkGroupSize, R, SI, false, false)
30 : , min(Min)
31 86 : , max(Max)
32 : {
33 : }
34 :
35 : AMDGPUFlatWorkGroupSizeAttr *clone(ASTContext &C) const;
36 : void printPretty(raw_ostream &OS,
37 : const PrintingPolicy &Policy) const;
38 : const char *getSpelling() const;
39 0 : unsigned getMin() const {
40 0 : return min;
41 : }
42 :
43 0 : unsigned getMax() const {
44 0 : return max;
45 : }
46 :
47 :
48 :
49 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AMDGPUFlatWorkGroupSize; }
50 : };
51 :
52 : class AMDGPUNumSGPRAttr : public InheritableAttr {
53 : unsigned numSGPR;
54 :
55 : public:
56 : static AMDGPUNumSGPRAttr *CreateImplicit(ASTContext &Ctx, unsigned NumSGPR, SourceRange Loc = SourceRange()) {
57 : auto *A = new (Ctx) AMDGPUNumSGPRAttr(Loc, Ctx, NumSGPR, 0);
58 : A->setImplicit(true);
59 : return A;
60 : }
61 :
62 : AMDGPUNumSGPRAttr(SourceRange R, ASTContext &Ctx
63 : , unsigned NumSGPR
64 : , unsigned SI
65 : )
66 69 : : InheritableAttr(attr::AMDGPUNumSGPR, R, SI, false, false)
67 69 : , numSGPR(NumSGPR)
68 : {
69 : }
70 :
71 : AMDGPUNumSGPRAttr *clone(ASTContext &C) const;
72 : void printPretty(raw_ostream &OS,
73 : const PrintingPolicy &Policy) const;
74 : const char *getSpelling() const;
75 0 : unsigned getNumSGPR() const {
76 0 : return numSGPR;
77 : }
78 :
79 :
80 :
81 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AMDGPUNumSGPR; }
82 : };
83 :
84 : class AMDGPUNumVGPRAttr : public InheritableAttr {
85 : unsigned numVGPR;
86 :
87 : public:
88 : static AMDGPUNumVGPRAttr *CreateImplicit(ASTContext &Ctx, unsigned NumVGPR, SourceRange Loc = SourceRange()) {
89 : auto *A = new (Ctx) AMDGPUNumVGPRAttr(Loc, Ctx, NumVGPR, 0);
90 : A->setImplicit(true);
91 : return A;
92 : }
93 :
94 : AMDGPUNumVGPRAttr(SourceRange R, ASTContext &Ctx
95 : , unsigned NumVGPR
96 : , unsigned SI
97 : )
98 69 : : InheritableAttr(attr::AMDGPUNumVGPR, R, SI, false, false)
99 69 : , numVGPR(NumVGPR)
100 : {
101 : }
102 :
103 : AMDGPUNumVGPRAttr *clone(ASTContext &C) const;
104 : void printPretty(raw_ostream &OS,
105 : const PrintingPolicy &Policy) const;
106 : const char *getSpelling() const;
107 0 : unsigned getNumVGPR() const {
108 0 : return numVGPR;
109 : }
110 :
111 :
112 :
113 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AMDGPUNumVGPR; }
114 : };
115 :
116 : class AMDGPUWavesPerEUAttr : public InheritableAttr {
117 : unsigned min;
118 :
119 : unsigned max;
120 :
121 : public:
122 : static AMDGPUWavesPerEUAttr *CreateImplicit(ASTContext &Ctx, unsigned Min, unsigned Max, SourceRange Loc = SourceRange()) {
123 : auto *A = new (Ctx) AMDGPUWavesPerEUAttr(Loc, Ctx, Min, Max, 0);
124 : A->setImplicit(true);
125 : return A;
126 : }
127 :
128 : AMDGPUWavesPerEUAttr(SourceRange R, ASTContext &Ctx
129 : , unsigned Min
130 : , unsigned Max
131 : , unsigned SI
132 : )
133 107 : : InheritableAttr(attr::AMDGPUWavesPerEU, R, SI, false, false)
134 : , min(Min)
135 107 : , max(Max)
136 : {
137 : }
138 :
139 : AMDGPUWavesPerEUAttr(SourceRange R, ASTContext &Ctx
140 : , unsigned Min
141 : , unsigned SI
142 : )
143 : : InheritableAttr(attr::AMDGPUWavesPerEU, R, SI, false, false)
144 : , min(Min)
145 : , max()
146 : {
147 : }
148 :
149 : AMDGPUWavesPerEUAttr *clone(ASTContext &C) const;
150 : void printPretty(raw_ostream &OS,
151 : const PrintingPolicy &Policy) const;
152 : const char *getSpelling() const;
153 0 : unsigned getMin() const {
154 0 : return min;
155 : }
156 :
157 0 : unsigned getMax() const {
158 0 : return max;
159 : }
160 :
161 :
162 :
163 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AMDGPUWavesPerEU; }
164 : };
165 :
166 : class ARMInterruptAttr : public InheritableAttr {
167 : public:
168 : enum InterruptType {
169 : IRQ,
170 : FIQ,
171 : SWI,
172 : ABORT,
173 : UNDEF,
174 : Generic
175 : };
176 : private:
177 : InterruptType interrupt;
178 :
179 : public:
180 : static ARMInterruptAttr *CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, SourceRange Loc = SourceRange()) {
181 : auto *A = new (Ctx) ARMInterruptAttr(Loc, Ctx, Interrupt, 0);
182 : A->setImplicit(true);
183 : return A;
184 : }
185 :
186 : ARMInterruptAttr(SourceRange R, ASTContext &Ctx
187 : , InterruptType Interrupt
188 : , unsigned SI
189 : )
190 73 : : InheritableAttr(attr::ARMInterrupt, R, SI, false, false)
191 73 : , interrupt(Interrupt)
192 : {
193 : }
194 :
195 : ARMInterruptAttr(SourceRange R, ASTContext &Ctx
196 : , unsigned SI
197 : )
198 : : InheritableAttr(attr::ARMInterrupt, R, SI, false, false)
199 : , interrupt(InterruptType(0))
200 : {
201 : }
202 :
203 : ARMInterruptAttr *clone(ASTContext &C) const;
204 : void printPretty(raw_ostream &OS,
205 : const PrintingPolicy &Policy) const;
206 : const char *getSpelling() const;
207 0 : InterruptType getInterrupt() const {
208 0 : return interrupt;
209 : }
210 :
211 78 : static bool ConvertStrToInterruptType(StringRef Val, InterruptType &Out) {
212 78 : Optional<InterruptType> R = llvm::StringSwitch<Optional<InterruptType>>(Val)
213 78 : .Case("IRQ", ARMInterruptAttr::IRQ)
214 78 : .Case("FIQ", ARMInterruptAttr::FIQ)
215 78 : .Case("SWI", ARMInterruptAttr::SWI)
216 78 : .Case("ABORT", ARMInterruptAttr::ABORT)
217 78 : .Case("UNDEF", ARMInterruptAttr::UNDEF)
218 78 : .Case("", ARMInterruptAttr::Generic)
219 : .Default(Optional<InterruptType>());
220 78 : if (R) {
221 73 : Out = *R;
222 73 : return true;
223 : }
224 : return false;
225 : }
226 :
227 : static const char *ConvertInterruptTypeToStr(InterruptType Val) {
228 0 : switch(Val) {
229 : case ARMInterruptAttr::IRQ: return "IRQ";
230 0 : case ARMInterruptAttr::FIQ: return "FIQ";
231 0 : case ARMInterruptAttr::SWI: return "SWI";
232 0 : case ARMInterruptAttr::ABORT: return "ABORT";
233 0 : case ARMInterruptAttr::UNDEF: return "UNDEF";
234 0 : case ARMInterruptAttr::Generic: return "";
235 : }
236 0 : llvm_unreachable("No enumerator with that value");
237 : }
238 :
239 :
240 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ARMInterrupt; }
241 : };
242 :
243 : class AVRInterruptAttr : public InheritableAttr {
244 : public:
245 : static AVRInterruptAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
246 : auto *A = new (Ctx) AVRInterruptAttr(Loc, Ctx, 0);
247 : A->setImplicit(true);
248 : return A;
249 : }
250 :
251 : AVRInterruptAttr(SourceRange R, ASTContext &Ctx
252 : , unsigned SI
253 : )
254 : : InheritableAttr(attr::AVRInterrupt, R, SI, false, false)
255 : {
256 : }
257 :
258 : AVRInterruptAttr *clone(ASTContext &C) const;
259 : void printPretty(raw_ostream &OS,
260 : const PrintingPolicy &Policy) const;
261 : const char *getSpelling() const;
262 :
263 :
264 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AVRInterrupt; }
265 : };
266 :
267 : class AVRSignalAttr : public InheritableAttr {
268 : public:
269 : static AVRSignalAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
270 : auto *A = new (Ctx) AVRSignalAttr(Loc, Ctx, 0);
271 : A->setImplicit(true);
272 : return A;
273 : }
274 :
275 : AVRSignalAttr(SourceRange R, ASTContext &Ctx
276 : , unsigned SI
277 : )
278 : : InheritableAttr(attr::AVRSignal, R, SI, false, false)
279 : {
280 : }
281 :
282 : AVRSignalAttr *clone(ASTContext &C) const;
283 : void printPretty(raw_ostream &OS,
284 : const PrintingPolicy &Policy) const;
285 : const char *getSpelling() const;
286 :
287 :
288 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AVRSignal; }
289 : };
290 :
291 : class AbiTagAttr : public Attr {
292 : unsigned tags_Size;
293 : StringRef *tags_;
294 :
295 : public:
296 : static AbiTagAttr *CreateImplicit(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, SourceRange Loc = SourceRange()) {
297 : auto *A = new (Ctx) AbiTagAttr(Loc, Ctx, Tags, TagsSize, 0);
298 : A->setImplicit(true);
299 : return A;
300 : }
301 :
302 2598 : AbiTagAttr(SourceRange R, ASTContext &Ctx
303 : , StringRef *Tags, unsigned TagsSize
304 : , unsigned SI
305 : )
306 2598 : : Attr(attr::AbiTag, R, SI, false)
307 5257 : , tags_Size(TagsSize), tags_(new (Ctx, 16) StringRef[tags_Size])
308 : {
309 5257 : for (size_t I = 0, E = tags_Size; I != E;
310 : ++I) {
311 2659 : StringRef Ref = Tags[I];
312 2659 : if (!Ref.empty()) {
313 : char *Mem = new (Ctx, 1) char[Ref.size()];
314 2659 : std::memcpy(Mem, Ref.data(), Ref.size());
315 2659 : tags_[I] = StringRef(Mem, Ref.size());
316 : }
317 : }
318 2598 : }
319 :
320 : AbiTagAttr(SourceRange R, ASTContext &Ctx
321 : , unsigned SI
322 : )
323 : : Attr(attr::AbiTag, R, SI, false)
324 : , tags_Size(0), tags_(nullptr)
325 : {
326 : }
327 :
328 : AbiTagAttr *clone(ASTContext &C) const;
329 : void printPretty(raw_ostream &OS,
330 : const PrintingPolicy &Policy) const;
331 : const char *getSpelling() const;
332 : typedef StringRef* tags_iterator;
333 0 : tags_iterator tags_begin() const { return tags_; }
334 51284 : tags_iterator tags_end() const { return tags_ + tags_Size; }
335 0 : unsigned tags_size() const { return tags_Size; }
336 50674 : llvm::iterator_range<tags_iterator> tags() const { return llvm::make_range(tags_begin(), tags_end()); }
337 :
338 :
339 :
340 :
341 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AbiTag; }
342 : };
343 :
344 : class AcquireCapabilityAttr : public InheritableAttr {
345 : unsigned args_Size;
346 : Expr * *args_;
347 :
348 : public:
349 : enum Spelling {
350 : GNU_acquire_capability = 0,
351 : CXX11_clang_acquire_capability = 1,
352 : GNU_acquire_shared_capability = 2,
353 : CXX11_clang_acquire_shared_capability = 3,
354 : GNU_exclusive_lock_function = 4,
355 : GNU_shared_lock_function = 5
356 : };
357 :
358 : static AcquireCapabilityAttr *CreateImplicit(ASTContext &Ctx, Spelling S, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
359 : auto *A = new (Ctx) AcquireCapabilityAttr(Loc, Ctx, Args, ArgsSize, S);
360 : A->setImplicit(true);
361 : return A;
362 : }
363 :
364 548 : AcquireCapabilityAttr(SourceRange R, ASTContext &Ctx
365 : , Expr * *Args, unsigned ArgsSize
366 : , unsigned SI
367 : )
368 548 : : InheritableAttr(attr::AcquireCapability, R, SI, true, true)
369 548 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
370 : {
371 548 : std::copy(Args, Args + args_Size, args_);
372 548 : }
373 :
374 : AcquireCapabilityAttr(SourceRange R, ASTContext &Ctx
375 : , unsigned SI
376 : )
377 : : InheritableAttr(attr::AcquireCapability, R, SI, true, true)
378 : , args_Size(0), args_(nullptr)
379 : {
380 : }
381 :
382 : AcquireCapabilityAttr *clone(ASTContext &C) const;
383 : void printPretty(raw_ostream &OS,
384 : const PrintingPolicy &Policy) const;
385 : const char *getSpelling() const;
386 : Spelling getSemanticSpelling() const {
387 : switch (SpellingListIndex) {
388 : default: llvm_unreachable("Unknown spelling list index");
389 : case 0: return GNU_acquire_capability;
390 : case 1: return CXX11_clang_acquire_capability;
391 : case 2: return GNU_acquire_shared_capability;
392 : case 3: return CXX11_clang_acquire_shared_capability;
393 : case 4: return GNU_exclusive_lock_function;
394 : case 5: return GNU_shared_lock_function;
395 : }
396 : }
397 1780 : bool isShared() const { return SpellingListIndex == 2 ||
398 1780 : SpellingListIndex == 3 ||
399 1674 : SpellingListIndex == 5; }
400 : typedef Expr ** args_iterator;
401 0 : args_iterator args_begin() const { return args_; }
402 2361 : args_iterator args_end() const { return args_ + args_Size; }
403 0 : unsigned args_size() const { return args_Size; }
404 2351 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
405 :
406 :
407 :
408 :
409 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AcquireCapability; }
410 : };
411 :
412 : class AcquiredAfterAttr : public InheritableAttr {
413 : unsigned args_Size;
414 : Expr * *args_;
415 :
416 : public:
417 : static AcquiredAfterAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
418 : auto *A = new (Ctx) AcquiredAfterAttr(Loc, Ctx, Args, ArgsSize, 0);
419 : A->setImplicit(true);
420 : return A;
421 : }
422 :
423 134 : AcquiredAfterAttr(SourceRange R, ASTContext &Ctx
424 : , Expr * *Args, unsigned ArgsSize
425 : , unsigned SI
426 : )
427 134 : : InheritableAttr(attr::AcquiredAfter, R, SI, true, true)
428 134 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
429 : {
430 134 : std::copy(Args, Args + args_Size, args_);
431 134 : }
432 :
433 : AcquiredAfterAttr(SourceRange R, ASTContext &Ctx
434 : , unsigned SI
435 : )
436 : : InheritableAttr(attr::AcquiredAfter, R, SI, true, true)
437 : , args_Size(0), args_(nullptr)
438 : {
439 : }
440 :
441 : AcquiredAfterAttr *clone(ASTContext &C) const;
442 : void printPretty(raw_ostream &OS,
443 : const PrintingPolicy &Policy) const;
444 : const char *getSpelling() const;
445 : typedef Expr ** args_iterator;
446 0 : args_iterator args_begin() const { return args_; }
447 86 : args_iterator args_end() const { return args_ + args_Size; }
448 0 : unsigned args_size() const { return args_Size; }
449 86 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
450 :
451 :
452 :
453 :
454 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AcquiredAfter; }
455 : };
456 :
457 : class AcquiredBeforeAttr : public InheritableAttr {
458 : unsigned args_Size;
459 : Expr * *args_;
460 :
461 : public:
462 : static AcquiredBeforeAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
463 : auto *A = new (Ctx) AcquiredBeforeAttr(Loc, Ctx, Args, ArgsSize, 0);
464 : A->setImplicit(true);
465 : return A;
466 : }
467 :
468 94 : AcquiredBeforeAttr(SourceRange R, ASTContext &Ctx
469 : , Expr * *Args, unsigned ArgsSize
470 : , unsigned SI
471 : )
472 94 : : InheritableAttr(attr::AcquiredBefore, R, SI, true, true)
473 94 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
474 : {
475 94 : std::copy(Args, Args + args_Size, args_);
476 94 : }
477 :
478 : AcquiredBeforeAttr(SourceRange R, ASTContext &Ctx
479 : , unsigned SI
480 : )
481 : : InheritableAttr(attr::AcquiredBefore, R, SI, true, true)
482 : , args_Size(0), args_(nullptr)
483 : {
484 : }
485 :
486 : AcquiredBeforeAttr *clone(ASTContext &C) const;
487 : void printPretty(raw_ostream &OS,
488 : const PrintingPolicy &Policy) const;
489 : const char *getSpelling() const;
490 : typedef Expr ** args_iterator;
491 0 : args_iterator args_begin() const { return args_; }
492 52 : args_iterator args_end() const { return args_ + args_Size; }
493 0 : unsigned args_size() const { return args_Size; }
494 52 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
495 :
496 :
497 :
498 :
499 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AcquiredBefore; }
500 : };
501 :
502 : class AddressSpaceAttr : public TypeAttr {
503 : int addressSpace;
504 :
505 : public:
506 : static AddressSpaceAttr *CreateImplicit(ASTContext &Ctx, int AddressSpace, SourceRange Loc = SourceRange()) {
507 : auto *A = new (Ctx) AddressSpaceAttr(Loc, Ctx, AddressSpace, 0);
508 : A->setImplicit(true);
509 : return A;
510 : }
511 :
512 : AddressSpaceAttr(SourceRange R, ASTContext &Ctx
513 : , int AddressSpace
514 : , unsigned SI
515 : )
516 221 : : TypeAttr(attr::AddressSpace, R, SI, false)
517 221 : , addressSpace(AddressSpace)
518 : {
519 : }
520 :
521 : AddressSpaceAttr *clone(ASTContext &C) const;
522 : void printPretty(raw_ostream &OS,
523 : const PrintingPolicy &Policy) const;
524 : const char *getSpelling() const;
525 0 : int getAddressSpace() const {
526 0 : return addressSpace;
527 : }
528 :
529 :
530 :
531 : static bool classof(const Attr *A) { return A->getKind() == attr::AddressSpace; }
532 : };
533 :
534 : class AliasAttr : public Attr {
535 : unsigned aliaseeLength;
536 : char *aliasee;
537 :
538 : public:
539 17 : static AliasAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Loc = SourceRange()) {
540 17 : auto *A = new (Ctx) AliasAttr(Loc, Ctx, Aliasee, 0);
541 : A->setImplicit(true);
542 17 : return A;
543 : }
544 :
545 2494 : AliasAttr(SourceRange R, ASTContext &Ctx
546 : , llvm::StringRef Aliasee
547 : , unsigned SI
548 : )
549 2494 : : Attr(attr::Alias, R, SI, false)
550 2494 : , aliaseeLength(Aliasee.size()),aliasee(new (Ctx, 1) char[aliaseeLength])
551 : {
552 2494 : if (!Aliasee.empty())
553 4988 : std::memcpy(aliasee, Aliasee.data(), aliaseeLength);
554 2494 : }
555 :
556 : AliasAttr *clone(ASTContext &C) const;
557 : void printPretty(raw_ostream &OS,
558 : const PrintingPolicy &Policy) const;
559 : const char *getSpelling() const;
560 0 : llvm::StringRef getAliasee() const {
561 237 : return llvm::StringRef(aliasee, aliaseeLength);
562 : }
563 : unsigned getAliaseeLength() const {
564 : return aliaseeLength;
565 : }
566 : void setAliasee(ASTContext &C, llvm::StringRef S) {
567 : aliaseeLength = S.size();
568 : this->aliasee = new (C, 1) char [aliaseeLength];
569 : if (!S.empty())
570 : std::memcpy(this->aliasee, S.data(), aliaseeLength);
571 : }
572 :
573 :
574 :
575 5 : static bool classof(const Attr *A) { return A->getKind() == attr::Alias; }
576 : };
577 :
578 : class AlignMac68kAttr : public InheritableAttr {
579 : public:
580 13 : static AlignMac68kAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
581 13 : auto *A = new (Ctx) AlignMac68kAttr(Loc, Ctx, 0);
582 : A->setImplicit(true);
583 13 : return A;
584 : }
585 :
586 : AlignMac68kAttr(SourceRange R, ASTContext &Ctx
587 : , unsigned SI
588 : )
589 : : InheritableAttr(attr::AlignMac68k, R, SI, false, false)
590 : {
591 : }
592 :
593 : AlignMac68kAttr *clone(ASTContext &C) const;
594 : void printPretty(raw_ostream &OS,
595 : const PrintingPolicy &Policy) const;
596 : const char *getSpelling() const;
597 :
598 :
599 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AlignMac68k; }
600 : };
601 :
602 : class AlignValueAttr : public Attr {
603 : Expr * alignment;
604 :
605 : public:
606 : static AlignValueAttr *CreateImplicit(ASTContext &Ctx, Expr * Alignment, SourceRange Loc = SourceRange()) {
607 : auto *A = new (Ctx) AlignValueAttr(Loc, Ctx, Alignment, 0);
608 : A->setImplicit(true);
609 : return A;
610 : }
611 :
612 : AlignValueAttr(SourceRange R, ASTContext &Ctx
613 : , Expr * Alignment
614 : , unsigned SI
615 : )
616 300 : : Attr(attr::AlignValue, R, SI, false)
617 300 : , alignment(Alignment)
618 : {
619 : }
620 :
621 : AlignValueAttr *clone(ASTContext &C) const;
622 : void printPretty(raw_ostream &OS,
623 : const PrintingPolicy &Policy) const;
624 : const char *getSpelling() const;
625 0 : Expr * getAlignment() const {
626 0 : return alignment;
627 : }
628 :
629 :
630 :
631 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AlignValue; }
632 : };
633 :
634 : class AlignedAttr : public InheritableAttr {
635 : bool isalignmentExpr;
636 : union {
637 : Expr *alignmentExpr;
638 : TypeSourceInfo *alignmentType;
639 : };
640 :
641 : public:
642 : enum Spelling {
643 : GNU_aligned = 0,
644 : CXX11_gnu_aligned = 1,
645 : Declspec_align = 2,
646 : Keyword_alignas = 3,
647 : Keyword_Alignas = 4
648 : };
649 :
650 8 : static AlignedAttr *CreateImplicit(ASTContext &Ctx, Spelling S, bool IsAlignmentExpr, void *Alignment, SourceRange Loc = SourceRange()) {
651 8 : auto *A = new (Ctx) AlignedAttr(Loc, Ctx, IsAlignmentExpr, Alignment, S);
652 : A->setImplicit(true);
653 8 : return A;
654 : }
655 :
656 : AlignedAttr(SourceRange R, ASTContext &Ctx
657 : , bool IsAlignmentExpr, void *Alignment
658 : , unsigned SI
659 : )
660 206731 : : InheritableAttr(attr::Aligned, R, SI, false, false)
661 206731 : , isalignmentExpr(IsAlignmentExpr)
662 : {
663 5117 : if (isalignmentExpr)
664 206731 : alignmentExpr = reinterpret_cast<Expr *>(Alignment);
665 : else
666 0 : alignmentType = reinterpret_cast<TypeSourceInfo *>(Alignment);
667 : }
668 :
669 : AlignedAttr(SourceRange R, ASTContext &Ctx
670 : , unsigned SI
671 : )
672 : : InheritableAttr(attr::Aligned, R, SI, false, false)
673 : , isalignmentExpr(false)
674 : {
675 : }
676 :
677 : AlignedAttr *clone(ASTContext &C) const;
678 : void printPretty(raw_ostream &OS,
679 : const PrintingPolicy &Policy) const;
680 : const char *getSpelling() const;
681 : Spelling getSemanticSpelling() const {
682 : switch (SpellingListIndex) {
683 : default: llvm_unreachable("Unknown spelling list index");
684 : case 0: return GNU_aligned;
685 : case 1: return CXX11_gnu_aligned;
686 : case 2: return Declspec_align;
687 : case 3: return Keyword_alignas;
688 : case 4: return Keyword_Alignas;
689 : }
690 : }
691 : bool isGNU() const { return SpellingListIndex == 0 ||
692 : SpellingListIndex == 1; }
693 7 : bool isC11() const { return SpellingListIndex == 4; }
694 217718 : bool isAlignas() const { return SpellingListIndex == 3 ||
695 : SpellingListIndex == 4; }
696 : bool isDeclspec() const { return SpellingListIndex == 2; }
697 : bool isAlignmentDependent() const;
698 : unsigned getAlignment(ASTContext &Ctx) const;
699 0 : bool isAlignmentExpr() const {
700 0 : return isalignmentExpr;
701 : }
702 0 : Expr *getAlignmentExpr() const {
703 : assert(isalignmentExpr);
704 0 : return alignmentExpr;
705 : }
706 0 : TypeSourceInfo *getAlignmentType() const {
707 : assert(!isalignmentExpr);
708 0 : return alignmentType;
709 : }
710 :
711 :
712 :
713 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Aligned; }
714 : };
715 :
716 : class AllocAlignAttr : public InheritableAttr {
717 : ParamIdx paramIndex;
718 :
719 : public:
720 : static AllocAlignAttr *CreateImplicit(ASTContext &Ctx, ParamIdx ParamIndex, SourceRange Loc = SourceRange()) {
721 : auto *A = new (Ctx) AllocAlignAttr(Loc, Ctx, ParamIndex, 0);
722 : A->setImplicit(true);
723 : return A;
724 : }
725 :
726 : AllocAlignAttr(SourceRange R, ASTContext &Ctx
727 : , ParamIdx ParamIndex
728 : , unsigned SI
729 : )
730 48 : : InheritableAttr(attr::AllocAlign, R, SI, false, false)
731 48 : , paramIndex(ParamIndex)
732 : {
733 : }
734 :
735 : AllocAlignAttr *clone(ASTContext &C) const;
736 : void printPretty(raw_ostream &OS,
737 : const PrintingPolicy &Policy) const;
738 : const char *getSpelling() const;
739 0 : ParamIdx getParamIndex() const {
740 12 : return paramIndex;
741 : }
742 :
743 :
744 :
745 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AllocAlign; }
746 : };
747 :
748 : class AllocSizeAttr : public InheritableAttr {
749 : ParamIdx elemSizeParam;
750 :
751 : ParamIdx numElemsParam;
752 :
753 : public:
754 : static AllocSizeAttr *CreateImplicit(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, SourceRange Loc = SourceRange()) {
755 : auto *A = new (Ctx) AllocSizeAttr(Loc, Ctx, ElemSizeParam, NumElemsParam, 0);
756 : A->setImplicit(true);
757 : return A;
758 : }
759 :
760 : AllocSizeAttr(SourceRange R, ASTContext &Ctx
761 : , ParamIdx ElemSizeParam
762 : , ParamIdx NumElemsParam
763 : , unsigned SI
764 : )
765 33 : : InheritableAttr(attr::AllocSize, R, SI, false, false)
766 : , elemSizeParam(ElemSizeParam)
767 33 : , numElemsParam(NumElemsParam)
768 : {
769 : }
770 :
771 : AllocSizeAttr(SourceRange R, ASTContext &Ctx
772 : , ParamIdx ElemSizeParam
773 : , unsigned SI
774 : )
775 : : InheritableAttr(attr::AllocSize, R, SI, false, false)
776 : , elemSizeParam(ElemSizeParam)
777 : , numElemsParam()
778 : {
779 : }
780 :
781 : AllocSizeAttr *clone(ASTContext &C) const;
782 : void printPretty(raw_ostream &OS,
783 : const PrintingPolicy &Policy) const;
784 : const char *getSpelling() const;
785 0 : ParamIdx getElemSizeParam() const {
786 389 : return elemSizeParam;
787 : }
788 :
789 0 : ParamIdx getNumElemsParam() const {
790 345 : return numElemsParam;
791 : }
792 :
793 :
794 :
795 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AllocSize; }
796 : };
797 :
798 : class AlwaysDestroyAttr : public InheritableAttr {
799 : public:
800 : static AlwaysDestroyAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
801 : auto *A = new (Ctx) AlwaysDestroyAttr(Loc, Ctx, 0);
802 : A->setImplicit(true);
803 : return A;
804 : }
805 :
806 : AlwaysDestroyAttr(SourceRange R, ASTContext &Ctx
807 : , unsigned SI
808 : )
809 : : InheritableAttr(attr::AlwaysDestroy, R, SI, false, false)
810 : {
811 : }
812 :
813 : AlwaysDestroyAttr *clone(ASTContext &C) const;
814 : void printPretty(raw_ostream &OS,
815 : const PrintingPolicy &Policy) const;
816 : const char *getSpelling() const;
817 :
818 :
819 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AlwaysDestroy; }
820 : };
821 :
822 : class AlwaysInlineAttr : public InheritableAttr {
823 : public:
824 : enum Spelling {
825 : GNU_always_inline = 0,
826 : CXX11_gnu_always_inline = 1,
827 : Keyword_forceinline = 2
828 : };
829 :
830 84111 : static AlwaysInlineAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
831 84111 : auto *A = new (Ctx) AlwaysInlineAttr(Loc, Ctx, S);
832 : A->setImplicit(true);
833 84111 : return A;
834 : }
835 :
836 : AlwaysInlineAttr(SourceRange R, ASTContext &Ctx
837 : , unsigned SI
838 : )
839 : : InheritableAttr(attr::AlwaysInline, R, SI, false, false)
840 : {
841 : }
842 :
843 : AlwaysInlineAttr *clone(ASTContext &C) const;
844 : void printPretty(raw_ostream &OS,
845 : const PrintingPolicy &Policy) const;
846 : const char *getSpelling() const;
847 : Spelling getSemanticSpelling() const {
848 : switch (SpellingListIndex) {
849 : default: llvm_unreachable("Unknown spelling list index");
850 : case 0: return GNU_always_inline;
851 : case 1: return CXX11_gnu_always_inline;
852 : case 2: return Keyword_forceinline;
853 : }
854 : }
855 :
856 :
857 7 : static bool classof(const Attr *A) { return A->getKind() == attr::AlwaysInline; }
858 : };
859 :
860 : class AnalyzerNoReturnAttr : public InheritableAttr {
861 : public:
862 : static AnalyzerNoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
863 : auto *A = new (Ctx) AnalyzerNoReturnAttr(Loc, Ctx, 0);
864 : A->setImplicit(true);
865 : return A;
866 : }
867 :
868 : AnalyzerNoReturnAttr(SourceRange R, ASTContext &Ctx
869 : , unsigned SI
870 : )
871 : : InheritableAttr(attr::AnalyzerNoReturn, R, SI, false, false)
872 : {
873 : }
874 :
875 : AnalyzerNoReturnAttr *clone(ASTContext &C) const;
876 : void printPretty(raw_ostream &OS,
877 : const PrintingPolicy &Policy) const;
878 : const char *getSpelling() const;
879 :
880 :
881 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AnalyzerNoReturn; }
882 : };
883 :
884 : class AnnotateAttr : public InheritableParamAttr {
885 : unsigned annotationLength;
886 : char *annotation;
887 :
888 : public:
889 : static AnnotateAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, SourceRange Loc = SourceRange()) {
890 : auto *A = new (Ctx) AnnotateAttr(Loc, Ctx, Annotation, 0);
891 : A->setImplicit(true);
892 : return A;
893 : }
894 :
895 324 : AnnotateAttr(SourceRange R, ASTContext &Ctx
896 : , llvm::StringRef Annotation
897 : , unsigned SI
898 : )
899 324 : : InheritableParamAttr(attr::Annotate, R, SI, false, false)
900 324 : , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength])
901 : {
902 324 : if (!Annotation.empty())
903 648 : std::memcpy(annotation, Annotation.data(), annotationLength);
904 324 : }
905 :
906 : AnnotateAttr *clone(ASTContext &C) const;
907 : void printPretty(raw_ostream &OS,
908 : const PrintingPolicy &Policy) const;
909 : const char *getSpelling() const;
910 0 : llvm::StringRef getAnnotation() const {
911 261 : return llvm::StringRef(annotation, annotationLength);
912 : }
913 : unsigned getAnnotationLength() const {
914 : return annotationLength;
915 : }
916 : void setAnnotation(ASTContext &C, llvm::StringRef S) {
917 : annotationLength = S.size();
918 : this->annotation = new (C, 1) char [annotationLength];
919 : if (!S.empty())
920 : std::memcpy(this->annotation, S.data(), annotationLength);
921 : }
922 :
923 :
924 :
925 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Annotate; }
926 : };
927 :
928 : class AnyX86InterruptAttr : public InheritableAttr {
929 : public:
930 : static AnyX86InterruptAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
931 : auto *A = new (Ctx) AnyX86InterruptAttr(Loc, Ctx, 0);
932 : A->setImplicit(true);
933 : return A;
934 : }
935 :
936 : AnyX86InterruptAttr(SourceRange R, ASTContext &Ctx
937 : , unsigned SI
938 : )
939 : : InheritableAttr(attr::AnyX86Interrupt, R, SI, false, false)
940 : {
941 : }
942 :
943 : AnyX86InterruptAttr *clone(ASTContext &C) const;
944 : void printPretty(raw_ostream &OS,
945 : const PrintingPolicy &Policy) const;
946 : const char *getSpelling() const;
947 :
948 :
949 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AnyX86Interrupt; }
950 : };
951 :
952 : class AnyX86NoCallerSavedRegistersAttr : public InheritableAttr {
953 : public:
954 : static AnyX86NoCallerSavedRegistersAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
955 : auto *A = new (Ctx) AnyX86NoCallerSavedRegistersAttr(Loc, Ctx, 0);
956 : A->setImplicit(true);
957 : return A;
958 : }
959 :
960 : AnyX86NoCallerSavedRegistersAttr(SourceRange R, ASTContext &Ctx
961 : , unsigned SI
962 : )
963 : : InheritableAttr(attr::AnyX86NoCallerSavedRegisters, R, SI, false, false)
964 : {
965 : }
966 :
967 : AnyX86NoCallerSavedRegistersAttr *clone(ASTContext &C) const;
968 : void printPretty(raw_ostream &OS,
969 : const PrintingPolicy &Policy) const;
970 : const char *getSpelling() const;
971 :
972 :
973 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AnyX86NoCallerSavedRegisters; }
974 : };
975 :
976 : class AnyX86NoCfCheckAttr : public InheritableAttr {
977 : public:
978 : static AnyX86NoCfCheckAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
979 : auto *A = new (Ctx) AnyX86NoCfCheckAttr(Loc, Ctx, 0);
980 : A->setImplicit(true);
981 : return A;
982 : }
983 :
984 : AnyX86NoCfCheckAttr(SourceRange R, ASTContext &Ctx
985 : , unsigned SI
986 : )
987 : : InheritableAttr(attr::AnyX86NoCfCheck, R, SI, false, false)
988 : {
989 : }
990 :
991 : AnyX86NoCfCheckAttr *clone(ASTContext &C) const;
992 : void printPretty(raw_ostream &OS,
993 : const PrintingPolicy &Policy) const;
994 : const char *getSpelling() const;
995 :
996 :
997 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AnyX86NoCfCheck; }
998 : };
999 :
1000 : class ArcWeakrefUnavailableAttr : public InheritableAttr {
1001 : public:
1002 : static ArcWeakrefUnavailableAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1003 : auto *A = new (Ctx) ArcWeakrefUnavailableAttr(Loc, Ctx, 0);
1004 : A->setImplicit(true);
1005 : return A;
1006 : }
1007 :
1008 : ArcWeakrefUnavailableAttr(SourceRange R, ASTContext &Ctx
1009 : , unsigned SI
1010 : )
1011 : : InheritableAttr(attr::ArcWeakrefUnavailable, R, SI, false, false)
1012 : {
1013 : }
1014 :
1015 : ArcWeakrefUnavailableAttr *clone(ASTContext &C) const;
1016 : void printPretty(raw_ostream &OS,
1017 : const PrintingPolicy &Policy) const;
1018 : const char *getSpelling() const;
1019 :
1020 :
1021 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ArcWeakrefUnavailable; }
1022 : };
1023 :
1024 : class ArgumentWithTypeTagAttr : public InheritableAttr {
1025 : IdentifierInfo * argumentKind;
1026 :
1027 : ParamIdx argumentIdx;
1028 :
1029 : ParamIdx typeTagIdx;
1030 :
1031 : bool isPointer;
1032 :
1033 : public:
1034 : enum Spelling {
1035 : GNU_argument_with_type_tag = 0,
1036 : CXX11_clang_argument_with_type_tag = 1,
1037 : C2x_clang_argument_with_type_tag = 2,
1038 : GNU_pointer_with_type_tag = 3,
1039 : CXX11_clang_pointer_with_type_tag = 4,
1040 : C2x_clang_pointer_with_type_tag = 5
1041 : };
1042 :
1043 : static ArgumentWithTypeTagAttr *CreateImplicit(ASTContext &Ctx, Spelling S, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, SourceRange Loc = SourceRange()) {
1044 : auto *A = new (Ctx) ArgumentWithTypeTagAttr(Loc, Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer, S);
1045 : A->setImplicit(true);
1046 : return A;
1047 : }
1048 :
1049 : static ArgumentWithTypeTagAttr *CreateImplicit(ASTContext &Ctx, Spelling S, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, SourceRange Loc = SourceRange()) {
1050 : auto *A = new (Ctx) ArgumentWithTypeTagAttr(Loc, Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, S);
1051 : A->setImplicit(true);
1052 : return A;
1053 : }
1054 :
1055 : ArgumentWithTypeTagAttr(SourceRange R, ASTContext &Ctx
1056 : , IdentifierInfo * ArgumentKind
1057 : , ParamIdx ArgumentIdx
1058 : , ParamIdx TypeTagIdx
1059 : , bool IsPointer
1060 : , unsigned SI
1061 : )
1062 73 : : InheritableAttr(attr::ArgumentWithTypeTag, R, SI, false, false)
1063 : , argumentKind(ArgumentKind)
1064 : , argumentIdx(ArgumentIdx)
1065 : , typeTagIdx(TypeTagIdx)
1066 73 : , isPointer(IsPointer)
1067 : {
1068 : }
1069 :
1070 : ArgumentWithTypeTagAttr(SourceRange R, ASTContext &Ctx
1071 : , IdentifierInfo * ArgumentKind
1072 : , ParamIdx ArgumentIdx
1073 : , ParamIdx TypeTagIdx
1074 : , unsigned SI
1075 : )
1076 : : InheritableAttr(attr::ArgumentWithTypeTag, R, SI, false, false)
1077 : , argumentKind(ArgumentKind)
1078 : , argumentIdx(ArgumentIdx)
1079 : , typeTagIdx(TypeTagIdx)
1080 : , isPointer()
1081 : {
1082 : }
1083 :
1084 : ArgumentWithTypeTagAttr *clone(ASTContext &C) const;
1085 : void printPretty(raw_ostream &OS,
1086 : const PrintingPolicy &Policy) const;
1087 : const char *getSpelling() const;
1088 : Spelling getSemanticSpelling() const {
1089 : switch (SpellingListIndex) {
1090 : default: llvm_unreachable("Unknown spelling list index");
1091 : case 0: return GNU_argument_with_type_tag;
1092 : case 1: return CXX11_clang_argument_with_type_tag;
1093 : case 2: return C2x_clang_argument_with_type_tag;
1094 : case 3: return GNU_pointer_with_type_tag;
1095 : case 4: return CXX11_clang_pointer_with_type_tag;
1096 : case 5: return C2x_clang_pointer_with_type_tag;
1097 : }
1098 : }
1099 0 : IdentifierInfo * getArgumentKind() const {
1100 0 : return argumentKind;
1101 : }
1102 :
1103 0 : ParamIdx getArgumentIdx() const {
1104 386 : return argumentIdx;
1105 : }
1106 :
1107 0 : ParamIdx getTypeTagIdx() const {
1108 420 : return typeTagIdx;
1109 : }
1110 :
1111 0 : bool getIsPointer() const {
1112 0 : return isPointer;
1113 : }
1114 :
1115 :
1116 :
1117 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ArgumentWithTypeTag; }
1118 : };
1119 :
1120 : class ArtificialAttr : public InheritableAttr {
1121 : public:
1122 : static ArtificialAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1123 : auto *A = new (Ctx) ArtificialAttr(Loc, Ctx, 0);
1124 : A->setImplicit(true);
1125 : return A;
1126 : }
1127 :
1128 : ArtificialAttr(SourceRange R, ASTContext &Ctx
1129 : , unsigned SI
1130 : )
1131 : : InheritableAttr(attr::Artificial, R, SI, false, false)
1132 : {
1133 : }
1134 :
1135 : ArtificialAttr *clone(ASTContext &C) const;
1136 : void printPretty(raw_ostream &OS,
1137 : const PrintingPolicy &Policy) const;
1138 : const char *getSpelling() const;
1139 :
1140 :
1141 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Artificial; }
1142 : };
1143 :
1144 : class AsmLabelAttr : public InheritableAttr {
1145 : unsigned labelLength;
1146 : char *label;
1147 :
1148 : public:
1149 9 : static AsmLabelAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, SourceRange Loc = SourceRange()) {
1150 9 : auto *A = new (Ctx) AsmLabelAttr(Loc, Ctx, Label, 0);
1151 : A->setImplicit(true);
1152 9 : return A;
1153 : }
1154 :
1155 67895 : AsmLabelAttr(SourceRange R, ASTContext &Ctx
1156 : , llvm::StringRef Label
1157 : , unsigned SI
1158 : )
1159 67895 : : InheritableAttr(attr::AsmLabel, R, SI, false, false)
1160 67895 : , labelLength(Label.size()),label(new (Ctx, 1) char[labelLength])
1161 : {
1162 67895 : if (!Label.empty())
1163 135774 : std::memcpy(label, Label.data(), labelLength);
1164 67895 : }
1165 :
1166 : AsmLabelAttr *clone(ASTContext &C) const;
1167 : void printPretty(raw_ostream &OS,
1168 : const PrintingPolicy &Policy) const;
1169 : const char *getSpelling() const;
1170 0 : llvm::StringRef getLabel() const {
1171 625 : return llvm::StringRef(label, labelLength);
1172 : }
1173 : unsigned getLabelLength() const {
1174 : return labelLength;
1175 : }
1176 : void setLabel(ASTContext &C, llvm::StringRef S) {
1177 : labelLength = S.size();
1178 : this->label = new (C, 1) char [labelLength];
1179 : if (!S.empty())
1180 : std::memcpy(this->label, S.data(), labelLength);
1181 : }
1182 :
1183 :
1184 :
1185 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AsmLabel; }
1186 : };
1187 :
1188 : class AssertCapabilityAttr : public InheritableAttr {
1189 : unsigned args_Size;
1190 : Expr * *args_;
1191 :
1192 : public:
1193 : enum Spelling {
1194 : GNU_assert_capability = 0,
1195 : CXX11_clang_assert_capability = 1,
1196 : GNU_assert_shared_capability = 2,
1197 : CXX11_clang_assert_shared_capability = 3
1198 : };
1199 :
1200 : static AssertCapabilityAttr *CreateImplicit(ASTContext &Ctx, Spelling S, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
1201 : auto *A = new (Ctx) AssertCapabilityAttr(Loc, Ctx, Args, ArgsSize, S);
1202 : A->setImplicit(true);
1203 : return A;
1204 : }
1205 :
1206 42 : AssertCapabilityAttr(SourceRange R, ASTContext &Ctx
1207 : , Expr * *Args, unsigned ArgsSize
1208 : , unsigned SI
1209 : )
1210 42 : : InheritableAttr(attr::AssertCapability, R, SI, true, true)
1211 42 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
1212 : {
1213 42 : std::copy(Args, Args + args_Size, args_);
1214 42 : }
1215 :
1216 : AssertCapabilityAttr(SourceRange R, ASTContext &Ctx
1217 : , unsigned SI
1218 : )
1219 : : InheritableAttr(attr::AssertCapability, R, SI, true, true)
1220 : , args_Size(0), args_(nullptr)
1221 : {
1222 : }
1223 :
1224 : AssertCapabilityAttr *clone(ASTContext &C) const;
1225 : void printPretty(raw_ostream &OS,
1226 : const PrintingPolicy &Policy) const;
1227 : const char *getSpelling() const;
1228 : Spelling getSemanticSpelling() const {
1229 : switch (SpellingListIndex) {
1230 : default: llvm_unreachable("Unknown spelling list index");
1231 : case 0: return GNU_assert_capability;
1232 : case 1: return CXX11_clang_assert_capability;
1233 : case 2: return GNU_assert_shared_capability;
1234 : case 3: return CXX11_clang_assert_shared_capability;
1235 : }
1236 : }
1237 44 : bool isShared() const { return SpellingListIndex == 2 ||
1238 : SpellingListIndex == 3; }
1239 : typedef Expr ** args_iterator;
1240 0 : args_iterator args_begin() const { return args_; }
1241 58 : args_iterator args_end() const { return args_ + args_Size; }
1242 0 : unsigned args_size() const { return args_Size; }
1243 58 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
1244 :
1245 :
1246 :
1247 :
1248 : static bool classof(const Attr *A) { return A->getKind() == attr::AssertCapability; }
1249 : };
1250 :
1251 : class AssertExclusiveLockAttr : public InheritableAttr {
1252 : unsigned args_Size;
1253 : Expr * *args_;
1254 :
1255 : public:
1256 : static AssertExclusiveLockAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
1257 : auto *A = new (Ctx) AssertExclusiveLockAttr(Loc, Ctx, Args, ArgsSize, 0);
1258 : A->setImplicit(true);
1259 : return A;
1260 : }
1261 :
1262 21 : AssertExclusiveLockAttr(SourceRange R, ASTContext &Ctx
1263 : , Expr * *Args, unsigned ArgsSize
1264 : , unsigned SI
1265 : )
1266 21 : : InheritableAttr(attr::AssertExclusiveLock, R, SI, true, true)
1267 21 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
1268 : {
1269 21 : std::copy(Args, Args + args_Size, args_);
1270 21 : }
1271 :
1272 : AssertExclusiveLockAttr(SourceRange R, ASTContext &Ctx
1273 : , unsigned SI
1274 : )
1275 : : InheritableAttr(attr::AssertExclusiveLock, R, SI, true, true)
1276 : , args_Size(0), args_(nullptr)
1277 : {
1278 : }
1279 :
1280 : AssertExclusiveLockAttr *clone(ASTContext &C) const;
1281 : void printPretty(raw_ostream &OS,
1282 : const PrintingPolicy &Policy) const;
1283 : const char *getSpelling() const;
1284 : typedef Expr ** args_iterator;
1285 0 : args_iterator args_begin() const { return args_; }
1286 42 : args_iterator args_end() const { return args_ + args_Size; }
1287 0 : unsigned args_size() const { return args_Size; }
1288 42 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
1289 :
1290 :
1291 :
1292 :
1293 : static bool classof(const Attr *A) { return A->getKind() == attr::AssertExclusiveLock; }
1294 : };
1295 :
1296 : class AssertSharedLockAttr : public InheritableAttr {
1297 : unsigned args_Size;
1298 : Expr * *args_;
1299 :
1300 : public:
1301 : static AssertSharedLockAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
1302 : auto *A = new (Ctx) AssertSharedLockAttr(Loc, Ctx, Args, ArgsSize, 0);
1303 : A->setImplicit(true);
1304 : return A;
1305 : }
1306 :
1307 19 : AssertSharedLockAttr(SourceRange R, ASTContext &Ctx
1308 : , Expr * *Args, unsigned ArgsSize
1309 : , unsigned SI
1310 : )
1311 19 : : InheritableAttr(attr::AssertSharedLock, R, SI, true, true)
1312 19 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
1313 : {
1314 19 : std::copy(Args, Args + args_Size, args_);
1315 19 : }
1316 :
1317 : AssertSharedLockAttr(SourceRange R, ASTContext &Ctx
1318 : , unsigned SI
1319 : )
1320 : : InheritableAttr(attr::AssertSharedLock, R, SI, true, true)
1321 : , args_Size(0), args_(nullptr)
1322 : {
1323 : }
1324 :
1325 : AssertSharedLockAttr *clone(ASTContext &C) const;
1326 : void printPretty(raw_ostream &OS,
1327 : const PrintingPolicy &Policy) const;
1328 : const char *getSpelling() const;
1329 : typedef Expr ** args_iterator;
1330 0 : args_iterator args_begin() const { return args_; }
1331 16 : args_iterator args_end() const { return args_ + args_Size; }
1332 0 : unsigned args_size() const { return args_Size; }
1333 16 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
1334 :
1335 :
1336 :
1337 :
1338 : static bool classof(const Attr *A) { return A->getKind() == attr::AssertSharedLock; }
1339 : };
1340 :
1341 : class AssumeAlignedAttr : public InheritableAttr {
1342 : Expr * alignment;
1343 :
1344 : Expr * offset;
1345 :
1346 : public:
1347 : static AssumeAlignedAttr *CreateImplicit(ASTContext &Ctx, Expr * Alignment, Expr * Offset, SourceRange Loc = SourceRange()) {
1348 : auto *A = new (Ctx) AssumeAlignedAttr(Loc, Ctx, Alignment, Offset, 0);
1349 : A->setImplicit(true);
1350 : return A;
1351 : }
1352 :
1353 : AssumeAlignedAttr(SourceRange R, ASTContext &Ctx
1354 : , Expr * Alignment
1355 : , Expr * Offset
1356 : , unsigned SI
1357 : )
1358 46 : : InheritableAttr(attr::AssumeAligned, R, SI, false, false)
1359 : , alignment(Alignment)
1360 46 : , offset(Offset)
1361 : {
1362 : }
1363 :
1364 : AssumeAlignedAttr(SourceRange R, ASTContext &Ctx
1365 : , Expr * Alignment
1366 : , unsigned SI
1367 : )
1368 : : InheritableAttr(attr::AssumeAligned, R, SI, false, false)
1369 : , alignment(Alignment)
1370 : , offset()
1371 : {
1372 : }
1373 :
1374 : AssumeAlignedAttr *clone(ASTContext &C) const;
1375 : void printPretty(raw_ostream &OS,
1376 : const PrintingPolicy &Policy) const;
1377 : const char *getSpelling() const;
1378 0 : Expr * getAlignment() const {
1379 0 : return alignment;
1380 : }
1381 :
1382 0 : Expr * getOffset() const {
1383 0 : return offset;
1384 : }
1385 :
1386 :
1387 :
1388 0 : static bool classof(const Attr *A) { return A->getKind() == attr::AssumeAligned; }
1389 : };
1390 :
1391 : class AvailabilityAttr : public InheritableAttr {
1392 : IdentifierInfo * platform;
1393 :
1394 : VersionTuple introduced;
1395 :
1396 :
1397 : VersionTuple deprecated;
1398 :
1399 :
1400 : VersionTuple obsoleted;
1401 :
1402 :
1403 : bool unavailable;
1404 :
1405 : unsigned messageLength;
1406 : char *message;
1407 :
1408 : bool strict;
1409 :
1410 : unsigned replacementLength;
1411 : char *replacement;
1412 :
1413 : public:
1414 : 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()) {
1415 : auto *A = new (Ctx) AvailabilityAttr(Loc, Ctx, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, 0);
1416 : A->setImplicit(true);
1417 : return A;
1418 : }
1419 :
1420 1016 : AvailabilityAttr(SourceRange R, ASTContext &Ctx
1421 : , IdentifierInfo * Platform
1422 : , VersionTuple Introduced
1423 : , VersionTuple Deprecated
1424 : , VersionTuple Obsoleted
1425 : , bool Unavailable
1426 : , llvm::StringRef Message
1427 : , bool Strict
1428 : , llvm::StringRef Replacement
1429 : , unsigned SI
1430 : )
1431 1016 : : InheritableAttr(attr::Availability, R, SI, false, true)
1432 : , platform(Platform)
1433 : , introduced(Introduced)
1434 : , deprecated(Deprecated)
1435 : , obsoleted(Obsoleted)
1436 : , unavailable(Unavailable)
1437 1016 : , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
1438 : , strict(Strict)
1439 1016 : , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength])
1440 : {
1441 1016 : if (!Message.empty())
1442 40 : std::memcpy(message, Message.data(), messageLength);
1443 1016 : if (!Replacement.empty())
1444 16 : std::memcpy(replacement, Replacement.data(), replacementLength);
1445 1016 : }
1446 :
1447 : AvailabilityAttr *clone(ASTContext &C) const;
1448 : void printPretty(raw_ostream &OS,
1449 : const PrintingPolicy &Policy) const;
1450 : const char *getSpelling() const;
1451 0 : IdentifierInfo * getPlatform() const {
1452 0 : return platform;
1453 : }
1454 :
1455 0 : VersionTuple getIntroduced() const {
1456 2612 : return introduced;
1457 : }
1458 0 : void setIntroduced(ASTContext &C, VersionTuple V) {
1459 0 : introduced = V;
1460 0 : }
1461 :
1462 0 : VersionTuple getDeprecated() const {
1463 1152 : return deprecated;
1464 : }
1465 0 : void setDeprecated(ASTContext &C, VersionTuple V) {
1466 0 : deprecated = V;
1467 0 : }
1468 :
1469 0 : VersionTuple getObsoleted() const {
1470 917 : return obsoleted;
1471 : }
1472 0 : void setObsoleted(ASTContext &C, VersionTuple V) {
1473 0 : obsoleted = V;
1474 0 : }
1475 :
1476 0 : bool getUnavailable() const {
1477 0 : return unavailable;
1478 : }
1479 :
1480 0 : llvm::StringRef getMessage() const {
1481 1815 : return llvm::StringRef(message, messageLength);
1482 : }
1483 : unsigned getMessageLength() const {
1484 : return messageLength;
1485 : }
1486 0 : void setMessage(ASTContext &C, llvm::StringRef S) {
1487 0 : messageLength = S.size();
1488 0 : this->message = new (C, 1) char [messageLength];
1489 0 : if (!S.empty())
1490 0 : std::memcpy(this->message, S.data(), messageLength);
1491 0 : }
1492 :
1493 0 : bool getStrict() const {
1494 0 : return strict;
1495 : }
1496 :
1497 0 : llvm::StringRef getReplacement() const {
1498 359 : return llvm::StringRef(replacement, replacementLength);
1499 : }
1500 : unsigned getReplacementLength() const {
1501 : return replacementLength;
1502 : }
1503 0 : void setReplacement(ASTContext &C, llvm::StringRef S) {
1504 0 : replacementLength = S.size();
1505 0 : this->replacement = new (C, 1) char [replacementLength];
1506 0 : if (!S.empty())
1507 0 : std::memcpy(this->replacement, S.data(), replacementLength);
1508 0 : }
1509 :
1510 3707 : static llvm::StringRef getPrettyPlatformName(llvm::StringRef Platform) {
1511 3707 : return llvm::StringSwitch<llvm::StringRef>(Platform)
1512 3707 : .Case("android", "Android")
1513 3707 : .Case("ios", "iOS")
1514 3707 : .Case("macos", "macOS")
1515 3707 : .Case("tvos", "tvOS")
1516 3707 : .Case("watchos", "watchOS")
1517 3707 : .Case("ios_app_extension", "iOS (App Extension)")
1518 3707 : .Case("macos_app_extension", "macOS (App Extension)")
1519 3707 : .Case("tvos_app_extension", "tvOS (App Extension)")
1520 3707 : .Case("watchos_app_extension", "watchOS (App Extension)")
1521 3707 : .Default(llvm::StringRef());
1522 : }
1523 247 : static llvm::StringRef getPlatformNameSourceSpelling(llvm::StringRef Platform) {
1524 247 : return llvm::StringSwitch<llvm::StringRef>(Platform)
1525 247 : .Case("ios", "iOS")
1526 247 : .Case("macos", "macOS")
1527 247 : .Case("tvos", "tvOS")
1528 247 : .Case("watchos", "watchOS")
1529 247 : .Case("ios_app_extension", "iOSApplicationExtension")
1530 247 : .Case("macos_app_extension", "macOSApplicationExtension")
1531 247 : .Case("tvos_app_extension", "tvOSApplicationExtension")
1532 247 : .Case("watchos_app_extension", "watchOSApplicationExtension")
1533 247 : .Default(Platform);
1534 : }
1535 516 : static llvm::StringRef canonicalizePlatformName(llvm::StringRef Platform) {
1536 516 : return llvm::StringSwitch<llvm::StringRef>(Platform)
1537 516 : .Case("iOS", "ios")
1538 516 : .Case("macOS", "macos")
1539 516 : .Case("tvOS", "tvos")
1540 516 : .Case("watchOS", "watchos")
1541 516 : .Case("iOSApplicationExtension", "ios_app_extension")
1542 516 : .Case("macOSApplicationExtension", "macos_app_extension")
1543 516 : .Case("tvOSApplicationExtension", "tvos_app_extension")
1544 516 : .Case("watchOSApplicationExtension", "watchos_app_extension")
1545 516 : .Default(Platform);
1546 : }
1547 :
1548 10 : static bool classof(const Attr *A) { return A->getKind() == attr::Availability; }
1549 : };
1550 :
1551 : class BlocksAttr : public InheritableAttr {
1552 : public:
1553 : enum BlockType {
1554 : ByRef
1555 : };
1556 : private:
1557 : BlockType type;
1558 :
1559 : public:
1560 : static BlocksAttr *CreateImplicit(ASTContext &Ctx, BlockType Type, SourceRange Loc = SourceRange()) {
1561 : auto *A = new (Ctx) BlocksAttr(Loc, Ctx, Type, 0);
1562 : A->setImplicit(true);
1563 : return A;
1564 : }
1565 :
1566 : BlocksAttr(SourceRange R, ASTContext &Ctx
1567 : , BlockType Type
1568 : , unsigned SI
1569 : )
1570 410 : : InheritableAttr(attr::Blocks, R, SI, false, false)
1571 410 : , type(Type)
1572 : {
1573 : }
1574 :
1575 : BlocksAttr *clone(ASTContext &C) const;
1576 : void printPretty(raw_ostream &OS,
1577 : const PrintingPolicy &Policy) const;
1578 : const char *getSpelling() const;
1579 0 : BlockType getType() const {
1580 0 : return type;
1581 : }
1582 :
1583 402 : static bool ConvertStrToBlockType(StringRef Val, BlockType &Out) {
1584 402 : Optional<BlockType> R = llvm::StringSwitch<Optional<BlockType>>(Val)
1585 402 : .Case("byref", BlocksAttr::ByRef)
1586 : .Default(Optional<BlockType>());
1587 402 : if (R) {
1588 402 : Out = *R;
1589 402 : return true;
1590 : }
1591 : return false;
1592 : }
1593 :
1594 : static const char *ConvertBlockTypeToStr(BlockType Val) {
1595 2 : switch(Val) {
1596 2 : case BlocksAttr::ByRef: return "byref";
1597 : }
1598 0 : llvm_unreachable("No enumerator with that value");
1599 : }
1600 :
1601 :
1602 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Blocks; }
1603 : };
1604 :
1605 : class C11NoReturnAttr : public InheritableAttr {
1606 : public:
1607 : static C11NoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1608 : auto *A = new (Ctx) C11NoReturnAttr(Loc, Ctx, 0);
1609 : A->setImplicit(true);
1610 : return A;
1611 : }
1612 :
1613 : C11NoReturnAttr(SourceRange R, ASTContext &Ctx
1614 : , unsigned SI
1615 : )
1616 : : InheritableAttr(attr::C11NoReturn, R, SI, false, false)
1617 : {
1618 : }
1619 :
1620 : C11NoReturnAttr *clone(ASTContext &C) const;
1621 : void printPretty(raw_ostream &OS,
1622 : const PrintingPolicy &Policy) const;
1623 : const char *getSpelling() const;
1624 :
1625 :
1626 0 : static bool classof(const Attr *A) { return A->getKind() == attr::C11NoReturn; }
1627 : };
1628 :
1629 : class CDeclAttr : public InheritableAttr {
1630 : public:
1631 : static CDeclAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1632 : auto *A = new (Ctx) CDeclAttr(Loc, Ctx, 0);
1633 : A->setImplicit(true);
1634 : return A;
1635 : }
1636 :
1637 : CDeclAttr(SourceRange R, ASTContext &Ctx
1638 : , unsigned SI
1639 : )
1640 : : InheritableAttr(attr::CDecl, R, SI, false, false)
1641 : {
1642 : }
1643 :
1644 : CDeclAttr *clone(ASTContext &C) const;
1645 : void printPretty(raw_ostream &OS,
1646 : const PrintingPolicy &Policy) const;
1647 : const char *getSpelling() const;
1648 :
1649 :
1650 : static bool classof(const Attr *A) { return A->getKind() == attr::CDecl; }
1651 : };
1652 :
1653 : class CFAuditedTransferAttr : public InheritableAttr {
1654 : public:
1655 48 : static CFAuditedTransferAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1656 48 : auto *A = new (Ctx) CFAuditedTransferAttr(Loc, Ctx, 0);
1657 : A->setImplicit(true);
1658 48 : return A;
1659 : }
1660 :
1661 : CFAuditedTransferAttr(SourceRange R, ASTContext &Ctx
1662 : , unsigned SI
1663 : )
1664 : : InheritableAttr(attr::CFAuditedTransfer, R, SI, false, false)
1665 : {
1666 : }
1667 :
1668 : CFAuditedTransferAttr *clone(ASTContext &C) const;
1669 : void printPretty(raw_ostream &OS,
1670 : const PrintingPolicy &Policy) const;
1671 : const char *getSpelling() const;
1672 :
1673 :
1674 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CFAuditedTransfer; }
1675 : };
1676 :
1677 : class CFConsumedAttr : public InheritableParamAttr {
1678 : public:
1679 : static CFConsumedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1680 : auto *A = new (Ctx) CFConsumedAttr(Loc, Ctx, 0);
1681 : A->setImplicit(true);
1682 : return A;
1683 : }
1684 :
1685 : CFConsumedAttr(SourceRange R, ASTContext &Ctx
1686 : , unsigned SI
1687 : )
1688 : : InheritableParamAttr(attr::CFConsumed, R, SI, false, false)
1689 : {
1690 : }
1691 :
1692 : CFConsumedAttr *clone(ASTContext &C) const;
1693 : void printPretty(raw_ostream &OS,
1694 : const PrintingPolicy &Policy) const;
1695 : const char *getSpelling() const;
1696 :
1697 :
1698 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CFConsumed; }
1699 : };
1700 :
1701 : class CFReturnsNotRetainedAttr : public InheritableAttr {
1702 : public:
1703 : static CFReturnsNotRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1704 : auto *A = new (Ctx) CFReturnsNotRetainedAttr(Loc, Ctx, 0);
1705 : A->setImplicit(true);
1706 : return A;
1707 : }
1708 :
1709 : CFReturnsNotRetainedAttr(SourceRange R, ASTContext &Ctx
1710 : , unsigned SI
1711 : )
1712 : : InheritableAttr(attr::CFReturnsNotRetained, R, SI, false, false)
1713 : {
1714 : }
1715 :
1716 : CFReturnsNotRetainedAttr *clone(ASTContext &C) const;
1717 : void printPretty(raw_ostream &OS,
1718 : const PrintingPolicy &Policy) const;
1719 : const char *getSpelling() const;
1720 :
1721 :
1722 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CFReturnsNotRetained; }
1723 : };
1724 :
1725 : class CFReturnsRetainedAttr : public InheritableAttr {
1726 : public:
1727 : static CFReturnsRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1728 : auto *A = new (Ctx) CFReturnsRetainedAttr(Loc, Ctx, 0);
1729 : A->setImplicit(true);
1730 : return A;
1731 : }
1732 :
1733 : CFReturnsRetainedAttr(SourceRange R, ASTContext &Ctx
1734 : , unsigned SI
1735 : )
1736 : : InheritableAttr(attr::CFReturnsRetained, R, SI, false, false)
1737 : {
1738 : }
1739 :
1740 : CFReturnsRetainedAttr *clone(ASTContext &C) const;
1741 : void printPretty(raw_ostream &OS,
1742 : const PrintingPolicy &Policy) const;
1743 : const char *getSpelling() const;
1744 :
1745 :
1746 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CFReturnsRetained; }
1747 : };
1748 :
1749 : class CFUnknownTransferAttr : public InheritableAttr {
1750 : public:
1751 : static CFUnknownTransferAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1752 : auto *A = new (Ctx) CFUnknownTransferAttr(Loc, Ctx, 0);
1753 : A->setImplicit(true);
1754 : return A;
1755 : }
1756 :
1757 : CFUnknownTransferAttr(SourceRange R, ASTContext &Ctx
1758 : , unsigned SI
1759 : )
1760 : : InheritableAttr(attr::CFUnknownTransfer, R, SI, false, false)
1761 : {
1762 : }
1763 :
1764 : CFUnknownTransferAttr *clone(ASTContext &C) const;
1765 : void printPretty(raw_ostream &OS,
1766 : const PrintingPolicy &Policy) const;
1767 : const char *getSpelling() const;
1768 :
1769 :
1770 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CFUnknownTransfer; }
1771 : };
1772 :
1773 : class CPUDispatchAttr : public InheritableAttr {
1774 : unsigned cpus_Size;
1775 : IdentifierInfo * *cpus_;
1776 :
1777 : public:
1778 : static CPUDispatchAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Loc = SourceRange()) {
1779 : auto *A = new (Ctx) CPUDispatchAttr(Loc, Ctx, Cpus, CpusSize, 0);
1780 : A->setImplicit(true);
1781 : return A;
1782 : }
1783 :
1784 17 : CPUDispatchAttr(SourceRange R, ASTContext &Ctx
1785 : , IdentifierInfo * *Cpus, unsigned CpusSize
1786 : , unsigned SI
1787 : )
1788 17 : : InheritableAttr(attr::CPUDispatch, R, SI, false, false)
1789 17 : , cpus_Size(CpusSize), cpus_(new (Ctx, 16) IdentifierInfo *[cpus_Size])
1790 : {
1791 17 : std::copy(Cpus, Cpus + cpus_Size, cpus_);
1792 17 : }
1793 :
1794 : CPUDispatchAttr(SourceRange R, ASTContext &Ctx
1795 : , unsigned SI
1796 : )
1797 : : InheritableAttr(attr::CPUDispatch, R, SI, false, false)
1798 : , cpus_Size(0), cpus_(nullptr)
1799 : {
1800 : }
1801 :
1802 : CPUDispatchAttr *clone(ASTContext &C) const;
1803 : void printPretty(raw_ostream &OS,
1804 : const PrintingPolicy &Policy) const;
1805 : const char *getSpelling() const;
1806 : typedef IdentifierInfo ** cpus_iterator;
1807 0 : cpus_iterator cpus_begin() const { return cpus_; }
1808 8 : cpus_iterator cpus_end() const { return cpus_ + cpus_Size; }
1809 0 : unsigned cpus_size() const { return cpus_Size; }
1810 5 : llvm::iterator_range<cpus_iterator> cpus() const { return llvm::make_range(cpus_begin(), cpus_end()); }
1811 :
1812 :
1813 :
1814 :
1815 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CPUDispatch; }
1816 : };
1817 :
1818 : class CPUSpecificAttr : public InheritableAttr {
1819 : unsigned cpus_Size;
1820 : IdentifierInfo * *cpus_;
1821 :
1822 : public:
1823 : static CPUSpecificAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Loc = SourceRange()) {
1824 : auto *A = new (Ctx) CPUSpecificAttr(Loc, Ctx, Cpus, CpusSize, 0);
1825 : A->setImplicit(true);
1826 : return A;
1827 : }
1828 :
1829 55 : CPUSpecificAttr(SourceRange R, ASTContext &Ctx
1830 : , IdentifierInfo * *Cpus, unsigned CpusSize
1831 : , unsigned SI
1832 : )
1833 55 : : InheritableAttr(attr::CPUSpecific, R, SI, false, false)
1834 55 : , cpus_Size(CpusSize), cpus_(new (Ctx, 16) IdentifierInfo *[cpus_Size])
1835 : {
1836 55 : std::copy(Cpus, Cpus + cpus_Size, cpus_);
1837 55 : }
1838 :
1839 : CPUSpecificAttr(SourceRange R, ASTContext &Ctx
1840 : , unsigned SI
1841 : )
1842 : : InheritableAttr(attr::CPUSpecific, R, SI, false, false)
1843 : , cpus_Size(0), cpus_(nullptr)
1844 : {
1845 : }
1846 :
1847 : CPUSpecificAttr *clone(ASTContext &C) const;
1848 : void printPretty(raw_ostream &OS,
1849 : const PrintingPolicy &Policy) const;
1850 : const char *getSpelling() const;
1851 : typedef IdentifierInfo ** cpus_iterator;
1852 0 : cpus_iterator cpus_begin() const { return cpus_; }
1853 14 : cpus_iterator cpus_end() const { return cpus_ + cpus_Size; }
1854 0 : unsigned cpus_size() const { return cpus_Size; }
1855 28 : llvm::iterator_range<cpus_iterator> cpus() const { return llvm::make_range(cpus_begin(), cpus_end()); }
1856 :
1857 :
1858 :
1859 : unsigned ActiveArgIndex = 0;
1860 :
1861 : IdentifierInfo *getCurCPUName() const {
1862 25 : return *(cpus_begin() + ActiveArgIndex);
1863 : }
1864 :
1865 :
1866 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CPUSpecific; }
1867 : };
1868 :
1869 : class CUDAConstantAttr : public InheritableAttr {
1870 : public:
1871 : static CUDAConstantAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1872 : auto *A = new (Ctx) CUDAConstantAttr(Loc, Ctx, 0);
1873 : A->setImplicit(true);
1874 : return A;
1875 : }
1876 :
1877 : CUDAConstantAttr(SourceRange R, ASTContext &Ctx
1878 : , unsigned SI
1879 : )
1880 : : InheritableAttr(attr::CUDAConstant, R, SI, false, false)
1881 : {
1882 : }
1883 :
1884 : CUDAConstantAttr *clone(ASTContext &C) const;
1885 : void printPretty(raw_ostream &OS,
1886 : const PrintingPolicy &Policy) const;
1887 : const char *getSpelling() const;
1888 :
1889 :
1890 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CUDAConstant; }
1891 : };
1892 :
1893 : class CUDADeviceAttr : public InheritableAttr {
1894 : public:
1895 3082 : static CUDADeviceAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1896 3082 : auto *A = new (Ctx) CUDADeviceAttr(Loc, Ctx, 0);
1897 : A->setImplicit(true);
1898 3082 : return A;
1899 : }
1900 :
1901 : CUDADeviceAttr(SourceRange R, ASTContext &Ctx
1902 : , unsigned SI
1903 : )
1904 : : InheritableAttr(attr::CUDADevice, R, SI, false, false)
1905 : {
1906 : }
1907 :
1908 : CUDADeviceAttr *clone(ASTContext &C) const;
1909 : void printPretty(raw_ostream &OS,
1910 : const PrintingPolicy &Policy) const;
1911 : const char *getSpelling() const;
1912 :
1913 :
1914 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CUDADevice; }
1915 : };
1916 :
1917 : class CUDAGlobalAttr : public InheritableAttr {
1918 : public:
1919 : static CUDAGlobalAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1920 : auto *A = new (Ctx) CUDAGlobalAttr(Loc, Ctx, 0);
1921 : A->setImplicit(true);
1922 : return A;
1923 : }
1924 :
1925 : CUDAGlobalAttr(SourceRange R, ASTContext &Ctx
1926 : , unsigned SI
1927 : )
1928 : : InheritableAttr(attr::CUDAGlobal, R, SI, false, false)
1929 : {
1930 : }
1931 :
1932 : CUDAGlobalAttr *clone(ASTContext &C) const;
1933 : void printPretty(raw_ostream &OS,
1934 : const PrintingPolicy &Policy) const;
1935 : const char *getSpelling() const;
1936 :
1937 :
1938 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CUDAGlobal; }
1939 : };
1940 :
1941 : class CUDAHostAttr : public InheritableAttr {
1942 : public:
1943 2104 : static CUDAHostAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1944 2104 : auto *A = new (Ctx) CUDAHostAttr(Loc, Ctx, 0);
1945 : A->setImplicit(true);
1946 2104 : return A;
1947 : }
1948 :
1949 : CUDAHostAttr(SourceRange R, ASTContext &Ctx
1950 : , unsigned SI
1951 : )
1952 : : InheritableAttr(attr::CUDAHost, R, SI, false, false)
1953 : {
1954 : }
1955 :
1956 : CUDAHostAttr *clone(ASTContext &C) const;
1957 : void printPretty(raw_ostream &OS,
1958 : const PrintingPolicy &Policy) const;
1959 : const char *getSpelling() const;
1960 :
1961 :
1962 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CUDAHost; }
1963 : };
1964 :
1965 : class CUDAInvalidTargetAttr : public InheritableAttr {
1966 : public:
1967 15 : static CUDAInvalidTargetAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
1968 15 : auto *A = new (Ctx) CUDAInvalidTargetAttr(Loc, Ctx, 0);
1969 : A->setImplicit(true);
1970 15 : return A;
1971 : }
1972 :
1973 : CUDAInvalidTargetAttr(SourceRange R, ASTContext &Ctx
1974 : , unsigned SI
1975 : )
1976 : : InheritableAttr(attr::CUDAInvalidTarget, R, SI, false, false)
1977 : {
1978 : }
1979 :
1980 : CUDAInvalidTargetAttr *clone(ASTContext &C) const;
1981 : void printPretty(raw_ostream &OS,
1982 : const PrintingPolicy &Policy) const;
1983 : const char *getSpelling() const;
1984 :
1985 :
1986 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CUDAInvalidTarget; }
1987 : };
1988 :
1989 : class CUDALaunchBoundsAttr : public InheritableAttr {
1990 : Expr * maxThreads;
1991 :
1992 : Expr * minBlocks;
1993 :
1994 : public:
1995 : static CUDALaunchBoundsAttr *CreateImplicit(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, SourceRange Loc = SourceRange()) {
1996 : auto *A = new (Ctx) CUDALaunchBoundsAttr(Loc, Ctx, MaxThreads, MinBlocks, 0);
1997 : A->setImplicit(true);
1998 : return A;
1999 : }
2000 :
2001 : CUDALaunchBoundsAttr(SourceRange R, ASTContext &Ctx
2002 : , Expr * MaxThreads
2003 : , Expr * MinBlocks
2004 : , unsigned SI
2005 : )
2006 60 : : InheritableAttr(attr::CUDALaunchBounds, R, SI, false, false)
2007 : , maxThreads(MaxThreads)
2008 60 : , minBlocks(MinBlocks)
2009 : {
2010 : }
2011 :
2012 : CUDALaunchBoundsAttr(SourceRange R, ASTContext &Ctx
2013 : , Expr * MaxThreads
2014 : , unsigned SI
2015 : )
2016 : : InheritableAttr(attr::CUDALaunchBounds, R, SI, false, false)
2017 : , maxThreads(MaxThreads)
2018 : , minBlocks()
2019 : {
2020 : }
2021 :
2022 : CUDALaunchBoundsAttr *clone(ASTContext &C) const;
2023 : void printPretty(raw_ostream &OS,
2024 : const PrintingPolicy &Policy) const;
2025 : const char *getSpelling() const;
2026 0 : Expr * getMaxThreads() const {
2027 0 : return maxThreads;
2028 : }
2029 :
2030 0 : Expr * getMinBlocks() const {
2031 0 : return minBlocks;
2032 : }
2033 :
2034 :
2035 :
2036 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CUDALaunchBounds; }
2037 : };
2038 :
2039 : class CUDASharedAttr : public InheritableAttr {
2040 : public:
2041 : static CUDASharedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2042 : auto *A = new (Ctx) CUDASharedAttr(Loc, Ctx, 0);
2043 : A->setImplicit(true);
2044 : return A;
2045 : }
2046 :
2047 : CUDASharedAttr(SourceRange R, ASTContext &Ctx
2048 : , unsigned SI
2049 : )
2050 : : InheritableAttr(attr::CUDAShared, R, SI, false, false)
2051 : {
2052 : }
2053 :
2054 : CUDASharedAttr *clone(ASTContext &C) const;
2055 : void printPretty(raw_ostream &OS,
2056 : const PrintingPolicy &Policy) const;
2057 : const char *getSpelling() const;
2058 :
2059 :
2060 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CUDAShared; }
2061 : };
2062 :
2063 : class CXX11NoReturnAttr : public InheritableAttr {
2064 : public:
2065 : static CXX11NoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2066 : auto *A = new (Ctx) CXX11NoReturnAttr(Loc, Ctx, 0);
2067 : A->setImplicit(true);
2068 : return A;
2069 : }
2070 :
2071 : CXX11NoReturnAttr(SourceRange R, ASTContext &Ctx
2072 : , unsigned SI
2073 : )
2074 : : InheritableAttr(attr::CXX11NoReturn, R, SI, false, false)
2075 : {
2076 : }
2077 :
2078 : CXX11NoReturnAttr *clone(ASTContext &C) const;
2079 : void printPretty(raw_ostream &OS,
2080 : const PrintingPolicy &Policy) const;
2081 : const char *getSpelling() const;
2082 :
2083 :
2084 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CXX11NoReturn; }
2085 : };
2086 :
2087 : class CallableWhenAttr : public InheritableAttr {
2088 : public:
2089 : enum ConsumedState {
2090 : Unknown,
2091 : Consumed,
2092 : Unconsumed
2093 : };
2094 : private:
2095 : unsigned callableStates_Size;
2096 : ConsumedState *callableStates_;
2097 :
2098 : public:
2099 : static CallableWhenAttr *CreateImplicit(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, SourceRange Loc = SourceRange()) {
2100 : auto *A = new (Ctx) CallableWhenAttr(Loc, Ctx, CallableStates, CallableStatesSize, 0);
2101 : A->setImplicit(true);
2102 : return A;
2103 : }
2104 :
2105 18 : CallableWhenAttr(SourceRange R, ASTContext &Ctx
2106 : , ConsumedState *CallableStates, unsigned CallableStatesSize
2107 : , unsigned SI
2108 : )
2109 18 : : InheritableAttr(attr::CallableWhen, R, SI, false, false)
2110 18 : , callableStates_Size(CallableStatesSize), callableStates_(new (Ctx, 16) ConsumedState[callableStates_Size])
2111 : {
2112 18 : std::copy(CallableStates, CallableStates + callableStates_Size, callableStates_);
2113 18 : }
2114 :
2115 : CallableWhenAttr(SourceRange R, ASTContext &Ctx
2116 : , unsigned SI
2117 : )
2118 : : InheritableAttr(attr::CallableWhen, R, SI, false, false)
2119 : , callableStates_Size(0), callableStates_(nullptr)
2120 : {
2121 : }
2122 :
2123 : CallableWhenAttr *clone(ASTContext &C) const;
2124 : void printPretty(raw_ostream &OS,
2125 : const PrintingPolicy &Policy) const;
2126 : const char *getSpelling() const;
2127 : typedef ConsumedState* callableStates_iterator;
2128 0 : callableStates_iterator callableStates_begin() const { return callableStates_; }
2129 204 : callableStates_iterator callableStates_end() const { return callableStates_ + callableStates_Size; }
2130 0 : unsigned callableStates_size() const { return callableStates_Size; }
2131 204 : llvm::iterator_range<callableStates_iterator> callableStates() const { return llvm::make_range(callableStates_begin(), callableStates_end()); }
2132 :
2133 :
2134 19 : static bool ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) {
2135 19 : Optional<ConsumedState> R = llvm::StringSwitch<Optional<ConsumedState>>(Val)
2136 19 : .Case("unknown", CallableWhenAttr::Unknown)
2137 19 : .Case("consumed", CallableWhenAttr::Consumed)
2138 19 : .Case("unconsumed", CallableWhenAttr::Unconsumed)
2139 : .Default(Optional<ConsumedState>());
2140 19 : if (R) {
2141 18 : Out = *R;
2142 18 : return true;
2143 : }
2144 : return false;
2145 : }
2146 :
2147 : static const char *ConvertConsumedStateToStr(ConsumedState Val) {
2148 2 : switch(Val) {
2149 : case CallableWhenAttr::Unknown: return "unknown";
2150 1 : case CallableWhenAttr::Consumed: return "consumed";
2151 1 : case CallableWhenAttr::Unconsumed: return "unconsumed";
2152 : }
2153 0 : llvm_unreachable("No enumerator with that value");
2154 : }
2155 :
2156 :
2157 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CallableWhen; }
2158 : };
2159 :
2160 : class CapabilityAttr : public InheritableAttr {
2161 : unsigned nameLength;
2162 : char *name;
2163 :
2164 : public:
2165 : enum Spelling {
2166 : GNU_capability = 0,
2167 : CXX11_clang_capability = 1,
2168 : GNU_shared_capability = 2,
2169 : CXX11_clang_shared_capability = 3
2170 : };
2171 :
2172 : static CapabilityAttr *CreateImplicit(ASTContext &Ctx, Spelling S, llvm::StringRef Name, SourceRange Loc = SourceRange()) {
2173 : auto *A = new (Ctx) CapabilityAttr(Loc, Ctx, Name, S);
2174 : A->setImplicit(true);
2175 : return A;
2176 : }
2177 :
2178 78 : CapabilityAttr(SourceRange R, ASTContext &Ctx
2179 : , llvm::StringRef Name
2180 : , unsigned SI
2181 : )
2182 78 : : InheritableAttr(attr::Capability, R, SI, false, false)
2183 78 : , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
2184 : {
2185 78 : if (!Name.empty())
2186 156 : std::memcpy(name, Name.data(), nameLength);
2187 78 : }
2188 :
2189 : CapabilityAttr *clone(ASTContext &C) const;
2190 : void printPretty(raw_ostream &OS,
2191 : const PrintingPolicy &Policy) const;
2192 : const char *getSpelling() const;
2193 : Spelling getSemanticSpelling() const {
2194 : switch (SpellingListIndex) {
2195 : default: llvm_unreachable("Unknown spelling list index");
2196 : case 0: return GNU_capability;
2197 : case 1: return CXX11_clang_capability;
2198 : case 2: return GNU_shared_capability;
2199 : case 3: return CXX11_clang_shared_capability;
2200 : }
2201 : }
2202 : bool isShared() const { return SpellingListIndex == 2 ||
2203 : SpellingListIndex == 3; }
2204 0 : llvm::StringRef getName() const {
2205 3842 : return llvm::StringRef(name, nameLength);
2206 : }
2207 : unsigned getNameLength() const {
2208 : return nameLength;
2209 : }
2210 : void setName(ASTContext &C, llvm::StringRef S) {
2211 : nameLength = S.size();
2212 : this->name = new (C, 1) char [nameLength];
2213 : if (!S.empty())
2214 : std::memcpy(this->name, S.data(), nameLength);
2215 : }
2216 :
2217 :
2218 : bool isMutex() const { return getName().equals_lower("mutex"); }
2219 : bool isRole() const { return getName().equals_lower("role"); }
2220 :
2221 :
2222 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Capability; }
2223 : };
2224 :
2225 : class CapturedRecordAttr : public InheritableAttr {
2226 : public:
2227 292750 : static CapturedRecordAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2228 292750 : auto *A = new (Ctx) CapturedRecordAttr(Loc, Ctx, 0);
2229 : A->setImplicit(true);
2230 292750 : return A;
2231 : }
2232 :
2233 : CapturedRecordAttr(SourceRange R, ASTContext &Ctx
2234 : , unsigned SI
2235 : )
2236 : : InheritableAttr(attr::CapturedRecord, R, SI, false, false)
2237 : {
2238 : }
2239 :
2240 : CapturedRecordAttr *clone(ASTContext &C) const;
2241 : void printPretty(raw_ostream &OS,
2242 : const PrintingPolicy &Policy) const;
2243 : const char *getSpelling() const;
2244 :
2245 :
2246 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CapturedRecord; }
2247 : };
2248 :
2249 : class CarriesDependencyAttr : public InheritableParamAttr {
2250 : public:
2251 : static CarriesDependencyAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2252 : auto *A = new (Ctx) CarriesDependencyAttr(Loc, Ctx, 0);
2253 : A->setImplicit(true);
2254 : return A;
2255 : }
2256 :
2257 : CarriesDependencyAttr(SourceRange R, ASTContext &Ctx
2258 : , unsigned SI
2259 : )
2260 : : InheritableParamAttr(attr::CarriesDependency, R, SI, false, false)
2261 : {
2262 : }
2263 :
2264 : CarriesDependencyAttr *clone(ASTContext &C) const;
2265 : void printPretty(raw_ostream &OS,
2266 : const PrintingPolicy &Policy) const;
2267 : const char *getSpelling() const;
2268 :
2269 :
2270 0 : static bool classof(const Attr *A) { return A->getKind() == attr::CarriesDependency; }
2271 : };
2272 :
2273 : class CleanupAttr : public InheritableAttr {
2274 : FunctionDecl * functionDecl;
2275 :
2276 : public:
2277 : static CleanupAttr *CreateImplicit(ASTContext &Ctx, FunctionDecl * FunctionDecl, SourceRange Loc = SourceRange()) {
2278 : auto *A = new (Ctx) CleanupAttr(Loc, Ctx, FunctionDecl, 0);
2279 : A->setImplicit(true);
2280 : return A;
2281 : }
2282 :
2283 : CleanupAttr(SourceRange R, ASTContext &Ctx
2284 : , FunctionDecl * FunctionDecl
2285 : , unsigned SI
2286 : )
2287 27 : : InheritableAttr(attr::Cleanup, R, SI, false, false)
2288 27 : , functionDecl(FunctionDecl)
2289 : {
2290 : }
2291 :
2292 : CleanupAttr *clone(ASTContext &C) const;
2293 : void printPretty(raw_ostream &OS,
2294 : const PrintingPolicy &Policy) const;
2295 : const char *getSpelling() const;
2296 0 : FunctionDecl * getFunctionDecl() const {
2297 0 : return functionDecl;
2298 : }
2299 :
2300 :
2301 :
2302 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Cleanup; }
2303 : };
2304 :
2305 : class CodeSegAttr : public InheritableAttr {
2306 : unsigned nameLength;
2307 : char *name;
2308 :
2309 : public:
2310 : static CodeSegAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Loc = SourceRange()) {
2311 : auto *A = new (Ctx) CodeSegAttr(Loc, Ctx, Name, 0);
2312 : A->setImplicit(true);
2313 : return A;
2314 : }
2315 :
2316 195 : CodeSegAttr(SourceRange R, ASTContext &Ctx
2317 : , llvm::StringRef Name
2318 : , unsigned SI
2319 : )
2320 195 : : InheritableAttr(attr::CodeSeg, R, SI, false, false)
2321 195 : , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
2322 : {
2323 195 : if (!Name.empty())
2324 390 : std::memcpy(name, Name.data(), nameLength);
2325 195 : }
2326 :
2327 : CodeSegAttr *clone(ASTContext &C) const;
2328 : void printPretty(raw_ostream &OS,
2329 : const PrintingPolicy &Policy) const;
2330 : const char *getSpelling() const;
2331 0 : llvm::StringRef getName() const {
2332 271 : return llvm::StringRef(name, nameLength);
2333 : }
2334 : unsigned getNameLength() const {
2335 : return nameLength;
2336 : }
2337 : void setName(ASTContext &C, llvm::StringRef S) {
2338 : nameLength = S.size();
2339 : this->name = new (C, 1) char [nameLength];
2340 : if (!S.empty())
2341 : std::memcpy(this->name, S.data(), nameLength);
2342 : }
2343 :
2344 :
2345 :
2346 11 : static bool classof(const Attr *A) { return A->getKind() == attr::CodeSeg; }
2347 : };
2348 :
2349 : class ColdAttr : public InheritableAttr {
2350 : public:
2351 : static ColdAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2352 : auto *A = new (Ctx) ColdAttr(Loc, Ctx, 0);
2353 : A->setImplicit(true);
2354 : return A;
2355 : }
2356 :
2357 : ColdAttr(SourceRange R, ASTContext &Ctx
2358 : , unsigned SI
2359 : )
2360 : : InheritableAttr(attr::Cold, R, SI, false, false)
2361 : {
2362 : }
2363 :
2364 : ColdAttr *clone(ASTContext &C) const;
2365 : void printPretty(raw_ostream &OS,
2366 : const PrintingPolicy &Policy) const;
2367 : const char *getSpelling() const;
2368 :
2369 :
2370 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Cold; }
2371 : };
2372 :
2373 : class CommonAttr : public InheritableAttr {
2374 : public:
2375 : static CommonAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2376 : auto *A = new (Ctx) CommonAttr(Loc, Ctx, 0);
2377 : A->setImplicit(true);
2378 : return A;
2379 : }
2380 :
2381 : CommonAttr(SourceRange R, ASTContext &Ctx
2382 : , unsigned SI
2383 : )
2384 : : InheritableAttr(attr::Common, R, SI, false, false)
2385 : {
2386 : }
2387 :
2388 : CommonAttr *clone(ASTContext &C) const;
2389 : void printPretty(raw_ostream &OS,
2390 : const PrintingPolicy &Policy) const;
2391 : const char *getSpelling() const;
2392 :
2393 :
2394 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Common; }
2395 : };
2396 :
2397 : class ConstAttr : public InheritableAttr {
2398 : public:
2399 245296 : static ConstAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2400 245296 : auto *A = new (Ctx) ConstAttr(Loc, Ctx, 0);
2401 : A->setImplicit(true);
2402 245296 : return A;
2403 : }
2404 :
2405 : ConstAttr(SourceRange R, ASTContext &Ctx
2406 : , unsigned SI
2407 : )
2408 : : InheritableAttr(attr::Const, R, SI, false, false)
2409 : {
2410 : }
2411 :
2412 : ConstAttr *clone(ASTContext &C) const;
2413 : void printPretty(raw_ostream &OS,
2414 : const PrintingPolicy &Policy) const;
2415 : const char *getSpelling() const;
2416 :
2417 :
2418 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Const; }
2419 : };
2420 :
2421 : class ConstructorAttr : public InheritableAttr {
2422 : int priority;
2423 :
2424 : public:
2425 : static ConstructorAttr *CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Loc = SourceRange()) {
2426 : auto *A = new (Ctx) ConstructorAttr(Loc, Ctx, Priority, 0);
2427 : A->setImplicit(true);
2428 : return A;
2429 : }
2430 :
2431 : ConstructorAttr(SourceRange R, ASTContext &Ctx
2432 : , int Priority
2433 : , unsigned SI
2434 : )
2435 38 : : InheritableAttr(attr::Constructor, R, SI, false, false)
2436 38 : , priority(Priority)
2437 : {
2438 : }
2439 :
2440 : ConstructorAttr(SourceRange R, ASTContext &Ctx
2441 : , unsigned SI
2442 : )
2443 : : InheritableAttr(attr::Constructor, R, SI, false, false)
2444 : , priority()
2445 : {
2446 : }
2447 :
2448 : ConstructorAttr *clone(ASTContext &C) const;
2449 : void printPretty(raw_ostream &OS,
2450 : const PrintingPolicy &Policy) const;
2451 : const char *getSpelling() const;
2452 0 : int getPriority() const {
2453 0 : return priority;
2454 : }
2455 :
2456 : static const int DefaultPriority = 65535;
2457 :
2458 :
2459 :
2460 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Constructor; }
2461 : };
2462 :
2463 : class ConsumableAttr : public InheritableAttr {
2464 : public:
2465 : enum ConsumedState {
2466 : Unknown,
2467 : Consumed,
2468 : Unconsumed
2469 : };
2470 : private:
2471 : ConsumedState defaultState;
2472 :
2473 : public:
2474 : static ConsumableAttr *CreateImplicit(ASTContext &Ctx, ConsumedState DefaultState, SourceRange Loc = SourceRange()) {
2475 : auto *A = new (Ctx) ConsumableAttr(Loc, Ctx, DefaultState, 0);
2476 : A->setImplicit(true);
2477 : return A;
2478 : }
2479 :
2480 : ConsumableAttr(SourceRange R, ASTContext &Ctx
2481 : , ConsumedState DefaultState
2482 : , unsigned SI
2483 : )
2484 8 : : InheritableAttr(attr::Consumable, R, SI, false, false)
2485 8 : , defaultState(DefaultState)
2486 : {
2487 : }
2488 :
2489 : ConsumableAttr *clone(ASTContext &C) const;
2490 : void printPretty(raw_ostream &OS,
2491 : const PrintingPolicy &Policy) const;
2492 : const char *getSpelling() const;
2493 0 : ConsumedState getDefaultState() const {
2494 0 : return defaultState;
2495 : }
2496 :
2497 6 : static bool ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) {
2498 6 : Optional<ConsumedState> R = llvm::StringSwitch<Optional<ConsumedState>>(Val)
2499 6 : .Case("unknown", ConsumableAttr::Unknown)
2500 6 : .Case("consumed", ConsumableAttr::Consumed)
2501 6 : .Case("unconsumed", ConsumableAttr::Unconsumed)
2502 : .Default(Optional<ConsumedState>());
2503 6 : if (R) {
2504 6 : Out = *R;
2505 6 : return true;
2506 : }
2507 : return false;
2508 : }
2509 :
2510 : static const char *ConvertConsumedStateToStr(ConsumedState Val) {
2511 1 : switch(Val) {
2512 : case ConsumableAttr::Unknown: return "unknown";
2513 0 : case ConsumableAttr::Consumed: return "consumed";
2514 0 : case ConsumableAttr::Unconsumed: return "unconsumed";
2515 : }
2516 0 : llvm_unreachable("No enumerator with that value");
2517 : }
2518 :
2519 :
2520 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Consumable; }
2521 : };
2522 :
2523 : class ConsumableAutoCastAttr : public InheritableAttr {
2524 : public:
2525 : static ConsumableAutoCastAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2526 : auto *A = new (Ctx) ConsumableAutoCastAttr(Loc, Ctx, 0);
2527 : A->setImplicit(true);
2528 : return A;
2529 : }
2530 :
2531 : ConsumableAutoCastAttr(SourceRange R, ASTContext &Ctx
2532 : , unsigned SI
2533 : )
2534 : : InheritableAttr(attr::ConsumableAutoCast, R, SI, false, false)
2535 : {
2536 : }
2537 :
2538 : ConsumableAutoCastAttr *clone(ASTContext &C) const;
2539 : void printPretty(raw_ostream &OS,
2540 : const PrintingPolicy &Policy) const;
2541 : const char *getSpelling() const;
2542 :
2543 :
2544 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ConsumableAutoCast; }
2545 : };
2546 :
2547 : class ConsumableSetOnReadAttr : public InheritableAttr {
2548 : public:
2549 : static ConsumableSetOnReadAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2550 : auto *A = new (Ctx) ConsumableSetOnReadAttr(Loc, Ctx, 0);
2551 : A->setImplicit(true);
2552 : return A;
2553 : }
2554 :
2555 : ConsumableSetOnReadAttr(SourceRange R, ASTContext &Ctx
2556 : , unsigned SI
2557 : )
2558 : : InheritableAttr(attr::ConsumableSetOnRead, R, SI, false, false)
2559 : {
2560 : }
2561 :
2562 : ConsumableSetOnReadAttr *clone(ASTContext &C) const;
2563 : void printPretty(raw_ostream &OS,
2564 : const PrintingPolicy &Policy) const;
2565 : const char *getSpelling() const;
2566 :
2567 :
2568 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ConsumableSetOnRead; }
2569 : };
2570 :
2571 : class ConvergentAttr : public InheritableAttr {
2572 : public:
2573 : static ConvergentAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2574 : auto *A = new (Ctx) ConvergentAttr(Loc, Ctx, 0);
2575 : A->setImplicit(true);
2576 : return A;
2577 : }
2578 :
2579 : ConvergentAttr(SourceRange R, ASTContext &Ctx
2580 : , unsigned SI
2581 : )
2582 : : InheritableAttr(attr::Convergent, R, SI, false, false)
2583 : {
2584 : }
2585 :
2586 : ConvergentAttr *clone(ASTContext &C) const;
2587 : void printPretty(raw_ostream &OS,
2588 : const PrintingPolicy &Policy) const;
2589 : const char *getSpelling() const;
2590 :
2591 :
2592 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Convergent; }
2593 : };
2594 :
2595 : class DLLExportAttr : public InheritableAttr {
2596 : public:
2597 : static DLLExportAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2598 : auto *A = new (Ctx) DLLExportAttr(Loc, Ctx, 0);
2599 : A->setImplicit(true);
2600 : return A;
2601 : }
2602 :
2603 : DLLExportAttr(SourceRange R, ASTContext &Ctx
2604 : , unsigned SI
2605 : )
2606 : : InheritableAttr(attr::DLLExport, R, SI, false, false)
2607 : {
2608 : }
2609 :
2610 : DLLExportAttr *clone(ASTContext &C) const;
2611 : void printPretty(raw_ostream &OS,
2612 : const PrintingPolicy &Policy) const;
2613 : const char *getSpelling() const;
2614 :
2615 :
2616 4419 : static bool classof(const Attr *A) { return A->getKind() == attr::DLLExport; }
2617 : };
2618 :
2619 : class DLLImportAttr : public InheritableAttr {
2620 : public:
2621 : static DLLImportAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2622 : auto *A = new (Ctx) DLLImportAttr(Loc, Ctx, 0);
2623 : A->setImplicit(true);
2624 : return A;
2625 : }
2626 :
2627 : DLLImportAttr(SourceRange R, ASTContext &Ctx
2628 : , unsigned SI
2629 : )
2630 13038 : : InheritableAttr(attr::DLLImport, R, SI, false, false)
2631 : {
2632 : }
2633 :
2634 : DLLImportAttr *clone(ASTContext &C) const;
2635 : void printPretty(raw_ostream &OS,
2636 : const PrintingPolicy &Policy) const;
2637 : const char *getSpelling() const;
2638 :
2639 : private:
2640 : bool PropagatedToBaseTemplate = false;
2641 :
2642 : public:
2643 50 : void setPropagatedToBaseTemplate() { PropagatedToBaseTemplate = true; }
2644 0 : bool wasPropagatedToBaseTemplate() { return PropagatedToBaseTemplate; }
2645 :
2646 :
2647 5434 : static bool classof(const Attr *A) { return A->getKind() == attr::DLLImport; }
2648 : };
2649 :
2650 : class DeprecatedAttr : public InheritableAttr {
2651 : unsigned messageLength;
2652 : char *message;
2653 :
2654 : unsigned replacementLength;
2655 : char *replacement;
2656 :
2657 : public:
2658 : static DeprecatedAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, SourceRange Loc = SourceRange()) {
2659 : auto *A = new (Ctx) DeprecatedAttr(Loc, Ctx, Message, Replacement, 0);
2660 : A->setImplicit(true);
2661 : return A;
2662 : }
2663 :
2664 6293 : DeprecatedAttr(SourceRange R, ASTContext &Ctx
2665 : , llvm::StringRef Message
2666 : , llvm::StringRef Replacement
2667 : , unsigned SI
2668 : )
2669 6293 : : InheritableAttr(attr::Deprecated, R, SI, false, false)
2670 6293 : , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2671 6293 : , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength])
2672 : {
2673 6293 : if (!Message.empty())
2674 650 : std::memcpy(message, Message.data(), messageLength);
2675 6293 : if (!Replacement.empty())
2676 136 : std::memcpy(replacement, Replacement.data(), replacementLength);
2677 6293 : }
2678 :
2679 : DeprecatedAttr(SourceRange R, ASTContext &Ctx
2680 : , unsigned SI
2681 : )
2682 : : InheritableAttr(attr::Deprecated, R, SI, false, false)
2683 : , messageLength(0),message(nullptr)
2684 : , replacementLength(0),replacement(nullptr)
2685 : {
2686 : }
2687 :
2688 : DeprecatedAttr *clone(ASTContext &C) const;
2689 : void printPretty(raw_ostream &OS,
2690 : const PrintingPolicy &Policy) const;
2691 : const char *getSpelling() const;
2692 0 : llvm::StringRef getMessage() const {
2693 2711 : return llvm::StringRef(message, messageLength);
2694 : }
2695 : unsigned getMessageLength() const {
2696 : return messageLength;
2697 : }
2698 : void setMessage(ASTContext &C, llvm::StringRef S) {
2699 : messageLength = S.size();
2700 : this->message = new (C, 1) char [messageLength];
2701 : if (!S.empty())
2702 : std::memcpy(this->message, S.data(), messageLength);
2703 : }
2704 :
2705 0 : llvm::StringRef getReplacement() const {
2706 2508 : return llvm::StringRef(replacement, replacementLength);
2707 : }
2708 : unsigned getReplacementLength() const {
2709 : return replacementLength;
2710 : }
2711 : void setReplacement(ASTContext &C, llvm::StringRef S) {
2712 : replacementLength = S.size();
2713 : this->replacement = new (C, 1) char [replacementLength];
2714 : if (!S.empty())
2715 : std::memcpy(this->replacement, S.data(), replacementLength);
2716 : }
2717 :
2718 :
2719 :
2720 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Deprecated; }
2721 : };
2722 :
2723 : class DestructorAttr : public InheritableAttr {
2724 : int priority;
2725 :
2726 : public:
2727 : static DestructorAttr *CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Loc = SourceRange()) {
2728 : auto *A = new (Ctx) DestructorAttr(Loc, Ctx, Priority, 0);
2729 : A->setImplicit(true);
2730 : return A;
2731 : }
2732 :
2733 : DestructorAttr(SourceRange R, ASTContext &Ctx
2734 : , int Priority
2735 : , unsigned SI
2736 : )
2737 33 : : InheritableAttr(attr::Destructor, R, SI, false, false)
2738 33 : , priority(Priority)
2739 : {
2740 : }
2741 :
2742 : DestructorAttr(SourceRange R, ASTContext &Ctx
2743 : , unsigned SI
2744 : )
2745 : : InheritableAttr(attr::Destructor, R, SI, false, false)
2746 : , priority()
2747 : {
2748 : }
2749 :
2750 : DestructorAttr *clone(ASTContext &C) const;
2751 : void printPretty(raw_ostream &OS,
2752 : const PrintingPolicy &Policy) const;
2753 : const char *getSpelling() const;
2754 0 : int getPriority() const {
2755 0 : return priority;
2756 : }
2757 :
2758 : static const int DefaultPriority = 65535;
2759 :
2760 :
2761 :
2762 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Destructor; }
2763 : };
2764 :
2765 : class DiagnoseIfAttr : public InheritableAttr {
2766 : Expr * cond;
2767 :
2768 : unsigned messageLength;
2769 : char *message;
2770 :
2771 : public:
2772 : enum DiagnosticType {
2773 : DT_Error,
2774 : DT_Warning
2775 : };
2776 : private:
2777 : DiagnosticType diagnosticType;
2778 :
2779 : bool argDependent;
2780 :
2781 : NamedDecl * parent;
2782 :
2783 : public:
2784 : static DiagnoseIfAttr *CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, SourceRange Loc = SourceRange()) {
2785 : auto *A = new (Ctx) DiagnoseIfAttr(Loc, Ctx, Cond, Message, DiagnosticType, ArgDependent, Parent, 0);
2786 : A->setImplicit(true);
2787 : return A;
2788 : }
2789 :
2790 : static DiagnoseIfAttr *CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnosticType DiagnosticType, SourceRange Loc = SourceRange()) {
2791 : auto *A = new (Ctx) DiagnoseIfAttr(Loc, Ctx, Cond, Message, DiagnosticType, 0);
2792 : A->setImplicit(true);
2793 : return A;
2794 : }
2795 :
2796 83945 : DiagnoseIfAttr(SourceRange R, ASTContext &Ctx
2797 : , Expr * Cond
2798 : , llvm::StringRef Message
2799 : , DiagnosticType DiagnosticType
2800 : , bool ArgDependent
2801 : , NamedDecl * Parent
2802 : , unsigned SI
2803 : )
2804 83945 : : InheritableAttr(attr::DiagnoseIf, R, SI, true, true)
2805 : , cond(Cond)
2806 83945 : , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2807 : , diagnosticType(DiagnosticType)
2808 : , argDependent(ArgDependent)
2809 83945 : , parent(Parent)
2810 : {
2811 83945 : if (!Message.empty())
2812 167890 : std::memcpy(message, Message.data(), messageLength);
2813 83945 : }
2814 :
2815 : DiagnoseIfAttr(SourceRange R, ASTContext &Ctx
2816 : , Expr * Cond
2817 : , llvm::StringRef Message
2818 : , DiagnosticType DiagnosticType
2819 : , unsigned SI
2820 : )
2821 : : InheritableAttr(attr::DiagnoseIf, R, SI, true, true)
2822 : , cond(Cond)
2823 : , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2824 : , diagnosticType(DiagnosticType)
2825 : , argDependent()
2826 : , parent()
2827 : {
2828 : if (!Message.empty())
2829 : std::memcpy(message, Message.data(), messageLength);
2830 : }
2831 :
2832 : DiagnoseIfAttr *clone(ASTContext &C) const;
2833 : void printPretty(raw_ostream &OS,
2834 : const PrintingPolicy &Policy) const;
2835 : const char *getSpelling() const;
2836 0 : Expr * getCond() const {
2837 0 : return cond;
2838 : }
2839 :
2840 0 : llvm::StringRef getMessage() const {
2841 191 : return llvm::StringRef(message, messageLength);
2842 : }
2843 : unsigned getMessageLength() const {
2844 : return messageLength;
2845 : }
2846 : void setMessage(ASTContext &C, llvm::StringRef S) {
2847 : messageLength = S.size();
2848 : this->message = new (C, 1) char [messageLength];
2849 : if (!S.empty())
2850 : std::memcpy(this->message, S.data(), messageLength);
2851 : }
2852 :
2853 0 : DiagnosticType getDiagnosticType() const {
2854 0 : return diagnosticType;
2855 : }
2856 :
2857 77853 : static bool ConvertStrToDiagnosticType(StringRef Val, DiagnosticType &Out) {
2858 77853 : Optional<DiagnosticType> R = llvm::StringSwitch<Optional<DiagnosticType>>(Val)
2859 77853 : .Case("error", DiagnoseIfAttr::DT_Error)
2860 77853 : .Case("warning", DiagnoseIfAttr::DT_Warning)
2861 : .Default(Optional<DiagnosticType>());
2862 77853 : if (R) {
2863 77850 : Out = *R;
2864 77850 : return true;
2865 : }
2866 : return false;
2867 : }
2868 :
2869 : static const char *ConvertDiagnosticTypeToStr(DiagnosticType Val) {
2870 0 : switch(Val) {
2871 : case DiagnoseIfAttr::DT_Error: return "error";
2872 0 : case DiagnoseIfAttr::DT_Warning: return "warning";
2873 : }
2874 0 : llvm_unreachable("No enumerator with that value");
2875 : }
2876 0 : bool getArgDependent() const {
2877 0 : return argDependent;
2878 : }
2879 :
2880 0 : NamedDecl * getParent() const {
2881 0 : return parent;
2882 : }
2883 :
2884 :
2885 0 : bool isError() const { return diagnosticType == DT_Error; }
2886 : bool isWarning() const { return diagnosticType == DT_Warning; }
2887 :
2888 :
2889 0 : static bool classof(const Attr *A) { return A->getKind() == attr::DiagnoseIf; }
2890 : };
2891 :
2892 : class DisableTailCallsAttr : public InheritableAttr {
2893 : public:
2894 : static DisableTailCallsAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2895 : auto *A = new (Ctx) DisableTailCallsAttr(Loc, Ctx, 0);
2896 : A->setImplicit(true);
2897 : return A;
2898 : }
2899 :
2900 : DisableTailCallsAttr(SourceRange R, ASTContext &Ctx
2901 : , unsigned SI
2902 : )
2903 : : InheritableAttr(attr::DisableTailCalls, R, SI, false, false)
2904 : {
2905 : }
2906 :
2907 : DisableTailCallsAttr *clone(ASTContext &C) const;
2908 : void printPretty(raw_ostream &OS,
2909 : const PrintingPolicy &Policy) const;
2910 : const char *getSpelling() const;
2911 :
2912 :
2913 0 : static bool classof(const Attr *A) { return A->getKind() == attr::DisableTailCalls; }
2914 : };
2915 :
2916 : class EmptyBasesAttr : public InheritableAttr {
2917 : public:
2918 : static EmptyBasesAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
2919 : auto *A = new (Ctx) EmptyBasesAttr(Loc, Ctx, 0);
2920 : A->setImplicit(true);
2921 : return A;
2922 : }
2923 :
2924 : EmptyBasesAttr(SourceRange R, ASTContext &Ctx
2925 : , unsigned SI
2926 : )
2927 : : InheritableAttr(attr::EmptyBases, R, SI, false, false)
2928 : {
2929 : }
2930 :
2931 : EmptyBasesAttr *clone(ASTContext &C) const;
2932 : void printPretty(raw_ostream &OS,
2933 : const PrintingPolicy &Policy) const;
2934 : const char *getSpelling() const;
2935 :
2936 :
2937 0 : static bool classof(const Attr *A) { return A->getKind() == attr::EmptyBases; }
2938 : };
2939 :
2940 : class EnableIfAttr : public InheritableAttr {
2941 : Expr * cond;
2942 :
2943 : unsigned messageLength;
2944 : char *message;
2945 :
2946 : public:
2947 : static EnableIfAttr *CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, SourceRange Loc = SourceRange()) {
2948 : auto *A = new (Ctx) EnableIfAttr(Loc, Ctx, Cond, Message, 0);
2949 : A->setImplicit(true);
2950 : return A;
2951 : }
2952 :
2953 52406 : EnableIfAttr(SourceRange R, ASTContext &Ctx
2954 : , Expr * Cond
2955 : , llvm::StringRef Message
2956 : , unsigned SI
2957 : )
2958 52406 : : InheritableAttr(attr::EnableIf, R, SI, false, false)
2959 : , cond(Cond)
2960 52406 : , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
2961 : {
2962 52406 : if (!Message.empty())
2963 104812 : std::memcpy(message, Message.data(), messageLength);
2964 52406 : }
2965 :
2966 : EnableIfAttr *clone(ASTContext &C) const;
2967 : void printPretty(raw_ostream &OS,
2968 : const PrintingPolicy &Policy) const;
2969 : const char *getSpelling() const;
2970 0 : Expr * getCond() const {
2971 0 : return cond;
2972 : }
2973 :
2974 0 : llvm::StringRef getMessage() const {
2975 63 : return llvm::StringRef(message, messageLength);
2976 : }
2977 : unsigned getMessageLength() const {
2978 : return messageLength;
2979 : }
2980 : void setMessage(ASTContext &C, llvm::StringRef S) {
2981 : messageLength = S.size();
2982 : this->message = new (C, 1) char [messageLength];
2983 : if (!S.empty())
2984 : std::memcpy(this->message, S.data(), messageLength);
2985 : }
2986 :
2987 :
2988 :
2989 0 : static bool classof(const Attr *A) { return A->getKind() == attr::EnableIf; }
2990 : };
2991 :
2992 : class EnumExtensibilityAttr : public InheritableAttr {
2993 : public:
2994 : enum Kind {
2995 : Closed,
2996 : Open
2997 : };
2998 : private:
2999 : Kind extensibility;
3000 :
3001 : public:
3002 : static EnumExtensibilityAttr *CreateImplicit(ASTContext &Ctx, Kind Extensibility, SourceRange Loc = SourceRange()) {
3003 : auto *A = new (Ctx) EnumExtensibilityAttr(Loc, Ctx, Extensibility, 0);
3004 : A->setImplicit(true);
3005 : return A;
3006 : }
3007 :
3008 : EnumExtensibilityAttr(SourceRange R, ASTContext &Ctx
3009 : , Kind Extensibility
3010 : , unsigned SI
3011 : )
3012 15 : : InheritableAttr(attr::EnumExtensibility, R, SI, false, false)
3013 15 : , extensibility(Extensibility)
3014 : {
3015 : }
3016 :
3017 : EnumExtensibilityAttr *clone(ASTContext &C) const;
3018 : void printPretty(raw_ostream &OS,
3019 : const PrintingPolicy &Policy) const;
3020 : const char *getSpelling() const;
3021 0 : Kind getExtensibility() const {
3022 0 : return extensibility;
3023 : }
3024 :
3025 12 : static bool ConvertStrToKind(StringRef Val, Kind &Out) {
3026 12 : Optional<Kind> R = llvm::StringSwitch<Optional<Kind>>(Val)
3027 12 : .Case("closed", EnumExtensibilityAttr::Closed)
3028 12 : .Case("open", EnumExtensibilityAttr::Open)
3029 : .Default(Optional<Kind>());
3030 12 : if (R) {
3031 11 : Out = *R;
3032 11 : return true;
3033 : }
3034 : return false;
3035 : }
3036 :
3037 : static const char *ConvertKindToStr(Kind Val) {
3038 0 : switch(Val) {
3039 : case EnumExtensibilityAttr::Closed: return "closed";
3040 0 : case EnumExtensibilityAttr::Open: return "open";
3041 : }
3042 0 : llvm_unreachable("No enumerator with that value");
3043 : }
3044 :
3045 :
3046 0 : static bool classof(const Attr *A) { return A->getKind() == attr::EnumExtensibility; }
3047 : };
3048 :
3049 : class ExcludeFromExplicitInstantiationAttr : public InheritableAttr {
3050 : public:
3051 : static ExcludeFromExplicitInstantiationAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3052 : auto *A = new (Ctx) ExcludeFromExplicitInstantiationAttr(Loc, Ctx, 0);
3053 : A->setImplicit(true);
3054 : return A;
3055 : }
3056 :
3057 : ExcludeFromExplicitInstantiationAttr(SourceRange R, ASTContext &Ctx
3058 : , unsigned SI
3059 : )
3060 : : InheritableAttr(attr::ExcludeFromExplicitInstantiation, R, SI, false, false)
3061 : {
3062 : }
3063 :
3064 : ExcludeFromExplicitInstantiationAttr *clone(ASTContext &C) const;
3065 : void printPretty(raw_ostream &OS,
3066 : const PrintingPolicy &Policy) const;
3067 : const char *getSpelling() const;
3068 :
3069 :
3070 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ExcludeFromExplicitInstantiation; }
3071 : };
3072 :
3073 : class ExclusiveTrylockFunctionAttr : public InheritableAttr {
3074 : Expr * successValue;
3075 :
3076 : unsigned args_Size;
3077 : Expr * *args_;
3078 :
3079 : public:
3080 : static ExclusiveTrylockFunctionAttr *CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
3081 : auto *A = new (Ctx) ExclusiveTrylockFunctionAttr(Loc, Ctx, SuccessValue, Args, ArgsSize, 0);
3082 : A->setImplicit(true);
3083 : return A;
3084 : }
3085 :
3086 78 : ExclusiveTrylockFunctionAttr(SourceRange R, ASTContext &Ctx
3087 : , Expr * SuccessValue
3088 : , Expr * *Args, unsigned ArgsSize
3089 : , unsigned SI
3090 : )
3091 78 : : InheritableAttr(attr::ExclusiveTrylockFunction, R, SI, true, true)
3092 : , successValue(SuccessValue)
3093 78 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
3094 : {
3095 78 : std::copy(Args, Args + args_Size, args_);
3096 78 : }
3097 :
3098 : ExclusiveTrylockFunctionAttr(SourceRange R, ASTContext &Ctx
3099 : , Expr * SuccessValue
3100 : , unsigned SI
3101 : )
3102 : : InheritableAttr(attr::ExclusiveTrylockFunction, R, SI, true, true)
3103 : , successValue(SuccessValue)
3104 : , args_Size(0), args_(nullptr)
3105 : {
3106 : }
3107 :
3108 : ExclusiveTrylockFunctionAttr *clone(ASTContext &C) const;
3109 : void printPretty(raw_ostream &OS,
3110 : const PrintingPolicy &Policy) const;
3111 : const char *getSpelling() const;
3112 0 : Expr * getSuccessValue() const {
3113 0 : return successValue;
3114 : }
3115 :
3116 : typedef Expr ** args_iterator;
3117 0 : args_iterator args_begin() const { return args_; }
3118 179 : args_iterator args_end() const { return args_ + args_Size; }
3119 0 : unsigned args_size() const { return args_Size; }
3120 179 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
3121 :
3122 :
3123 :
3124 :
3125 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ExclusiveTrylockFunction; }
3126 : };
3127 :
3128 : class ExternalSourceSymbolAttr : public InheritableAttr {
3129 : unsigned languageLength;
3130 : char *language;
3131 :
3132 : unsigned definedInLength;
3133 : char *definedIn;
3134 :
3135 : bool generatedDeclaration;
3136 :
3137 : public:
3138 : static ExternalSourceSymbolAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, SourceRange Loc = SourceRange()) {
3139 : auto *A = new (Ctx) ExternalSourceSymbolAttr(Loc, Ctx, Language, DefinedIn, GeneratedDeclaration, 0);
3140 : A->setImplicit(true);
3141 : return A;
3142 : }
3143 :
3144 60 : ExternalSourceSymbolAttr(SourceRange R, ASTContext &Ctx
3145 : , llvm::StringRef Language
3146 : , llvm::StringRef DefinedIn
3147 : , bool GeneratedDeclaration
3148 : , unsigned SI
3149 : )
3150 60 : : InheritableAttr(attr::ExternalSourceSymbol, R, SI, false, false)
3151 60 : , languageLength(Language.size()),language(new (Ctx, 1) char[languageLength])
3152 60 : , definedInLength(DefinedIn.size()),definedIn(new (Ctx, 1) char[definedInLength])
3153 60 : , generatedDeclaration(GeneratedDeclaration)
3154 : {
3155 60 : if (!Language.empty())
3156 98 : std::memcpy(language, Language.data(), languageLength);
3157 60 : if (!DefinedIn.empty())
3158 94 : std::memcpy(definedIn, DefinedIn.data(), definedInLength);
3159 60 : }
3160 :
3161 : ExternalSourceSymbolAttr(SourceRange R, ASTContext &Ctx
3162 : , unsigned SI
3163 : )
3164 : : InheritableAttr(attr::ExternalSourceSymbol, R, SI, false, false)
3165 : , languageLength(0),language(nullptr)
3166 : , definedInLength(0),definedIn(nullptr)
3167 : , generatedDeclaration()
3168 : {
3169 : }
3170 :
3171 : ExternalSourceSymbolAttr *clone(ASTContext &C) const;
3172 : void printPretty(raw_ostream &OS,
3173 : const PrintingPolicy &Policy) const;
3174 : const char *getSpelling() const;
3175 0 : llvm::StringRef getLanguage() const {
3176 2 : return llvm::StringRef(language, languageLength);
3177 : }
3178 : unsigned getLanguageLength() const {
3179 : return languageLength;
3180 : }
3181 : void setLanguage(ASTContext &C, llvm::StringRef S) {
3182 : languageLength = S.size();
3183 : this->language = new (C, 1) char [languageLength];
3184 : if (!S.empty())
3185 : std::memcpy(this->language, S.data(), languageLength);
3186 : }
3187 :
3188 0 : llvm::StringRef getDefinedIn() const {
3189 38 : return llvm::StringRef(definedIn, definedInLength);
3190 : }
3191 : unsigned getDefinedInLength() const {
3192 : return definedInLength;
3193 : }
3194 : void setDefinedIn(ASTContext &C, llvm::StringRef S) {
3195 : definedInLength = S.size();
3196 : this->definedIn = new (C, 1) char [definedInLength];
3197 : if (!S.empty())
3198 : std::memcpy(this->definedIn, S.data(), definedInLength);
3199 : }
3200 :
3201 0 : bool getGeneratedDeclaration() const {
3202 0 : return generatedDeclaration;
3203 : }
3204 :
3205 :
3206 :
3207 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ExternalSourceSymbol; }
3208 : };
3209 :
3210 : class FallThroughAttr : public StmtAttr {
3211 : public:
3212 : static FallThroughAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3213 : auto *A = new (Ctx) FallThroughAttr(Loc, Ctx, 0);
3214 : A->setImplicit(true);
3215 : return A;
3216 : }
3217 :
3218 : FallThroughAttr(SourceRange R, ASTContext &Ctx
3219 : , unsigned SI
3220 : )
3221 : : StmtAttr(attr::FallThrough, R, SI, false)
3222 : {
3223 : }
3224 :
3225 : FallThroughAttr *clone(ASTContext &C) const;
3226 : void printPretty(raw_ostream &OS,
3227 : const PrintingPolicy &Policy) const;
3228 : const char *getSpelling() const;
3229 :
3230 :
3231 0 : static bool classof(const Attr *A) { return A->getKind() == attr::FallThrough; }
3232 : };
3233 :
3234 : class FastCallAttr : public InheritableAttr {
3235 : public:
3236 : static FastCallAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3237 : auto *A = new (Ctx) FastCallAttr(Loc, Ctx, 0);
3238 : A->setImplicit(true);
3239 : return A;
3240 : }
3241 :
3242 : FastCallAttr(SourceRange R, ASTContext &Ctx
3243 : , unsigned SI
3244 : )
3245 : : InheritableAttr(attr::FastCall, R, SI, false, false)
3246 : {
3247 : }
3248 :
3249 : FastCallAttr *clone(ASTContext &C) const;
3250 : void printPretty(raw_ostream &OS,
3251 : const PrintingPolicy &Policy) const;
3252 : const char *getSpelling() const;
3253 :
3254 :
3255 0 : static bool classof(const Attr *A) { return A->getKind() == attr::FastCall; }
3256 : };
3257 :
3258 : class FinalAttr : public InheritableAttr {
3259 : public:
3260 : enum Spelling {
3261 : Keyword_final = 0,
3262 : Keyword_sealed = 1
3263 : };
3264 :
3265 : static FinalAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
3266 : auto *A = new (Ctx) FinalAttr(Loc, Ctx, S);
3267 : A->setImplicit(true);
3268 : return A;
3269 : }
3270 :
3271 : FinalAttr(SourceRange R, ASTContext &Ctx
3272 : , unsigned SI
3273 : )
3274 : : InheritableAttr(attr::Final, R, SI, false, false)
3275 : {
3276 : }
3277 :
3278 : FinalAttr *clone(ASTContext &C) const;
3279 : void printPretty(raw_ostream &OS,
3280 : const PrintingPolicy &Policy) const;
3281 : const char *getSpelling() const;
3282 : Spelling getSemanticSpelling() const {
3283 : switch (SpellingListIndex) {
3284 : default: llvm_unreachable("Unknown spelling list index");
3285 : case 0: return Keyword_final;
3286 : case 1: return Keyword_sealed;
3287 : }
3288 : }
3289 27 : bool isSpelledAsSealed() const { return SpellingListIndex == 1; }
3290 :
3291 :
3292 6 : static bool classof(const Attr *A) { return A->getKind() == attr::Final; }
3293 : };
3294 :
3295 : class FlagEnumAttr : public InheritableAttr {
3296 : public:
3297 : static FlagEnumAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3298 : auto *A = new (Ctx) FlagEnumAttr(Loc, Ctx, 0);
3299 : A->setImplicit(true);
3300 : return A;
3301 : }
3302 :
3303 : FlagEnumAttr(SourceRange R, ASTContext &Ctx
3304 : , unsigned SI
3305 : )
3306 : : InheritableAttr(attr::FlagEnum, R, SI, false, false)
3307 : {
3308 : }
3309 :
3310 : FlagEnumAttr *clone(ASTContext &C) const;
3311 : void printPretty(raw_ostream &OS,
3312 : const PrintingPolicy &Policy) const;
3313 : const char *getSpelling() const;
3314 :
3315 :
3316 0 : static bool classof(const Attr *A) { return A->getKind() == attr::FlagEnum; }
3317 : };
3318 :
3319 : class FlattenAttr : public InheritableAttr {
3320 : public:
3321 : static FlattenAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3322 : auto *A = new (Ctx) FlattenAttr(Loc, Ctx, 0);
3323 : A->setImplicit(true);
3324 : return A;
3325 : }
3326 :
3327 : FlattenAttr(SourceRange R, ASTContext &Ctx
3328 : , unsigned SI
3329 : )
3330 : : InheritableAttr(attr::Flatten, R, SI, false, false)
3331 : {
3332 : }
3333 :
3334 : FlattenAttr *clone(ASTContext &C) const;
3335 : void printPretty(raw_ostream &OS,
3336 : const PrintingPolicy &Policy) const;
3337 : const char *getSpelling() const;
3338 :
3339 :
3340 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Flatten; }
3341 : };
3342 :
3343 : class FormatAttr : public InheritableAttr {
3344 : IdentifierInfo * type;
3345 :
3346 : int formatIdx;
3347 :
3348 : int firstArg;
3349 :
3350 : public:
3351 28587 : static FormatAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, SourceRange Loc = SourceRange()) {
3352 28587 : auto *A = new (Ctx) FormatAttr(Loc, Ctx, Type, FormatIdx, FirstArg, 0);
3353 : A->setImplicit(true);
3354 28587 : return A;
3355 : }
3356 :
3357 : FormatAttr(SourceRange R, ASTContext &Ctx
3358 : , IdentifierInfo * Type
3359 : , int FormatIdx
3360 : , int FirstArg
3361 : , unsigned SI
3362 : )
3363 67692 : : InheritableAttr(attr::Format, R, SI, false, false)
3364 : , type(Type)
3365 : , formatIdx(FormatIdx)
3366 67692 : , firstArg(FirstArg)
3367 : {
3368 : }
3369 :
3370 : FormatAttr *clone(ASTContext &C) const;
3371 : void printPretty(raw_ostream &OS,
3372 : const PrintingPolicy &Policy) const;
3373 : const char *getSpelling() const;
3374 0 : IdentifierInfo * getType() const {
3375 0 : return type;
3376 : }
3377 :
3378 0 : int getFormatIdx() const {
3379 0 : return formatIdx;
3380 : }
3381 :
3382 0 : int getFirstArg() const {
3383 0 : return firstArg;
3384 : }
3385 :
3386 :
3387 :
3388 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Format; }
3389 : };
3390 :
3391 : class FormatArgAttr : public InheritableAttr {
3392 : ParamIdx formatIdx;
3393 :
3394 : public:
3395 1 : static FormatArgAttr *CreateImplicit(ASTContext &Ctx, ParamIdx FormatIdx, SourceRange Loc = SourceRange()) {
3396 1 : auto *A = new (Ctx) FormatArgAttr(Loc, Ctx, FormatIdx, 0);
3397 : A->setImplicit(true);
3398 1 : return A;
3399 : }
3400 :
3401 : FormatArgAttr(SourceRange R, ASTContext &Ctx
3402 : , ParamIdx FormatIdx
3403 : , unsigned SI
3404 : )
3405 678 : : InheritableAttr(attr::FormatArg, R, SI, false, false)
3406 678 : , formatIdx(FormatIdx)
3407 : {
3408 : }
3409 :
3410 : FormatArgAttr *clone(ASTContext &C) const;
3411 : void printPretty(raw_ostream &OS,
3412 : const PrintingPolicy &Policy) const;
3413 : const char *getSpelling() const;
3414 0 : ParamIdx getFormatIdx() const {
3415 30 : return formatIdx;
3416 : }
3417 :
3418 :
3419 :
3420 0 : static bool classof(const Attr *A) { return A->getKind() == attr::FormatArg; }
3421 : };
3422 :
3423 : class GNUInlineAttr : public InheritableAttr {
3424 : public:
3425 : static GNUInlineAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3426 : auto *A = new (Ctx) GNUInlineAttr(Loc, Ctx, 0);
3427 : A->setImplicit(true);
3428 : return A;
3429 : }
3430 :
3431 : GNUInlineAttr(SourceRange R, ASTContext &Ctx
3432 : , unsigned SI
3433 : )
3434 : : InheritableAttr(attr::GNUInline, R, SI, false, false)
3435 : {
3436 : }
3437 :
3438 : GNUInlineAttr *clone(ASTContext &C) const;
3439 : void printPretty(raw_ostream &OS,
3440 : const PrintingPolicy &Policy) const;
3441 : const char *getSpelling() const;
3442 :
3443 :
3444 0 : static bool classof(const Attr *A) { return A->getKind() == attr::GNUInline; }
3445 : };
3446 :
3447 : class GuardedByAttr : public InheritableAttr {
3448 : Expr * arg;
3449 :
3450 : public:
3451 : static GuardedByAttr *CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Loc = SourceRange()) {
3452 : auto *A = new (Ctx) GuardedByAttr(Loc, Ctx, Arg, 0);
3453 : A->setImplicit(true);
3454 : return A;
3455 : }
3456 :
3457 : GuardedByAttr(SourceRange R, ASTContext &Ctx
3458 : , Expr * Arg
3459 : , unsigned SI
3460 : )
3461 575 : : InheritableAttr(attr::GuardedBy, R, SI, true, true)
3462 575 : , arg(Arg)
3463 : {
3464 : }
3465 :
3466 : GuardedByAttr *clone(ASTContext &C) const;
3467 : void printPretty(raw_ostream &OS,
3468 : const PrintingPolicy &Policy) const;
3469 : const char *getSpelling() const;
3470 0 : Expr * getArg() const {
3471 0 : return arg;
3472 : }
3473 :
3474 :
3475 :
3476 0 : static bool classof(const Attr *A) { return A->getKind() == attr::GuardedBy; }
3477 : };
3478 :
3479 : class GuardedVarAttr : public InheritableAttr {
3480 : public:
3481 : static GuardedVarAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3482 : auto *A = new (Ctx) GuardedVarAttr(Loc, Ctx, 0);
3483 : A->setImplicit(true);
3484 : return A;
3485 : }
3486 :
3487 : GuardedVarAttr(SourceRange R, ASTContext &Ctx
3488 : , unsigned SI
3489 : )
3490 : : InheritableAttr(attr::GuardedVar, R, SI, false, false)
3491 : {
3492 : }
3493 :
3494 : GuardedVarAttr *clone(ASTContext &C) const;
3495 : void printPretty(raw_ostream &OS,
3496 : const PrintingPolicy &Policy) const;
3497 : const char *getSpelling() const;
3498 :
3499 :
3500 0 : static bool classof(const Attr *A) { return A->getKind() == attr::GuardedVar; }
3501 : };
3502 :
3503 : class HotAttr : public InheritableAttr {
3504 : public:
3505 : static HotAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3506 : auto *A = new (Ctx) HotAttr(Loc, Ctx, 0);
3507 : A->setImplicit(true);
3508 : return A;
3509 : }
3510 :
3511 : HotAttr(SourceRange R, ASTContext &Ctx
3512 : , unsigned SI
3513 : )
3514 : : InheritableAttr(attr::Hot, R, SI, false, false)
3515 : {
3516 : }
3517 :
3518 : HotAttr *clone(ASTContext &C) const;
3519 : void printPretty(raw_ostream &OS,
3520 : const PrintingPolicy &Policy) const;
3521 : const char *getSpelling() const;
3522 :
3523 :
3524 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Hot; }
3525 : };
3526 :
3527 : class IBActionAttr : public InheritableAttr {
3528 : public:
3529 : static IBActionAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3530 : auto *A = new (Ctx) IBActionAttr(Loc, Ctx, 0);
3531 : A->setImplicit(true);
3532 : return A;
3533 : }
3534 :
3535 : IBActionAttr(SourceRange R, ASTContext &Ctx
3536 : , unsigned SI
3537 : )
3538 : : InheritableAttr(attr::IBAction, R, SI, false, false)
3539 : {
3540 : }
3541 :
3542 : IBActionAttr *clone(ASTContext &C) const;
3543 : void printPretty(raw_ostream &OS,
3544 : const PrintingPolicy &Policy) const;
3545 : const char *getSpelling() const;
3546 :
3547 :
3548 0 : static bool classof(const Attr *A) { return A->getKind() == attr::IBAction; }
3549 : };
3550 :
3551 : class IBOutletAttr : public InheritableAttr {
3552 : public:
3553 : static IBOutletAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3554 : auto *A = new (Ctx) IBOutletAttr(Loc, Ctx, 0);
3555 : A->setImplicit(true);
3556 : return A;
3557 : }
3558 :
3559 : IBOutletAttr(SourceRange R, ASTContext &Ctx
3560 : , unsigned SI
3561 : )
3562 : : InheritableAttr(attr::IBOutlet, R, SI, false, false)
3563 : {
3564 : }
3565 :
3566 : IBOutletAttr *clone(ASTContext &C) const;
3567 : void printPretty(raw_ostream &OS,
3568 : const PrintingPolicy &Policy) const;
3569 : const char *getSpelling() const;
3570 :
3571 :
3572 0 : static bool classof(const Attr *A) { return A->getKind() == attr::IBOutlet; }
3573 : };
3574 :
3575 : class IBOutletCollectionAttr : public InheritableAttr {
3576 : TypeSourceInfo * interface_;
3577 :
3578 : public:
3579 : static IBOutletCollectionAttr *CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Interface, SourceRange Loc = SourceRange()) {
3580 : auto *A = new (Ctx) IBOutletCollectionAttr(Loc, Ctx, Interface, 0);
3581 : A->setImplicit(true);
3582 : return A;
3583 : }
3584 :
3585 : IBOutletCollectionAttr(SourceRange R, ASTContext &Ctx
3586 : , TypeSourceInfo * Interface
3587 : , unsigned SI
3588 : )
3589 28 : : InheritableAttr(attr::IBOutletCollection, R, SI, false, false)
3590 28 : , interface_(Interface)
3591 : {
3592 : }
3593 :
3594 : IBOutletCollectionAttr(SourceRange R, ASTContext &Ctx
3595 : , unsigned SI
3596 : )
3597 : : InheritableAttr(attr::IBOutletCollection, R, SI, false, false)
3598 : , interface_()
3599 : {
3600 : }
3601 :
3602 : IBOutletCollectionAttr *clone(ASTContext &C) const;
3603 : void printPretty(raw_ostream &OS,
3604 : const PrintingPolicy &Policy) const;
3605 : const char *getSpelling() const;
3606 0 : QualType getInterface() const {
3607 0 : return interface_->getType();
3608 0 : } TypeSourceInfo * getInterfaceLoc() const {
3609 0 : return interface_;
3610 : }
3611 :
3612 :
3613 :
3614 0 : static bool classof(const Attr *A) { return A->getKind() == attr::IBOutletCollection; }
3615 : };
3616 :
3617 : class IFuncAttr : public Attr {
3618 : unsigned resolverLength;
3619 : char *resolver;
3620 :
3621 : public:
3622 : static IFuncAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Resolver, SourceRange Loc = SourceRange()) {
3623 : auto *A = new (Ctx) IFuncAttr(Loc, Ctx, Resolver, 0);
3624 : A->setImplicit(true);
3625 : return A;
3626 : }
3627 :
3628 11 : IFuncAttr(SourceRange R, ASTContext &Ctx
3629 : , llvm::StringRef Resolver
3630 : , unsigned SI
3631 : )
3632 11 : : Attr(attr::IFunc, R, SI, false)
3633 11 : , resolverLength(Resolver.size()),resolver(new (Ctx, 1) char[resolverLength])
3634 : {
3635 11 : if (!Resolver.empty())
3636 22 : std::memcpy(resolver, Resolver.data(), resolverLength);
3637 11 : }
3638 :
3639 : IFuncAttr *clone(ASTContext &C) const;
3640 : void printPretty(raw_ostream &OS,
3641 : const PrintingPolicy &Policy) const;
3642 : const char *getSpelling() const;
3643 0 : llvm::StringRef getResolver() const {
3644 19 : return llvm::StringRef(resolver, resolverLength);
3645 : }
3646 : unsigned getResolverLength() const {
3647 : return resolverLength;
3648 : }
3649 : void setResolver(ASTContext &C, llvm::StringRef S) {
3650 : resolverLength = S.size();
3651 : this->resolver = new (C, 1) char [resolverLength];
3652 : if (!S.empty())
3653 : std::memcpy(this->resolver, S.data(), resolverLength);
3654 : }
3655 :
3656 :
3657 :
3658 1 : static bool classof(const Attr *A) { return A->getKind() == attr::IFunc; }
3659 : };
3660 :
3661 : class InitPriorityAttr : public InheritableAttr {
3662 : unsigned priority;
3663 :
3664 : public:
3665 : static InitPriorityAttr *CreateImplicit(ASTContext &Ctx, unsigned Priority, SourceRange Loc = SourceRange()) {
3666 : auto *A = new (Ctx) InitPriorityAttr(Loc, Ctx, Priority, 0);
3667 : A->setImplicit(true);
3668 : return A;
3669 : }
3670 :
3671 : InitPriorityAttr(SourceRange R, ASTContext &Ctx
3672 : , unsigned Priority
3673 : , unsigned SI
3674 : )
3675 815 : : InheritableAttr(attr::InitPriority, R, SI, false, false)
3676 815 : , priority(Priority)
3677 : {
3678 : }
3679 :
3680 : InitPriorityAttr *clone(ASTContext &C) const;
3681 : void printPretty(raw_ostream &OS,
3682 : const PrintingPolicy &Policy) const;
3683 : const char *getSpelling() const;
3684 0 : unsigned getPriority() const {
3685 0 : return priority;
3686 : }
3687 :
3688 :
3689 :
3690 0 : static bool classof(const Attr *A) { return A->getKind() == attr::InitPriority; }
3691 : };
3692 :
3693 : class InitSegAttr : public Attr {
3694 : unsigned sectionLength;
3695 : char *section;
3696 :
3697 : public:
3698 10 : static InitSegAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Section, SourceRange Loc = SourceRange()) {
3699 10 : auto *A = new (Ctx) InitSegAttr(Loc, Ctx, Section, 0);
3700 : A->setImplicit(true);
3701 10 : return A;
3702 : }
3703 :
3704 12 : InitSegAttr(SourceRange R, ASTContext &Ctx
3705 : , llvm::StringRef Section
3706 : , unsigned SI
3707 : )
3708 12 : : Attr(attr::InitSeg, R, SI, false)
3709 12 : , sectionLength(Section.size()),section(new (Ctx, 1) char[sectionLength])
3710 : {
3711 12 : if (!Section.empty())
3712 24 : std::memcpy(section, Section.data(), sectionLength);
3713 12 : }
3714 :
3715 : InitSegAttr *clone(ASTContext &C) const;
3716 : void printPretty(raw_ostream &OS,
3717 : const PrintingPolicy &Policy) const;
3718 : const char *getSpelling() const;
3719 0 : llvm::StringRef getSection() const {
3720 8 : return llvm::StringRef(section, sectionLength);
3721 : }
3722 : unsigned getSectionLength() const {
3723 : return sectionLength;
3724 : }
3725 : void setSection(ASTContext &C, llvm::StringRef S) {
3726 : sectionLength = S.size();
3727 : this->section = new (C, 1) char [sectionLength];
3728 : if (!S.empty())
3729 : std::memcpy(this->section, S.data(), sectionLength);
3730 : }
3731 :
3732 :
3733 0 : void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
3734 0 : OS << " (" << getSection() << ')';
3735 0 : }
3736 :
3737 :
3738 0 : static bool classof(const Attr *A) { return A->getKind() == attr::InitSeg; }
3739 : };
3740 :
3741 : class IntelOclBiccAttr : public InheritableAttr {
3742 : public:
3743 : static IntelOclBiccAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3744 : auto *A = new (Ctx) IntelOclBiccAttr(Loc, Ctx, 0);
3745 : A->setImplicit(true);
3746 : return A;
3747 : }
3748 :
3749 : IntelOclBiccAttr(SourceRange R, ASTContext &Ctx
3750 : , unsigned SI
3751 : )
3752 : : InheritableAttr(attr::IntelOclBicc, R, SI, false, false)
3753 : {
3754 : }
3755 :
3756 : IntelOclBiccAttr *clone(ASTContext &C) const;
3757 : void printPretty(raw_ostream &OS,
3758 : const PrintingPolicy &Policy) const;
3759 : const char *getSpelling() const;
3760 :
3761 :
3762 0 : static bool classof(const Attr *A) { return A->getKind() == attr::IntelOclBicc; }
3763 : };
3764 :
3765 : class InternalLinkageAttr : public InheritableAttr {
3766 : public:
3767 : static InternalLinkageAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3768 : auto *A = new (Ctx) InternalLinkageAttr(Loc, Ctx, 0);
3769 : A->setImplicit(true);
3770 : return A;
3771 : }
3772 :
3773 : InternalLinkageAttr(SourceRange R, ASTContext &Ctx
3774 : , unsigned SI
3775 : )
3776 : : InheritableAttr(attr::InternalLinkage, R, SI, false, false)
3777 : {
3778 : }
3779 :
3780 : InternalLinkageAttr *clone(ASTContext &C) const;
3781 : void printPretty(raw_ostream &OS,
3782 : const PrintingPolicy &Policy) const;
3783 : const char *getSpelling() const;
3784 :
3785 :
3786 3 : static bool classof(const Attr *A) { return A->getKind() == attr::InternalLinkage; }
3787 : };
3788 :
3789 : class LTOVisibilityPublicAttr : public InheritableAttr {
3790 : public:
3791 : static LTOVisibilityPublicAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3792 : auto *A = new (Ctx) LTOVisibilityPublicAttr(Loc, Ctx, 0);
3793 : A->setImplicit(true);
3794 : return A;
3795 : }
3796 :
3797 : LTOVisibilityPublicAttr(SourceRange R, ASTContext &Ctx
3798 : , unsigned SI
3799 : )
3800 : : InheritableAttr(attr::LTOVisibilityPublic, R, SI, false, false)
3801 : {
3802 : }
3803 :
3804 : LTOVisibilityPublicAttr *clone(ASTContext &C) const;
3805 : void printPretty(raw_ostream &OS,
3806 : const PrintingPolicy &Policy) const;
3807 : const char *getSpelling() const;
3808 :
3809 :
3810 0 : static bool classof(const Attr *A) { return A->getKind() == attr::LTOVisibilityPublic; }
3811 : };
3812 :
3813 : class LayoutVersionAttr : public InheritableAttr {
3814 : unsigned version;
3815 :
3816 : public:
3817 : static LayoutVersionAttr *CreateImplicit(ASTContext &Ctx, unsigned Version, SourceRange Loc = SourceRange()) {
3818 : auto *A = new (Ctx) LayoutVersionAttr(Loc, Ctx, Version, 0);
3819 : A->setImplicit(true);
3820 : return A;
3821 : }
3822 :
3823 : LayoutVersionAttr(SourceRange R, ASTContext &Ctx
3824 : , unsigned Version
3825 : , unsigned SI
3826 : )
3827 1 : : InheritableAttr(attr::LayoutVersion, R, SI, false, false)
3828 1 : , version(Version)
3829 : {
3830 : }
3831 :
3832 : LayoutVersionAttr *clone(ASTContext &C) const;
3833 : void printPretty(raw_ostream &OS,
3834 : const PrintingPolicy &Policy) const;
3835 : const char *getSpelling() const;
3836 0 : unsigned getVersion() const {
3837 0 : return version;
3838 : }
3839 :
3840 :
3841 :
3842 0 : static bool classof(const Attr *A) { return A->getKind() == attr::LayoutVersion; }
3843 : };
3844 :
3845 : class LifetimeBoundAttr : public InheritableAttr {
3846 : public:
3847 : static LifetimeBoundAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
3848 : auto *A = new (Ctx) LifetimeBoundAttr(Loc, Ctx, 0);
3849 : A->setImplicit(true);
3850 : return A;
3851 : }
3852 :
3853 : LifetimeBoundAttr(SourceRange R, ASTContext &Ctx
3854 : , unsigned SI
3855 : )
3856 : : InheritableAttr(attr::LifetimeBound, R, SI, false, false)
3857 : {
3858 : }
3859 :
3860 : LifetimeBoundAttr *clone(ASTContext &C) const;
3861 : void printPretty(raw_ostream &OS,
3862 : const PrintingPolicy &Policy) const;
3863 : const char *getSpelling() const;
3864 :
3865 :
3866 0 : static bool classof(const Attr *A) { return A->getKind() == attr::LifetimeBound; }
3867 : };
3868 :
3869 : class LockReturnedAttr : public InheritableAttr {
3870 : Expr * arg;
3871 :
3872 : public:
3873 : static LockReturnedAttr *CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Loc = SourceRange()) {
3874 : auto *A = new (Ctx) LockReturnedAttr(Loc, Ctx, Arg, 0);
3875 : A->setImplicit(true);
3876 : return A;
3877 : }
3878 :
3879 : LockReturnedAttr(SourceRange R, ASTContext &Ctx
3880 : , Expr * Arg
3881 : , unsigned SI
3882 : )
3883 87 : : InheritableAttr(attr::LockReturned, R, SI, true, false)
3884 87 : , arg(Arg)
3885 : {
3886 : }
3887 :
3888 : LockReturnedAttr *clone(ASTContext &C) const;
3889 : void printPretty(raw_ostream &OS,
3890 : const PrintingPolicy &Policy) const;
3891 : const char *getSpelling() const;
3892 0 : Expr * getArg() const {
3893 0 : return arg;
3894 : }
3895 :
3896 :
3897 :
3898 0 : static bool classof(const Attr *A) { return A->getKind() == attr::LockReturned; }
3899 : };
3900 :
3901 : class LocksExcludedAttr : public InheritableAttr {
3902 : unsigned args_Size;
3903 : Expr * *args_;
3904 :
3905 : public:
3906 : static LocksExcludedAttr *CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
3907 : auto *A = new (Ctx) LocksExcludedAttr(Loc, Ctx, Args, ArgsSize, 0);
3908 : A->setImplicit(true);
3909 : return A;
3910 : }
3911 :
3912 154 : LocksExcludedAttr(SourceRange R, ASTContext &Ctx
3913 : , Expr * *Args, unsigned ArgsSize
3914 : , unsigned SI
3915 : )
3916 154 : : InheritableAttr(attr::LocksExcluded, R, SI, true, true)
3917 154 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
3918 : {
3919 154 : std::copy(Args, Args + args_Size, args_);
3920 154 : }
3921 :
3922 : LocksExcludedAttr(SourceRange R, ASTContext &Ctx
3923 : , unsigned SI
3924 : )
3925 : : InheritableAttr(attr::LocksExcluded, R, SI, true, true)
3926 : , args_Size(0), args_(nullptr)
3927 : {
3928 : }
3929 :
3930 : LocksExcludedAttr *clone(ASTContext &C) const;
3931 : void printPretty(raw_ostream &OS,
3932 : const PrintingPolicy &Policy) const;
3933 : const char *getSpelling() const;
3934 : typedef Expr ** args_iterator;
3935 0 : args_iterator args_begin() const { return args_; }
3936 246 : args_iterator args_end() const { return args_ + args_Size; }
3937 0 : unsigned args_size() const { return args_Size; }
3938 242 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
3939 :
3940 :
3941 :
3942 :
3943 0 : static bool classof(const Attr *A) { return A->getKind() == attr::LocksExcluded; }
3944 : };
3945 :
3946 : class LoopHintAttr : public Attr {
3947 : public:
3948 : enum OptionType {
3949 : Vectorize,
3950 : VectorizeWidth,
3951 : Interleave,
3952 : InterleaveCount,
3953 : Unroll,
3954 : UnrollCount,
3955 : UnrollAndJam,
3956 : UnrollAndJamCount,
3957 : Distribute
3958 : };
3959 : private:
3960 : OptionType option;
3961 :
3962 : public:
3963 : enum LoopHintState {
3964 : Enable,
3965 : Disable,
3966 : Numeric,
3967 : AssumeSafety,
3968 : Full
3969 : };
3970 : private:
3971 : LoopHintState state;
3972 :
3973 : Expr * value;
3974 :
3975 : public:
3976 : enum Spelling {
3977 : Pragma_clang_loop = 0,
3978 : Pragma_unroll = 1,
3979 : Pragma_nounroll = 2,
3980 : Pragma_unroll_and_jam = 3,
3981 : Pragma_nounroll_and_jam = 4
3982 : };
3983 :
3984 240 : static LoopHintAttr *CreateImplicit(ASTContext &Ctx, Spelling S, OptionType Option, LoopHintState State, Expr * Value, SourceRange Loc = SourceRange()) {
3985 240 : auto *A = new (Ctx) LoopHintAttr(Loc, Ctx, Option, State, Value, S);
3986 : A->setImplicit(true);
3987 240 : return A;
3988 : }
3989 :
3990 : LoopHintAttr(SourceRange R, ASTContext &Ctx
3991 : , OptionType Option
3992 : , LoopHintState State
3993 : , Expr * Value
3994 : , unsigned SI
3995 : )
3996 258 : : Attr(attr::LoopHint, R, SI, false)
3997 : , option(Option)
3998 : , state(State)
3999 258 : , value(Value)
4000 : {
4001 : }
4002 :
4003 : LoopHintAttr *clone(ASTContext &C) const;
4004 : void printPretty(raw_ostream &OS,
4005 : const PrintingPolicy &Policy) const;
4006 : const char *getSpelling() const;
4007 : Spelling getSemanticSpelling() const {
4008 27 : switch (SpellingListIndex) {
4009 0 : default: llvm_unreachable("Unknown spelling list index");
4010 : case 0: return Pragma_clang_loop;
4011 : case 1: return Pragma_unroll;
4012 : case 2: return Pragma_nounroll;
4013 : case 3: return Pragma_unroll_and_jam;
4014 : case 4: return Pragma_nounroll_and_jam;
4015 : }
4016 : }
4017 0 : OptionType getOption() const {
4018 0 : return option;
4019 : }
4020 :
4021 : static bool ConvertStrToOptionType(StringRef Val, OptionType &Out) {
4022 : Optional<OptionType> R = llvm::StringSwitch<Optional<OptionType>>(Val)
4023 : .Case("vectorize", LoopHintAttr::Vectorize)
4024 : .Case("vectorize_width", LoopHintAttr::VectorizeWidth)
4025 : .Case("interleave", LoopHintAttr::Interleave)
4026 : .Case("interleave_count", LoopHintAttr::InterleaveCount)
4027 : .Case("unroll", LoopHintAttr::Unroll)
4028 : .Case("unroll_count", LoopHintAttr::UnrollCount)
4029 : .Case("unroll_and_jam", LoopHintAttr::UnrollAndJam)
4030 : .Case("unroll_and_jam_count", LoopHintAttr::UnrollAndJamCount)
4031 : .Case("distribute", LoopHintAttr::Distribute)
4032 : .Default(Optional<OptionType>());
4033 : if (R) {
4034 : Out = *R;
4035 : return true;
4036 : }
4037 : return false;
4038 : }
4039 :
4040 : static const char *ConvertOptionTypeToStr(OptionType Val) {
4041 : switch(Val) {
4042 : case LoopHintAttr::Vectorize: return "vectorize";
4043 : case LoopHintAttr::VectorizeWidth: return "vectorize_width";
4044 : case LoopHintAttr::Interleave: return "interleave";
4045 : case LoopHintAttr::InterleaveCount: return "interleave_count";
4046 : case LoopHintAttr::Unroll: return "unroll";
4047 : case LoopHintAttr::UnrollCount: return "unroll_count";
4048 : case LoopHintAttr::UnrollAndJam: return "unroll_and_jam";
4049 : case LoopHintAttr::UnrollAndJamCount: return "unroll_and_jam_count";
4050 : case LoopHintAttr::Distribute: return "distribute";
4051 : }
4052 : llvm_unreachable("No enumerator with that value");
4053 : }
4054 0 : LoopHintState getState() const {
4055 0 : return state;
4056 : }
4057 :
4058 : static bool ConvertStrToLoopHintState(StringRef Val, LoopHintState &Out) {
4059 : Optional<LoopHintState> R = llvm::StringSwitch<Optional<LoopHintState>>(Val)
4060 : .Case("enable", LoopHintAttr::Enable)
4061 : .Case("disable", LoopHintAttr::Disable)
4062 : .Case("numeric", LoopHintAttr::Numeric)
4063 : .Case("assume_safety", LoopHintAttr::AssumeSafety)
4064 : .Case("full", LoopHintAttr::Full)
4065 : .Default(Optional<LoopHintState>());
4066 : if (R) {
4067 : Out = *R;
4068 : return true;
4069 : }
4070 : return false;
4071 : }
4072 :
4073 : static const char *ConvertLoopHintStateToStr(LoopHintState Val) {
4074 : switch(Val) {
4075 : case LoopHintAttr::Enable: return "enable";
4076 : case LoopHintAttr::Disable: return "disable";
4077 : case LoopHintAttr::Numeric: return "numeric";
4078 : case LoopHintAttr::AssumeSafety: return "assume_safety";
4079 : case LoopHintAttr::Full: return "full";
4080 : }
4081 : llvm_unreachable("No enumerator with that value");
4082 : }
4083 0 : Expr * getValue() const {
4084 0 : return value;
4085 : }
4086 :
4087 :
4088 76 : static const char *getOptionName(int Option) {
4089 76 : switch(Option) {
4090 : case Vectorize: return "vectorize";
4091 13 : case VectorizeWidth: return "vectorize_width";
4092 12 : case Interleave: return "interleave";
4093 13 : case InterleaveCount: return "interleave_count";
4094 11 : case Unroll: return "unroll";
4095 7 : case UnrollCount: return "unroll_count";
4096 0 : case UnrollAndJam: return "unroll_and_jam";
4097 0 : case UnrollAndJamCount: return "unroll_and_jam_count";
4098 8 : case Distribute: return "distribute";
4099 : }
4100 0 : llvm_unreachable("Unhandled LoopHint option.");
4101 : }
4102 :
4103 42 : void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
4104 : unsigned SpellingIndex = getSpellingListIndex();
4105 : // For "#pragma unroll" and "#pragma nounroll" the string "unroll" or
4106 : // "nounroll" is already emitted as the pragma name.
4107 42 : if (SpellingIndex == Pragma_nounroll || SpellingIndex == Pragma_nounroll_and_jam)
4108 : return;
4109 41 : else if (SpellingIndex == Pragma_unroll || SpellingIndex == Pragma_unroll_and_jam) {
4110 2 : OS << ' ' << getValueString(Policy);
4111 2 : return;
4112 : }
4113 :
4114 : assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
4115 78 : OS << ' ' << getOptionName(option) << getValueString(Policy);
4116 : }
4117 :
4118 : // Return a string containing the loop hint argument including the
4119 : // enclosing parentheses.
4120 85 : std::string getValueString(const PrintingPolicy &Policy) const {
4121 : std::string ValueName;
4122 85 : llvm::raw_string_ostream OS(ValueName);
4123 85 : OS << "(";
4124 85 : if (state == Numeric)
4125 82 : value->printPretty(OS, nullptr, Policy);
4126 44 : else if (state == Enable)
4127 16 : OS << "enable";
4128 28 : else if (state == Full)
4129 5 : OS << "full";
4130 23 : else if (state == AssumeSafety)
4131 2 : OS << "assume_safety";
4132 : else
4133 21 : OS << "disable";
4134 85 : OS << ")";
4135 85 : return OS.str();
4136 : }
4137 :
4138 : // Return a string suitable for identifying this attribute in diagnostics.
4139 52 : std::string getDiagnosticName(const PrintingPolicy &Policy) const {
4140 : unsigned SpellingIndex = getSpellingListIndex();
4141 52 : if (SpellingIndex == Pragma_nounroll)
4142 3 : return "#pragma nounroll";
4143 49 : else if (SpellingIndex == Pragma_unroll)
4144 20 : return "#pragma unroll" + (option == UnrollCount ? getValueString(Policy) : "");
4145 39 : else if (SpellingIndex == Pragma_nounroll_and_jam)
4146 1 : return "#pragma nounroll_and_jam";
4147 38 : else if (SpellingIndex == Pragma_unroll_and_jam)
4148 : return "#pragma unroll_and_jam" +
4149 2 : (option == UnrollAndJamCount ? getValueString(Policy) : "");
4150 :
4151 : assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
4152 74 : return getOptionName(option) + getValueString(Policy);
4153 : }
4154 :
4155 :
4156 0 : static bool classof(const Attr *A) { return A->getKind() == attr::LoopHint; }
4157 : };
4158 :
4159 : class MSABIAttr : public InheritableAttr {
4160 : public:
4161 : static MSABIAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4162 : auto *A = new (Ctx) MSABIAttr(Loc, Ctx, 0);
4163 : A->setImplicit(true);
4164 : return A;
4165 : }
4166 :
4167 : MSABIAttr(SourceRange R, ASTContext &Ctx
4168 : , unsigned SI
4169 : )
4170 : : InheritableAttr(attr::MSABI, R, SI, false, false)
4171 : {
4172 : }
4173 :
4174 : MSABIAttr *clone(ASTContext &C) const;
4175 : void printPretty(raw_ostream &OS,
4176 : const PrintingPolicy &Policy) const;
4177 : const char *getSpelling() const;
4178 :
4179 :
4180 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MSABI; }
4181 : };
4182 :
4183 : class MSInheritanceAttr : public InheritableAttr {
4184 : bool bestCase;
4185 :
4186 : public:
4187 : enum Spelling {
4188 : Keyword_single_inheritance = 0,
4189 : Keyword_multiple_inheritance = 1,
4190 : Keyword_virtual_inheritance = 2,
4191 : Keyword_unspecified_inheritance = 3
4192 : };
4193 :
4194 556 : static MSInheritanceAttr *CreateImplicit(ASTContext &Ctx, Spelling S, bool BestCase, SourceRange Loc = SourceRange()) {
4195 556 : auto *A = new (Ctx) MSInheritanceAttr(Loc, Ctx, BestCase, S);
4196 : A->setImplicit(true);
4197 556 : return A;
4198 : }
4199 :
4200 : static MSInheritanceAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
4201 : auto *A = new (Ctx) MSInheritanceAttr(Loc, Ctx, S);
4202 : A->setImplicit(true);
4203 : return A;
4204 : }
4205 :
4206 : MSInheritanceAttr(SourceRange R, ASTContext &Ctx
4207 : , bool BestCase
4208 : , unsigned SI
4209 : )
4210 631 : : InheritableAttr(attr::MSInheritance, R, SI, false, false)
4211 631 : , bestCase(BestCase)
4212 : {
4213 : }
4214 :
4215 : MSInheritanceAttr(SourceRange R, ASTContext &Ctx
4216 : , unsigned SI
4217 : )
4218 : : InheritableAttr(attr::MSInheritance, R, SI, false, false)
4219 : , bestCase()
4220 : {
4221 : }
4222 :
4223 : MSInheritanceAttr *clone(ASTContext &C) const;
4224 : void printPretty(raw_ostream &OS,
4225 : const PrintingPolicy &Policy) const;
4226 : const char *getSpelling() const;
4227 : Spelling getSemanticSpelling() const {
4228 2481 : switch (SpellingListIndex) {
4229 0 : default: llvm_unreachable("Unknown spelling list index");
4230 : case 0: return Keyword_single_inheritance;
4231 : case 1: return Keyword_multiple_inheritance;
4232 : case 2: return Keyword_virtual_inheritance;
4233 : case 3: return Keyword_unspecified_inheritance;
4234 : }
4235 : }
4236 0 : bool getBestCase() const {
4237 0 : return bestCase;
4238 : }
4239 :
4240 : static const bool DefaultBestCase = true;
4241 :
4242 :
4243 : static bool hasVBPtrOffsetField(Spelling Inheritance) {
4244 : return Inheritance == Keyword_unspecified_inheritance;
4245 : }
4246 :
4247 : // Only member pointers to functions need a this adjustment, since it can be
4248 : // combined with the field offset for data pointers.
4249 : static bool hasNVOffsetField(bool IsMemberFunction, Spelling Inheritance) {
4250 1396 : return IsMemberFunction && Inheritance >= Keyword_multiple_inheritance;
4251 : }
4252 :
4253 : static bool hasVBTableOffsetField(Spelling Inheritance) {
4254 132 : return Inheritance >= Keyword_virtual_inheritance;
4255 : }
4256 :
4257 : static bool hasOnlyOneField(bool IsMemberFunction,
4258 : Spelling Inheritance) {
4259 519 : if (IsMemberFunction)
4260 491 : return Inheritance <= Keyword_single_inheritance;
4261 133 : return Inheritance <= Keyword_multiple_inheritance;
4262 : }
4263 :
4264 :
4265 3 : static bool classof(const Attr *A) { return A->getKind() == attr::MSInheritance; }
4266 : };
4267 :
4268 : class MSNoVTableAttr : public InheritableAttr {
4269 : public:
4270 : static MSNoVTableAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4271 : auto *A = new (Ctx) MSNoVTableAttr(Loc, Ctx, 0);
4272 : A->setImplicit(true);
4273 : return A;
4274 : }
4275 :
4276 : MSNoVTableAttr(SourceRange R, ASTContext &Ctx
4277 : , unsigned SI
4278 : )
4279 : : InheritableAttr(attr::MSNoVTable, R, SI, false, false)
4280 : {
4281 : }
4282 :
4283 : MSNoVTableAttr *clone(ASTContext &C) const;
4284 : void printPretty(raw_ostream &OS,
4285 : const PrintingPolicy &Policy) const;
4286 : const char *getSpelling() const;
4287 :
4288 :
4289 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MSNoVTable; }
4290 : };
4291 :
4292 : class MSP430InterruptAttr : public InheritableAttr {
4293 : unsigned number;
4294 :
4295 : public:
4296 : static MSP430InterruptAttr *CreateImplicit(ASTContext &Ctx, unsigned Number, SourceRange Loc = SourceRange()) {
4297 : auto *A = new (Ctx) MSP430InterruptAttr(Loc, Ctx, Number, 0);
4298 : A->setImplicit(true);
4299 : return A;
4300 : }
4301 :
4302 : MSP430InterruptAttr(SourceRange R, ASTContext &Ctx
4303 : , unsigned Number
4304 : , unsigned SI
4305 : )
4306 2 : : InheritableAttr(attr::MSP430Interrupt, R, SI, false, false)
4307 2 : , number(Number)
4308 : {
4309 : }
4310 :
4311 : MSP430InterruptAttr *clone(ASTContext &C) const;
4312 : void printPretty(raw_ostream &OS,
4313 : const PrintingPolicy &Policy) const;
4314 : const char *getSpelling() const;
4315 0 : unsigned getNumber() const {
4316 0 : return number;
4317 : }
4318 :
4319 :
4320 :
4321 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MSP430Interrupt; }
4322 : };
4323 :
4324 : class MSStructAttr : public InheritableAttr {
4325 : public:
4326 21 : static MSStructAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4327 21 : auto *A = new (Ctx) MSStructAttr(Loc, Ctx, 0);
4328 : A->setImplicit(true);
4329 21 : return A;
4330 : }
4331 :
4332 : MSStructAttr(SourceRange R, ASTContext &Ctx
4333 : , unsigned SI
4334 : )
4335 : : InheritableAttr(attr::MSStruct, R, SI, false, false)
4336 : {
4337 : }
4338 :
4339 : MSStructAttr *clone(ASTContext &C) const;
4340 : void printPretty(raw_ostream &OS,
4341 : const PrintingPolicy &Policy) const;
4342 : const char *getSpelling() const;
4343 :
4344 :
4345 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MSStruct; }
4346 : };
4347 :
4348 : class MSVtorDispAttr : public InheritableAttr {
4349 : unsigned vdm;
4350 :
4351 : public:
4352 29 : static MSVtorDispAttr *CreateImplicit(ASTContext &Ctx, unsigned Vdm, SourceRange Loc = SourceRange()) {
4353 29 : auto *A = new (Ctx) MSVtorDispAttr(Loc, Ctx, Vdm, 0);
4354 : A->setImplicit(true);
4355 29 : return A;
4356 : }
4357 :
4358 : MSVtorDispAttr(SourceRange R, ASTContext &Ctx
4359 : , unsigned Vdm
4360 : , unsigned SI
4361 : )
4362 31 : : InheritableAttr(attr::MSVtorDisp, R, SI, false, false)
4363 31 : , vdm(Vdm)
4364 : {
4365 : }
4366 :
4367 : MSVtorDispAttr *clone(ASTContext &C) const;
4368 : void printPretty(raw_ostream &OS,
4369 : const PrintingPolicy &Policy) const;
4370 : const char *getSpelling() const;
4371 0 : unsigned getVdm() const {
4372 0 : return vdm;
4373 : }
4374 :
4375 :
4376 : enum Mode {
4377 : Never,
4378 : ForVBaseOverride,
4379 : ForVFTable
4380 : };
4381 :
4382 0 : Mode getVtorDispMode() const { return Mode(vdm); }
4383 :
4384 :
4385 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MSVtorDisp; }
4386 : };
4387 :
4388 : class MaxFieldAlignmentAttr : public InheritableAttr {
4389 : unsigned alignment;
4390 :
4391 : public:
4392 315 : static MaxFieldAlignmentAttr *CreateImplicit(ASTContext &Ctx, unsigned Alignment, SourceRange Loc = SourceRange()) {
4393 315 : auto *A = new (Ctx) MaxFieldAlignmentAttr(Loc, Ctx, Alignment, 0);
4394 : A->setImplicit(true);
4395 315 : return A;
4396 : }
4397 :
4398 : MaxFieldAlignmentAttr(SourceRange R, ASTContext &Ctx
4399 : , unsigned Alignment
4400 : , unsigned SI
4401 : )
4402 316 : : InheritableAttr(attr::MaxFieldAlignment, R, SI, false, false)
4403 316 : , alignment(Alignment)
4404 : {
4405 : }
4406 :
4407 : MaxFieldAlignmentAttr *clone(ASTContext &C) const;
4408 : void printPretty(raw_ostream &OS,
4409 : const PrintingPolicy &Policy) const;
4410 : const char *getSpelling() const;
4411 0 : unsigned getAlignment() const {
4412 0 : return alignment;
4413 : }
4414 :
4415 :
4416 :
4417 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MaxFieldAlignment; }
4418 : };
4419 :
4420 : class MayAliasAttr : public InheritableAttr {
4421 : public:
4422 : static MayAliasAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4423 : auto *A = new (Ctx) MayAliasAttr(Loc, Ctx, 0);
4424 : A->setImplicit(true);
4425 : return A;
4426 : }
4427 :
4428 : MayAliasAttr(SourceRange R, ASTContext &Ctx
4429 : , unsigned SI
4430 : )
4431 : : InheritableAttr(attr::MayAlias, R, SI, false, false)
4432 : {
4433 : }
4434 :
4435 : MayAliasAttr *clone(ASTContext &C) const;
4436 : void printPretty(raw_ostream &OS,
4437 : const PrintingPolicy &Policy) const;
4438 : const char *getSpelling() const;
4439 :
4440 :
4441 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MayAlias; }
4442 : };
4443 :
4444 : class MicroMipsAttr : public InheritableAttr {
4445 : public:
4446 : static MicroMipsAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4447 : auto *A = new (Ctx) MicroMipsAttr(Loc, Ctx, 0);
4448 : A->setImplicit(true);
4449 : return A;
4450 : }
4451 :
4452 : MicroMipsAttr(SourceRange R, ASTContext &Ctx
4453 : , unsigned SI
4454 : )
4455 : : InheritableAttr(attr::MicroMips, R, SI, false, false)
4456 : {
4457 : }
4458 :
4459 : MicroMipsAttr *clone(ASTContext &C) const;
4460 : void printPretty(raw_ostream &OS,
4461 : const PrintingPolicy &Policy) const;
4462 : const char *getSpelling() const;
4463 :
4464 :
4465 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MicroMips; }
4466 : };
4467 :
4468 : class MinSizeAttr : public InheritableAttr {
4469 : public:
4470 : static MinSizeAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4471 : auto *A = new (Ctx) MinSizeAttr(Loc, Ctx, 0);
4472 : A->setImplicit(true);
4473 : return A;
4474 : }
4475 :
4476 : MinSizeAttr(SourceRange R, ASTContext &Ctx
4477 : , unsigned SI
4478 : )
4479 : : InheritableAttr(attr::MinSize, R, SI, false, false)
4480 : {
4481 : }
4482 :
4483 : MinSizeAttr *clone(ASTContext &C) const;
4484 : void printPretty(raw_ostream &OS,
4485 : const PrintingPolicy &Policy) const;
4486 : const char *getSpelling() const;
4487 :
4488 :
4489 3 : static bool classof(const Attr *A) { return A->getKind() == attr::MinSize; }
4490 : };
4491 :
4492 : class MinVectorWidthAttr : public InheritableAttr {
4493 : unsigned vectorWidth;
4494 :
4495 : public:
4496 : static MinVectorWidthAttr *CreateImplicit(ASTContext &Ctx, unsigned VectorWidth, SourceRange Loc = SourceRange()) {
4497 : auto *A = new (Ctx) MinVectorWidthAttr(Loc, Ctx, VectorWidth, 0);
4498 : A->setImplicit(true);
4499 : return A;
4500 : }
4501 :
4502 : MinVectorWidthAttr(SourceRange R, ASTContext &Ctx
4503 : , unsigned VectorWidth
4504 : , unsigned SI
4505 : )
4506 492746 : : InheritableAttr(attr::MinVectorWidth, R, SI, false, false)
4507 492746 : , vectorWidth(VectorWidth)
4508 : {
4509 : }
4510 :
4511 : MinVectorWidthAttr *clone(ASTContext &C) const;
4512 : void printPretty(raw_ostream &OS,
4513 : const PrintingPolicy &Policy) const;
4514 : const char *getSpelling() const;
4515 0 : unsigned getVectorWidth() const {
4516 0 : return vectorWidth;
4517 : }
4518 :
4519 :
4520 :
4521 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MinVectorWidth; }
4522 : };
4523 :
4524 : class Mips16Attr : public InheritableAttr {
4525 : public:
4526 : static Mips16Attr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4527 : auto *A = new (Ctx) Mips16Attr(Loc, Ctx, 0);
4528 : A->setImplicit(true);
4529 : return A;
4530 : }
4531 :
4532 : Mips16Attr(SourceRange R, ASTContext &Ctx
4533 : , unsigned SI
4534 : )
4535 : : InheritableAttr(attr::Mips16, R, SI, false, false)
4536 : {
4537 : }
4538 :
4539 : Mips16Attr *clone(ASTContext &C) const;
4540 : void printPretty(raw_ostream &OS,
4541 : const PrintingPolicy &Policy) const;
4542 : const char *getSpelling() const;
4543 :
4544 :
4545 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Mips16; }
4546 : };
4547 :
4548 : class MipsInterruptAttr : public InheritableAttr {
4549 : public:
4550 : enum InterruptType {
4551 : sw0,
4552 : sw1,
4553 : hw0,
4554 : hw1,
4555 : hw2,
4556 : hw3,
4557 : hw4,
4558 : hw5,
4559 : eic
4560 : };
4561 : private:
4562 : InterruptType interrupt;
4563 :
4564 : public:
4565 : static MipsInterruptAttr *CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, SourceRange Loc = SourceRange()) {
4566 : auto *A = new (Ctx) MipsInterruptAttr(Loc, Ctx, Interrupt, 0);
4567 : A->setImplicit(true);
4568 : return A;
4569 : }
4570 :
4571 : MipsInterruptAttr(SourceRange R, ASTContext &Ctx
4572 : , InterruptType Interrupt
4573 : , unsigned SI
4574 : )
4575 20 : : InheritableAttr(attr::MipsInterrupt, R, SI, false, false)
4576 20 : , interrupt(Interrupt)
4577 : {
4578 : }
4579 :
4580 : MipsInterruptAttr *clone(ASTContext &C) const;
4581 : void printPretty(raw_ostream &OS,
4582 : const PrintingPolicy &Policy) const;
4583 : const char *getSpelling() const;
4584 0 : InterruptType getInterrupt() const {
4585 0 : return interrupt;
4586 : }
4587 :
4588 21 : static bool ConvertStrToInterruptType(StringRef Val, InterruptType &Out) {
4589 21 : Optional<InterruptType> R = llvm::StringSwitch<Optional<InterruptType>>(Val)
4590 21 : .Case("vector=sw0", MipsInterruptAttr::sw0)
4591 21 : .Case("vector=sw1", MipsInterruptAttr::sw1)
4592 21 : .Case("vector=hw0", MipsInterruptAttr::hw0)
4593 21 : .Case("vector=hw1", MipsInterruptAttr::hw1)
4594 21 : .Case("vector=hw2", MipsInterruptAttr::hw2)
4595 21 : .Case("vector=hw3", MipsInterruptAttr::hw3)
4596 21 : .Case("vector=hw4", MipsInterruptAttr::hw4)
4597 21 : .Case("vector=hw5", MipsInterruptAttr::hw5)
4598 21 : .Case("eic", MipsInterruptAttr::eic)
4599 21 : .Case("", MipsInterruptAttr::eic)
4600 : .Default(Optional<InterruptType>());
4601 21 : if (R) {
4602 20 : Out = *R;
4603 20 : return true;
4604 : }
4605 : return false;
4606 : }
4607 :
4608 0 : static const char *ConvertInterruptTypeToStr(InterruptType Val) {
4609 0 : switch(Val) {
4610 : case MipsInterruptAttr::sw0: return "vector=sw0";
4611 0 : case MipsInterruptAttr::sw1: return "vector=sw1";
4612 0 : case MipsInterruptAttr::hw0: return "vector=hw0";
4613 0 : case MipsInterruptAttr::hw1: return "vector=hw1";
4614 0 : case MipsInterruptAttr::hw2: return "vector=hw2";
4615 0 : case MipsInterruptAttr::hw3: return "vector=hw3";
4616 0 : case MipsInterruptAttr::hw4: return "vector=hw4";
4617 0 : case MipsInterruptAttr::hw5: return "vector=hw5";
4618 0 : case MipsInterruptAttr::eic: return "eic";
4619 : }
4620 0 : llvm_unreachable("No enumerator with that value");
4621 : }
4622 :
4623 :
4624 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MipsInterrupt; }
4625 : };
4626 :
4627 : class MipsLongCallAttr : public InheritableAttr {
4628 : public:
4629 : enum Spelling {
4630 : GNU_long_call = 0,
4631 : CXX11_gnu_long_call = 1,
4632 : GNU_far = 2,
4633 : CXX11_gnu_far = 3
4634 : };
4635 :
4636 : static MipsLongCallAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
4637 : auto *A = new (Ctx) MipsLongCallAttr(Loc, Ctx, S);
4638 : A->setImplicit(true);
4639 : return A;
4640 : }
4641 :
4642 : MipsLongCallAttr(SourceRange R, ASTContext &Ctx
4643 : , unsigned SI
4644 : )
4645 : : InheritableAttr(attr::MipsLongCall, R, SI, false, false)
4646 : {
4647 : }
4648 :
4649 : MipsLongCallAttr *clone(ASTContext &C) const;
4650 : void printPretty(raw_ostream &OS,
4651 : const PrintingPolicy &Policy) const;
4652 : const char *getSpelling() const;
4653 : Spelling getSemanticSpelling() const {
4654 : switch (SpellingListIndex) {
4655 : default: llvm_unreachable("Unknown spelling list index");
4656 : case 0: return GNU_long_call;
4657 : case 1: return CXX11_gnu_long_call;
4658 : case 2: return GNU_far;
4659 : case 3: return CXX11_gnu_far;
4660 : }
4661 : }
4662 :
4663 :
4664 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MipsLongCall; }
4665 : };
4666 :
4667 : class MipsShortCallAttr : public InheritableAttr {
4668 : public:
4669 : enum Spelling {
4670 : GNU_short_call = 0,
4671 : CXX11_gnu_short_call = 1,
4672 : GNU_near = 2,
4673 : CXX11_gnu_near = 3
4674 : };
4675 :
4676 : static MipsShortCallAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
4677 : auto *A = new (Ctx) MipsShortCallAttr(Loc, Ctx, S);
4678 : A->setImplicit(true);
4679 : return A;
4680 : }
4681 :
4682 : MipsShortCallAttr(SourceRange R, ASTContext &Ctx
4683 : , unsigned SI
4684 : )
4685 : : InheritableAttr(attr::MipsShortCall, R, SI, false, false)
4686 : {
4687 : }
4688 :
4689 : MipsShortCallAttr *clone(ASTContext &C) const;
4690 : void printPretty(raw_ostream &OS,
4691 : const PrintingPolicy &Policy) const;
4692 : const char *getSpelling() const;
4693 : Spelling getSemanticSpelling() const {
4694 : switch (SpellingListIndex) {
4695 : default: llvm_unreachable("Unknown spelling list index");
4696 : case 0: return GNU_short_call;
4697 : case 1: return CXX11_gnu_short_call;
4698 : case 2: return GNU_near;
4699 : case 3: return CXX11_gnu_near;
4700 : }
4701 : }
4702 :
4703 :
4704 0 : static bool classof(const Attr *A) { return A->getKind() == attr::MipsShortCall; }
4705 : };
4706 :
4707 : class ModeAttr : public Attr {
4708 : IdentifierInfo * mode;
4709 :
4710 : public:
4711 : static ModeAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * Mode, SourceRange Loc = SourceRange()) {
4712 : auto *A = new (Ctx) ModeAttr(Loc, Ctx, Mode, 0);
4713 : A->setImplicit(true);
4714 : return A;
4715 : }
4716 :
4717 : ModeAttr(SourceRange R, ASTContext &Ctx
4718 : , IdentifierInfo * Mode
4719 : , unsigned SI
4720 : )
4721 26431 : : Attr(attr::Mode, R, SI, false)
4722 26431 : , mode(Mode)
4723 : {
4724 : }
4725 :
4726 : ModeAttr *clone(ASTContext &C) const;
4727 : void printPretty(raw_ostream &OS,
4728 : const PrintingPolicy &Policy) const;
4729 : const char *getSpelling() const;
4730 0 : IdentifierInfo * getMode() const {
4731 0 : return mode;
4732 : }
4733 :
4734 :
4735 :
4736 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Mode; }
4737 : };
4738 :
4739 : class NSConsumedAttr : public InheritableParamAttr {
4740 : public:
4741 153 : static NSConsumedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4742 153 : auto *A = new (Ctx) NSConsumedAttr(Loc, Ctx, 0);
4743 : A->setImplicit(true);
4744 153 : return A;
4745 : }
4746 :
4747 : NSConsumedAttr(SourceRange R, ASTContext &Ctx
4748 : , unsigned SI
4749 : )
4750 : : InheritableParamAttr(attr::NSConsumed, R, SI, false, false)
4751 : {
4752 : }
4753 :
4754 : NSConsumedAttr *clone(ASTContext &C) const;
4755 : void printPretty(raw_ostream &OS,
4756 : const PrintingPolicy &Policy) const;
4757 : const char *getSpelling() const;
4758 :
4759 :
4760 89 : static bool classof(const Attr *A) { return A->getKind() == attr::NSConsumed; }
4761 : };
4762 :
4763 : class NSConsumesSelfAttr : public InheritableAttr {
4764 : public:
4765 501 : static NSConsumesSelfAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4766 501 : auto *A = new (Ctx) NSConsumesSelfAttr(Loc, Ctx, 0);
4767 : A->setImplicit(true);
4768 501 : return A;
4769 : }
4770 :
4771 : NSConsumesSelfAttr(SourceRange R, ASTContext &Ctx
4772 : , unsigned SI
4773 : )
4774 : : InheritableAttr(attr::NSConsumesSelf, R, SI, false, false)
4775 : {
4776 : }
4777 :
4778 : NSConsumesSelfAttr *clone(ASTContext &C) const;
4779 : void printPretty(raw_ostream &OS,
4780 : const PrintingPolicy &Policy) const;
4781 : const char *getSpelling() const;
4782 :
4783 :
4784 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NSConsumesSelf; }
4785 : };
4786 :
4787 : class NSReturnsAutoreleasedAttr : public InheritableAttr {
4788 : public:
4789 : static NSReturnsAutoreleasedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4790 : auto *A = new (Ctx) NSReturnsAutoreleasedAttr(Loc, Ctx, 0);
4791 : A->setImplicit(true);
4792 : return A;
4793 : }
4794 :
4795 : NSReturnsAutoreleasedAttr(SourceRange R, ASTContext &Ctx
4796 : , unsigned SI
4797 : )
4798 : : InheritableAttr(attr::NSReturnsAutoreleased, R, SI, false, false)
4799 : {
4800 : }
4801 :
4802 : NSReturnsAutoreleasedAttr *clone(ASTContext &C) const;
4803 : void printPretty(raw_ostream &OS,
4804 : const PrintingPolicy &Policy) const;
4805 : const char *getSpelling() const;
4806 :
4807 :
4808 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NSReturnsAutoreleased; }
4809 : };
4810 :
4811 : class NSReturnsNotRetainedAttr : public InheritableAttr {
4812 : public:
4813 3 : static NSReturnsNotRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4814 3 : auto *A = new (Ctx) NSReturnsNotRetainedAttr(Loc, Ctx, 0);
4815 : A->setImplicit(true);
4816 3 : return A;
4817 : }
4818 :
4819 : NSReturnsNotRetainedAttr(SourceRange R, ASTContext &Ctx
4820 : , unsigned SI
4821 : )
4822 : : InheritableAttr(attr::NSReturnsNotRetained, R, SI, false, false)
4823 : {
4824 : }
4825 :
4826 : NSReturnsNotRetainedAttr *clone(ASTContext &C) const;
4827 : void printPretty(raw_ostream &OS,
4828 : const PrintingPolicy &Policy) const;
4829 : const char *getSpelling() const;
4830 :
4831 :
4832 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NSReturnsNotRetained; }
4833 : };
4834 :
4835 : class NSReturnsRetainedAttr : public InheritableAttr {
4836 : public:
4837 888 : static NSReturnsRetainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4838 888 : auto *A = new (Ctx) NSReturnsRetainedAttr(Loc, Ctx, 0);
4839 : A->setImplicit(true);
4840 888 : return A;
4841 : }
4842 :
4843 : NSReturnsRetainedAttr(SourceRange R, ASTContext &Ctx
4844 : , unsigned SI
4845 : )
4846 : : InheritableAttr(attr::NSReturnsRetained, R, SI, false, false)
4847 : {
4848 : }
4849 :
4850 : NSReturnsRetainedAttr *clone(ASTContext &C) const;
4851 : void printPretty(raw_ostream &OS,
4852 : const PrintingPolicy &Policy) const;
4853 : const char *getSpelling() const;
4854 :
4855 :
4856 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NSReturnsRetained; }
4857 : };
4858 :
4859 : class NakedAttr : public InheritableAttr {
4860 : public:
4861 : static NakedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4862 : auto *A = new (Ctx) NakedAttr(Loc, Ctx, 0);
4863 : A->setImplicit(true);
4864 : return A;
4865 : }
4866 :
4867 : NakedAttr(SourceRange R, ASTContext &Ctx
4868 : , unsigned SI
4869 : )
4870 : : InheritableAttr(attr::Naked, R, SI, false, false)
4871 : {
4872 : }
4873 :
4874 : NakedAttr *clone(ASTContext &C) const;
4875 : void printPretty(raw_ostream &OS,
4876 : const PrintingPolicy &Policy) const;
4877 : const char *getSpelling() const;
4878 :
4879 :
4880 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Naked; }
4881 : };
4882 :
4883 : class NoAliasAttr : public InheritableAttr {
4884 : public:
4885 : static NoAliasAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4886 : auto *A = new (Ctx) NoAliasAttr(Loc, Ctx, 0);
4887 : A->setImplicit(true);
4888 : return A;
4889 : }
4890 :
4891 : NoAliasAttr(SourceRange R, ASTContext &Ctx
4892 : , unsigned SI
4893 : )
4894 : : InheritableAttr(attr::NoAlias, R, SI, false, false)
4895 : {
4896 : }
4897 :
4898 : NoAliasAttr *clone(ASTContext &C) const;
4899 : void printPretty(raw_ostream &OS,
4900 : const PrintingPolicy &Policy) const;
4901 : const char *getSpelling() const;
4902 :
4903 :
4904 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoAlias; }
4905 : };
4906 :
4907 : class NoCommonAttr : public InheritableAttr {
4908 : public:
4909 : static NoCommonAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4910 : auto *A = new (Ctx) NoCommonAttr(Loc, Ctx, 0);
4911 : A->setImplicit(true);
4912 : return A;
4913 : }
4914 :
4915 : NoCommonAttr(SourceRange R, ASTContext &Ctx
4916 : , unsigned SI
4917 : )
4918 : : InheritableAttr(attr::NoCommon, R, SI, false, false)
4919 : {
4920 : }
4921 :
4922 : NoCommonAttr *clone(ASTContext &C) const;
4923 : void printPretty(raw_ostream &OS,
4924 : const PrintingPolicy &Policy) const;
4925 : const char *getSpelling() const;
4926 :
4927 :
4928 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoCommon; }
4929 : };
4930 :
4931 : class NoDebugAttr : public InheritableAttr {
4932 : public:
4933 : static NoDebugAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4934 : auto *A = new (Ctx) NoDebugAttr(Loc, Ctx, 0);
4935 : A->setImplicit(true);
4936 : return A;
4937 : }
4938 :
4939 : NoDebugAttr(SourceRange R, ASTContext &Ctx
4940 : , unsigned SI
4941 : )
4942 : : InheritableAttr(attr::NoDebug, R, SI, false, false)
4943 : {
4944 : }
4945 :
4946 : NoDebugAttr *clone(ASTContext &C) const;
4947 : void printPretty(raw_ostream &OS,
4948 : const PrintingPolicy &Policy) const;
4949 : const char *getSpelling() const;
4950 :
4951 :
4952 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoDebug; }
4953 : };
4954 :
4955 : class NoDestroyAttr : public InheritableAttr {
4956 : public:
4957 : static NoDestroyAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4958 : auto *A = new (Ctx) NoDestroyAttr(Loc, Ctx, 0);
4959 : A->setImplicit(true);
4960 : return A;
4961 : }
4962 :
4963 : NoDestroyAttr(SourceRange R, ASTContext &Ctx
4964 : , unsigned SI
4965 : )
4966 : : InheritableAttr(attr::NoDestroy, R, SI, false, false)
4967 : {
4968 : }
4969 :
4970 : NoDestroyAttr *clone(ASTContext &C) const;
4971 : void printPretty(raw_ostream &OS,
4972 : const PrintingPolicy &Policy) const;
4973 : const char *getSpelling() const;
4974 :
4975 :
4976 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoDestroy; }
4977 : };
4978 :
4979 : class NoDuplicateAttr : public InheritableAttr {
4980 : public:
4981 : static NoDuplicateAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
4982 : auto *A = new (Ctx) NoDuplicateAttr(Loc, Ctx, 0);
4983 : A->setImplicit(true);
4984 : return A;
4985 : }
4986 :
4987 : NoDuplicateAttr(SourceRange R, ASTContext &Ctx
4988 : , unsigned SI
4989 : )
4990 : : InheritableAttr(attr::NoDuplicate, R, SI, false, false)
4991 : {
4992 : }
4993 :
4994 : NoDuplicateAttr *clone(ASTContext &C) const;
4995 : void printPretty(raw_ostream &OS,
4996 : const PrintingPolicy &Policy) const;
4997 : const char *getSpelling() const;
4998 :
4999 :
5000 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoDuplicate; }
5001 : };
5002 :
5003 : class NoEscapeAttr : public Attr {
5004 : public:
5005 : static NoEscapeAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5006 : auto *A = new (Ctx) NoEscapeAttr(Loc, Ctx, 0);
5007 : A->setImplicit(true);
5008 : return A;
5009 : }
5010 :
5011 : NoEscapeAttr(SourceRange R, ASTContext &Ctx
5012 : , unsigned SI
5013 : )
5014 : : Attr(attr::NoEscape, R, SI, false)
5015 : {
5016 : }
5017 :
5018 : NoEscapeAttr *clone(ASTContext &C) const;
5019 : void printPretty(raw_ostream &OS,
5020 : const PrintingPolicy &Policy) const;
5021 : const char *getSpelling() const;
5022 :
5023 :
5024 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoEscape; }
5025 : };
5026 :
5027 : class NoInlineAttr : public InheritableAttr {
5028 : public:
5029 22 : static NoInlineAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5030 22 : auto *A = new (Ctx) NoInlineAttr(Loc, Ctx, 0);
5031 : A->setImplicit(true);
5032 22 : return A;
5033 : }
5034 :
5035 : NoInlineAttr(SourceRange R, ASTContext &Ctx
5036 : , unsigned SI
5037 : )
5038 : : InheritableAttr(attr::NoInline, R, SI, false, false)
5039 : {
5040 : }
5041 :
5042 : NoInlineAttr *clone(ASTContext &C) const;
5043 : void printPretty(raw_ostream &OS,
5044 : const PrintingPolicy &Policy) const;
5045 : const char *getSpelling() const;
5046 :
5047 :
5048 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoInline; }
5049 : };
5050 :
5051 : class NoInstrumentFunctionAttr : public InheritableAttr {
5052 : public:
5053 : static NoInstrumentFunctionAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5054 : auto *A = new (Ctx) NoInstrumentFunctionAttr(Loc, Ctx, 0);
5055 : A->setImplicit(true);
5056 : return A;
5057 : }
5058 :
5059 : NoInstrumentFunctionAttr(SourceRange R, ASTContext &Ctx
5060 : , unsigned SI
5061 : )
5062 : : InheritableAttr(attr::NoInstrumentFunction, R, SI, false, false)
5063 : {
5064 : }
5065 :
5066 : NoInstrumentFunctionAttr *clone(ASTContext &C) const;
5067 : void printPretty(raw_ostream &OS,
5068 : const PrintingPolicy &Policy) const;
5069 : const char *getSpelling() const;
5070 :
5071 :
5072 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoInstrumentFunction; }
5073 : };
5074 :
5075 : class NoMicroMipsAttr : public InheritableAttr {
5076 : public:
5077 : static NoMicroMipsAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5078 : auto *A = new (Ctx) NoMicroMipsAttr(Loc, Ctx, 0);
5079 : A->setImplicit(true);
5080 : return A;
5081 : }
5082 :
5083 : NoMicroMipsAttr(SourceRange R, ASTContext &Ctx
5084 : , unsigned SI
5085 : )
5086 : : InheritableAttr(attr::NoMicroMips, R, SI, false, false)
5087 : {
5088 : }
5089 :
5090 : NoMicroMipsAttr *clone(ASTContext &C) const;
5091 : void printPretty(raw_ostream &OS,
5092 : const PrintingPolicy &Policy) const;
5093 : const char *getSpelling() const;
5094 :
5095 :
5096 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoMicroMips; }
5097 : };
5098 :
5099 : class NoMips16Attr : public InheritableAttr {
5100 : public:
5101 : static NoMips16Attr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5102 : auto *A = new (Ctx) NoMips16Attr(Loc, Ctx, 0);
5103 : A->setImplicit(true);
5104 : return A;
5105 : }
5106 :
5107 : NoMips16Attr(SourceRange R, ASTContext &Ctx
5108 : , unsigned SI
5109 : )
5110 : : InheritableAttr(attr::NoMips16, R, SI, false, false)
5111 : {
5112 : }
5113 :
5114 : NoMips16Attr *clone(ASTContext &C) const;
5115 : void printPretty(raw_ostream &OS,
5116 : const PrintingPolicy &Policy) const;
5117 : const char *getSpelling() const;
5118 :
5119 :
5120 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoMips16; }
5121 : };
5122 :
5123 : class NoReturnAttr : public InheritableAttr {
5124 : public:
5125 : static NoReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5126 : auto *A = new (Ctx) NoReturnAttr(Loc, Ctx, 0);
5127 : A->setImplicit(true);
5128 : return A;
5129 : }
5130 :
5131 : NoReturnAttr(SourceRange R, ASTContext &Ctx
5132 : , unsigned SI
5133 : )
5134 : : InheritableAttr(attr::NoReturn, R, SI, false, false)
5135 : {
5136 : }
5137 :
5138 : NoReturnAttr *clone(ASTContext &C) const;
5139 : void printPretty(raw_ostream &OS,
5140 : const PrintingPolicy &Policy) const;
5141 : const char *getSpelling() const;
5142 :
5143 :
5144 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoReturn; }
5145 : };
5146 :
5147 : class NoSanitizeAttr : public InheritableAttr {
5148 : unsigned sanitizers_Size;
5149 : StringRef *sanitizers_;
5150 :
5151 : public:
5152 : static NoSanitizeAttr *CreateImplicit(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, SourceRange Loc = SourceRange()) {
5153 : auto *A = new (Ctx) NoSanitizeAttr(Loc, Ctx, Sanitizers, SanitizersSize, 0);
5154 : A->setImplicit(true);
5155 : return A;
5156 : }
5157 :
5158 156366 : NoSanitizeAttr(SourceRange R, ASTContext &Ctx
5159 : , StringRef *Sanitizers, unsigned SanitizersSize
5160 : , unsigned SI
5161 : )
5162 156366 : : InheritableAttr(attr::NoSanitize, R, SI, false, false)
5163 312741 : , sanitizers_Size(SanitizersSize), sanitizers_(new (Ctx, 16) StringRef[sanitizers_Size])
5164 : {
5165 312741 : for (size_t I = 0, E = sanitizers_Size; I != E;
5166 : ++I) {
5167 156375 : StringRef Ref = Sanitizers[I];
5168 156375 : if (!Ref.empty()) {
5169 : char *Mem = new (Ctx, 1) char[Ref.size()];
5170 156375 : std::memcpy(Mem, Ref.data(), Ref.size());
5171 156375 : sanitizers_[I] = StringRef(Mem, Ref.size());
5172 : }
5173 : }
5174 156366 : }
5175 :
5176 : NoSanitizeAttr(SourceRange R, ASTContext &Ctx
5177 : , unsigned SI
5178 : )
5179 : : InheritableAttr(attr::NoSanitize, R, SI, false, false)
5180 : , sanitizers_Size(0), sanitizers_(nullptr)
5181 : {
5182 : }
5183 :
5184 : NoSanitizeAttr *clone(ASTContext &C) const;
5185 : void printPretty(raw_ostream &OS,
5186 : const PrintingPolicy &Policy) const;
5187 : const char *getSpelling() const;
5188 : typedef StringRef* sanitizers_iterator;
5189 0 : sanitizers_iterator sanitizers_begin() const { return sanitizers_; }
5190 6470 : sanitizers_iterator sanitizers_end() const { return sanitizers_ + sanitizers_Size; }
5191 0 : unsigned sanitizers_size() const { return sanitizers_Size; }
5192 6470 : llvm::iterator_range<sanitizers_iterator> sanitizers() const { return llvm::make_range(sanitizers_begin(), sanitizers_end()); }
5193 :
5194 :
5195 :
5196 6414 : SanitizerMask getMask() const {
5197 : SanitizerMask Mask = 0;
5198 12828 : for (auto SanitizerName : sanitizers()) {
5199 : SanitizerMask ParsedMask =
5200 6414 : parseSanitizerValue(SanitizerName, /*AllowGroups=*/true);
5201 6414 : Mask |= expandSanitizerGroups(ParsedMask);
5202 : }
5203 6414 : return Mask;
5204 : }
5205 :
5206 :
5207 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoSanitize; }
5208 : };
5209 :
5210 : class NoSplitStackAttr : public InheritableAttr {
5211 : public:
5212 : static NoSplitStackAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5213 : auto *A = new (Ctx) NoSplitStackAttr(Loc, Ctx, 0);
5214 : A->setImplicit(true);
5215 : return A;
5216 : }
5217 :
5218 : NoSplitStackAttr(SourceRange R, ASTContext &Ctx
5219 : , unsigned SI
5220 : )
5221 : : InheritableAttr(attr::NoSplitStack, R, SI, false, false)
5222 : {
5223 : }
5224 :
5225 : NoSplitStackAttr *clone(ASTContext &C) const;
5226 : void printPretty(raw_ostream &OS,
5227 : const PrintingPolicy &Policy) const;
5228 : const char *getSpelling() const;
5229 :
5230 :
5231 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoSplitStack; }
5232 : };
5233 :
5234 : class NoStackProtectorAttr : public InheritableAttr {
5235 : public:
5236 : static NoStackProtectorAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5237 : auto *A = new (Ctx) NoStackProtectorAttr(Loc, Ctx, 0);
5238 : A->setImplicit(true);
5239 : return A;
5240 : }
5241 :
5242 : NoStackProtectorAttr(SourceRange R, ASTContext &Ctx
5243 : , unsigned SI
5244 : )
5245 : : InheritableAttr(attr::NoStackProtector, R, SI, false, false)
5246 : {
5247 : }
5248 :
5249 : NoStackProtectorAttr *clone(ASTContext &C) const;
5250 : void printPretty(raw_ostream &OS,
5251 : const PrintingPolicy &Policy) const;
5252 : const char *getSpelling() const;
5253 :
5254 :
5255 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoStackProtector; }
5256 : };
5257 :
5258 : class NoThreadSafetyAnalysisAttr : public InheritableAttr {
5259 : public:
5260 : static NoThreadSafetyAnalysisAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5261 : auto *A = new (Ctx) NoThreadSafetyAnalysisAttr(Loc, Ctx, 0);
5262 : A->setImplicit(true);
5263 : return A;
5264 : }
5265 :
5266 : NoThreadSafetyAnalysisAttr(SourceRange R, ASTContext &Ctx
5267 : , unsigned SI
5268 : )
5269 : : InheritableAttr(attr::NoThreadSafetyAnalysis, R, SI, false, false)
5270 : {
5271 : }
5272 :
5273 : NoThreadSafetyAnalysisAttr *clone(ASTContext &C) const;
5274 : void printPretty(raw_ostream &OS,
5275 : const PrintingPolicy &Policy) const;
5276 : const char *getSpelling() const;
5277 :
5278 :
5279 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoThreadSafetyAnalysis; }
5280 : };
5281 :
5282 : class NoThrowAttr : public InheritableAttr {
5283 : public:
5284 670023 : static NoThrowAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5285 670023 : auto *A = new (Ctx) NoThrowAttr(Loc, Ctx, 0);
5286 : A->setImplicit(true);
5287 670023 : return A;
5288 : }
5289 :
5290 : NoThrowAttr(SourceRange R, ASTContext &Ctx
5291 : , unsigned SI
5292 : )
5293 : : InheritableAttr(attr::NoThrow, R, SI, false, false)
5294 : {
5295 : }
5296 :
5297 : NoThrowAttr *clone(ASTContext &C) const;
5298 : void printPretty(raw_ostream &OS,
5299 : const PrintingPolicy &Policy) const;
5300 : const char *getSpelling() const;
5301 :
5302 :
5303 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NoThrow; }
5304 : };
5305 :
5306 : class NonNullAttr : public InheritableParamAttr {
5307 : unsigned args_Size;
5308 : ParamIdx *args_;
5309 :
5310 : public:
5311 : static NonNullAttr *CreateImplicit(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
5312 : auto *A = new (Ctx) NonNullAttr(Loc, Ctx, Args, ArgsSize, 0);
5313 : A->setImplicit(true);
5314 : return A;
5315 : }
5316 :
5317 1031268 : NonNullAttr(SourceRange R, ASTContext &Ctx
5318 : , ParamIdx *Args, unsigned ArgsSize
5319 : , unsigned SI
5320 : )
5321 1031268 : : InheritableParamAttr(attr::NonNull, R, SI, false, true)
5322 2568546 : , args_Size(ArgsSize), args_(new (Ctx, 16) ParamIdx[args_Size])
5323 : {
5324 1031268 : std::copy(Args, Args + args_Size, args_);
5325 1031268 : }
5326 :
5327 : NonNullAttr(SourceRange R, ASTContext &Ctx
5328 : , unsigned SI
5329 : )
5330 : : InheritableParamAttr(attr::NonNull, R, SI, false, true)
5331 : , args_Size(0), args_(nullptr)
5332 : {
5333 : }
5334 :
5335 : NonNullAttr *clone(ASTContext &C) const;
5336 : void printPretty(raw_ostream &OS,
5337 : const PrintingPolicy &Policy) const;
5338 : const char *getSpelling() const;
5339 : typedef ParamIdx* args_iterator;
5340 0 : args_iterator args_begin() const { return args_; }
5341 98157 : args_iterator args_end() const { return args_ + args_Size; }
5342 0 : unsigned args_size() const { return args_Size; }
5343 98120 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
5344 :
5345 :
5346 :
5347 47 : bool isNonNull(unsigned IdxAST) const {
5348 47 : if (!args_size())
5349 : return true;
5350 37 : return args_end() != std::find_if(
5351 : args_begin(), args_end(),
5352 37 : [=](const ParamIdx &Idx) { return Idx.getASTIndex() == IdxAST; });
5353 : }
5354 :
5355 :
5356 0 : static bool classof(const Attr *A) { return A->getKind() == attr::NonNull; }
5357 : };
5358 :
5359 : class NotTailCalledAttr : public InheritableAttr {
5360 : public:
5361 : static NotTailCalledAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5362 : auto *A = new (Ctx) NotTailCalledAttr(Loc, Ctx, 0);
5363 : A->setImplicit(true);
5364 : return A;
5365 : }
5366 :
5367 : NotTailCalledAttr(SourceRange R, ASTContext &Ctx
5368 : , unsigned SI
5369 : )
5370 : : InheritableAttr(attr::NotTailCalled, R, SI, false, false)
5371 : {
5372 : }
5373 :
5374 : NotTailCalledAttr *clone(ASTContext &C) const;
5375 : void printPretty(raw_ostream &OS,
5376 : const PrintingPolicy &Policy) const;
5377 : const char *getSpelling() const;
5378 :
5379 :
5380 2 : static bool classof(const Attr *A) { return A->getKind() == attr::NotTailCalled; }
5381 : };
5382 :
5383 : class OMPCaptureKindAttr : public Attr {
5384 : unsigned captureKind;
5385 :
5386 : public:
5387 173980 : static OMPCaptureKindAttr *CreateImplicit(ASTContext &Ctx, unsigned CaptureKind, SourceRange Loc = SourceRange()) {
5388 173980 : auto *A = new (Ctx) OMPCaptureKindAttr(Loc, Ctx, CaptureKind, 0);
5389 : A->setImplicit(true);
5390 173980 : return A;
5391 : }
5392 :
5393 : OMPCaptureKindAttr(SourceRange R, ASTContext &Ctx
5394 : , unsigned CaptureKind
5395 : , unsigned SI
5396 : )
5397 178593 : : Attr(attr::OMPCaptureKind, R, SI, false)
5398 178593 : , captureKind(CaptureKind)
5399 : {
5400 : }
5401 :
5402 : OMPCaptureKindAttr *clone(ASTContext &C) const;
5403 : void printPretty(raw_ostream &OS,
5404 : const PrintingPolicy &Policy) const;
5405 : const char *getSpelling() const;
5406 0 : unsigned getCaptureKind() const {
5407 0 : return captureKind;
5408 : }
5409 :
5410 :
5411 :
5412 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OMPCaptureKind; }
5413 : };
5414 :
5415 : class OMPCaptureNoInitAttr : public InheritableAttr {
5416 : public:
5417 70 : static OMPCaptureNoInitAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5418 70 : auto *A = new (Ctx) OMPCaptureNoInitAttr(Loc, Ctx, 0);
5419 : A->setImplicit(true);
5420 70 : return A;
5421 : }
5422 :
5423 : OMPCaptureNoInitAttr(SourceRange R, ASTContext &Ctx
5424 : , unsigned SI
5425 : )
5426 : : InheritableAttr(attr::OMPCaptureNoInit, R, SI, false, false)
5427 : {
5428 : }
5429 :
5430 : OMPCaptureNoInitAttr *clone(ASTContext &C) const;
5431 : void printPretty(raw_ostream &OS,
5432 : const PrintingPolicy &Policy) const;
5433 : const char *getSpelling() const;
5434 :
5435 :
5436 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OMPCaptureNoInit; }
5437 : };
5438 :
5439 : class OMPDeclareSimdDeclAttr : public Attr {
5440 : public:
5441 : enum BranchStateTy {
5442 : BS_Undefined,
5443 : BS_Inbranch,
5444 : BS_Notinbranch
5445 : };
5446 : private:
5447 : BranchStateTy branchState;
5448 :
5449 : Expr * simdlen;
5450 :
5451 : unsigned uniforms_Size;
5452 : Expr * *uniforms_;
5453 :
5454 : unsigned aligneds_Size;
5455 : Expr * *aligneds_;
5456 :
5457 : unsigned alignments_Size;
5458 : Expr * *alignments_;
5459 :
5460 : unsigned linears_Size;
5461 : Expr * *linears_;
5462 :
5463 : unsigned modifiers_Size;
5464 : unsigned *modifiers_;
5465 :
5466 : unsigned steps_Size;
5467 : Expr * *steps_;
5468 :
5469 : public:
5470 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()) {
5471 306 : auto *A = new (Ctx) OMPDeclareSimdDeclAttr(Loc, Ctx, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize, 0);
5472 : A->setImplicit(true);
5473 306 : return A;
5474 : }
5475 :
5476 430 : OMPDeclareSimdDeclAttr(SourceRange R, ASTContext &Ctx
5477 : , BranchStateTy BranchState
5478 : , Expr * Simdlen
5479 : , Expr * *Uniforms, unsigned UniformsSize
5480 : , Expr * *Aligneds, unsigned AlignedsSize
5481 : , Expr * *Alignments, unsigned AlignmentsSize
5482 : , Expr * *Linears, unsigned LinearsSize
5483 : , unsigned *Modifiers, unsigned ModifiersSize
5484 : , Expr * *Steps, unsigned StepsSize
5485 : , unsigned SI
5486 : )
5487 430 : : Attr(attr::OMPDeclareSimdDecl, R, SI, false)
5488 : , branchState(BranchState)
5489 : , simdlen(Simdlen)
5490 430 : , uniforms_Size(UniformsSize), uniforms_(new (Ctx, 16) Expr *[uniforms_Size])
5491 430 : , aligneds_Size(AlignedsSize), aligneds_(new (Ctx, 16) Expr *[aligneds_Size])
5492 430 : , alignments_Size(AlignmentsSize), alignments_(new (Ctx, 16) Expr *[alignments_Size])
5493 430 : , linears_Size(LinearsSize), linears_(new (Ctx, 16) Expr *[linears_Size])
5494 430 : , modifiers_Size(ModifiersSize), modifiers_(new (Ctx, 16) unsigned[modifiers_Size])
5495 430 : , steps_Size(StepsSize), steps_(new (Ctx, 16) Expr *[steps_Size])
5496 : {
5497 430 : std::copy(Uniforms, Uniforms + uniforms_Size, uniforms_);
5498 430 : std::copy(Aligneds, Aligneds + aligneds_Size, aligneds_);
5499 430 : std::copy(Alignments, Alignments + alignments_Size, alignments_);
5500 430 : std::copy(Linears, Linears + linears_Size, linears_);
5501 430 : std::copy(Modifiers, Modifiers + modifiers_Size, modifiers_);
5502 430 : std::copy(Steps, Steps + steps_Size, steps_);
5503 430 : }
5504 :
5505 : OMPDeclareSimdDeclAttr(SourceRange R, ASTContext &Ctx
5506 : , BranchStateTy BranchState
5507 : , Expr * Simdlen
5508 : , unsigned SI
5509 : )
5510 : : Attr(attr::OMPDeclareSimdDecl, R, SI, false)
5511 : , branchState(BranchState)
5512 : , simdlen(Simdlen)
5513 : , uniforms_Size(0), uniforms_(nullptr)
5514 : , aligneds_Size(0), aligneds_(nullptr)
5515 : , alignments_Size(0), alignments_(nullptr)
5516 : , linears_Size(0), linears_(nullptr)
5517 : , modifiers_Size(0), modifiers_(nullptr)
5518 : , steps_Size(0), steps_(nullptr)
5519 : {
5520 : }
5521 :
5522 : OMPDeclareSimdDeclAttr *clone(ASTContext &C) const;
5523 : void printPretty(raw_ostream &OS,
5524 : const PrintingPolicy &Policy) const;
5525 : const char *getSpelling() const;
5526 0 : BranchStateTy getBranchState() const {
5527 0 : return branchState;
5528 : }
5529 :
5530 448 : static bool ConvertStrToBranchStateTy(StringRef Val, BranchStateTy &Out) {
5531 448 : Optional<BranchStateTy> R = llvm::StringSwitch<Optional<BranchStateTy>>(Val)
5532 448 : .Case("", OMPDeclareSimdDeclAttr::BS_Undefined)
5533 448 : .Case("inbranch", OMPDeclareSimdDeclAttr::BS_Inbranch)
5534 448 : .Case("notinbranch", OMPDeclareSimdDeclAttr::BS_Notinbranch)
5535 : .Default(Optional<BranchStateTy>());
5536 448 : if (R) {
5537 82 : Out = *R;
5538 82 : return true;
5539 : }
5540 : return false;
5541 : }
5542 :
5543 : static const char *ConvertBranchStateTyToStr(BranchStateTy Val) {
5544 20 : switch(Val) {
5545 : case OMPDeclareSimdDeclAttr::BS_Undefined: return "";
5546 10 : case OMPDeclareSimdDeclAttr::BS_Inbranch: return "inbranch";
5547 10 : case OMPDeclareSimdDeclAttr::BS_Notinbranch: return "notinbranch";
5548 : }
5549 0 : llvm_unreachable("No enumerator with that value");
5550 : }
5551 0 : Expr * getSimdlen() const {
5552 0 : return simdlen;
5553 : }
5554 :
5555 : typedef Expr ** uniforms_iterator;
5556 0 : uniforms_iterator uniforms_begin() const { return uniforms_; }
5557 274 : uniforms_iterator uniforms_end() const { return uniforms_ + uniforms_Size; }
5558 0 : unsigned uniforms_size() const { return uniforms_Size; }
5559 274 : llvm::iterator_range<uniforms_iterator> uniforms() const { return llvm::make_range(uniforms_begin(), uniforms_end()); }
5560 :
5561 :
5562 : typedef Expr ** aligneds_iterator;
5563 0 : aligneds_iterator aligneds_begin() const { return aligneds_; }
5564 394 : aligneds_iterator aligneds_end() const { return aligneds_ + aligneds_Size; }
5565 0 : unsigned aligneds_size() const { return aligneds_Size; }
5566 394 : llvm::iterator_range<aligneds_iterator> aligneds() const { return llvm::make_range(aligneds_begin(), aligneds_end()); }
5567 :
5568 :
5569 : typedef Expr ** alignments_iterator;
5570 0 : alignments_iterator alignments_begin() const { return alignments_; }
5571 124 : alignments_iterator alignments_end() const { return alignments_ + alignments_Size; }
5572 0 : unsigned alignments_size() const { return alignments_Size; }
5573 124 : llvm::iterator_range<alignments_iterator> alignments() const { return llvm::make_range(alignments_begin(), alignments_end()); }
5574 :
5575 :
5576 : typedef Expr ** linears_iterator;
5577 0 : linears_iterator linears_begin() const { return linears_; }
5578 394 : linears_iterator linears_end() const { return linears_ + linears_Size; }
5579 0 : unsigned linears_size() const { return linears_Size; }
5580 394 : llvm::iterator_range<linears_iterator> linears() const { return llvm::make_range(linears_begin(), linears_end()); }
5581 :
5582 :
5583 : typedef unsigned* modifiers_iterator;
5584 0 : modifiers_iterator modifiers_begin() const { return modifiers_; }
5585 182 : modifiers_iterator modifiers_end() const { return modifiers_ + modifiers_Size; }
5586 0 : unsigned modifiers_size() const { return modifiers_Size; }
5587 124 : llvm::iterator_range<modifiers_iterator> modifiers() const { return llvm::make_range(modifiers_begin(), modifiers_end()); }
5588 :
5589 :
5590 : typedef Expr ** steps_iterator;
5591 0 : steps_iterator steps_begin() const { return steps_; }
5592 124 : steps_iterator steps_end() const { return steps_ + steps_Size; }
5593 0 : unsigned steps_size() const { return steps_Size; }
5594 124 : llvm::iterator_range<steps_iterator> steps() const { return llvm::make_range(steps_begin(), steps_end()); }
5595 :
5596 :
5597 :
5598 92 : void printPrettyPragma(raw_ostream & OS, const PrintingPolicy &Policy)
5599 : const {
5600 92 : if (getBranchState() != BS_Undefined)
5601 32 : OS << ' ' << ConvertBranchStateTyToStr(getBranchState());
5602 92 : if (auto *E = getSimdlen()) {
5603 28 : OS << " simdlen(";
5604 56 : E->printPretty(OS, nullptr, Policy);
5605 28 : OS << ")";
5606 : }
5607 92 : if (uniforms_size() > 0) {
5608 20 : OS << " uniform";
5609 : StringRef Sep = "(";
5610 56 : for (auto *E : uniforms()) {
5611 36 : OS << Sep;
5612 72 : E->printPretty(OS, nullptr, Policy);
5613 36 : Sep = ", ";
5614 : }
5615 20 : OS << ")";
5616 : }
5617 92 : alignments_iterator NI = alignments_begin();
5618 156 : for (auto *E : aligneds()) {
5619 64 : OS << " aligned(";
5620 128 : E->printPretty(OS, nullptr, Policy);
5621 64 : if (*NI) {
5622 28 : OS << ": ";
5623 56 : (*NI)->printPretty(OS, nullptr, Policy);
5624 : }
5625 64 : OS << ")";
5626 64 : ++NI;
5627 : }
5628 92 : steps_iterator I = steps_begin();
5629 92 : modifiers_iterator MI = modifiers_begin();
5630 144 : for (auto *E : linears()) {
5631 52 : OS << " linear(";
5632 52 : if (*MI != OMPC_LINEAR_unknown)
5633 52 : OS << getOpenMPSimpleClauseTypeName(OMPC_linear, *MI) << "(";
5634 104 : E->printPretty(OS, nullptr, Policy);
5635 52 : if (*MI != OMPC_LINEAR_unknown)
5636 52 : OS << ")";
5637 52 : if (*I) {
5638 44 : OS << ": ";
5639 88 : (*I)->printPretty(OS, nullptr, Policy);
5640 : }
5641 52 : OS << ")";
5642 52 : ++I;
5643 52 : ++MI;
5644 : }
5645 92 : }
5646 :
5647 :
5648 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OMPDeclareSimdDecl; }
5649 : };
5650 :
5651 : class OMPDeclareTargetDeclAttr : public InheritableAttr {
5652 : public:
5653 : enum MapTypeTy {
5654 : MT_To,
5655 : MT_Link
5656 : };
5657 : private:
5658 : MapTypeTy mapType;
5659 :
5660 : public:
5661 306 : static OMPDeclareTargetDeclAttr *CreateImplicit(ASTContext &Ctx, MapTypeTy MapType, SourceRange Loc = SourceRange()) {
5662 306 : auto *A = new (Ctx) OMPDeclareTargetDeclAttr(Loc, Ctx, MapType, 0);
5663 : A->setImplicit(true);
5664 306 : return A;
5665 : }
5666 :
5667 : OMPDeclareTargetDeclAttr(SourceRange R, ASTContext &Ctx
5668 : , MapTypeTy MapType
5669 : , unsigned SI
5670 : )
5671 460 : : InheritableAttr(attr::OMPDeclareTargetDecl, R, SI, false, false)
5672 460 : , mapType(MapType)
5673 : {
5674 : }
5675 :
5676 : OMPDeclareTargetDeclAttr *clone(ASTContext &C) const;
5677 : void printPretty(raw_ostream &OS,
5678 : const PrintingPolicy &Policy) const;
5679 : const char *getSpelling() const;
5680 0 : MapTypeTy getMapType() const {
5681 0 : return mapType;
5682 : }
5683 :
5684 54 : static bool ConvertStrToMapTypeTy(StringRef Val, MapTypeTy &Out) {
5685 54 : Optional<MapTypeTy> R = llvm::StringSwitch<Optional<MapTypeTy>>(Val)
5686 54 : .Case("to", OMPDeclareTargetDeclAttr::MT_To)
5687 54 : .Case("link", OMPDeclareTargetDeclAttr::MT_Link)
5688 : .Default(Optional<MapTypeTy>());
5689 54 : if (R) {
5690 52 : Out = *R;
5691 52 : return true;
5692 : }
5693 : return false;
5694 : }
5695 :
5696 : static const char *ConvertMapTypeTyToStr(MapTypeTy Val) {
5697 0 : switch(Val) {
5698 : case OMPDeclareTargetDeclAttr::MT_To: return "to";
5699 0 : case OMPDeclareTargetDeclAttr::MT_Link: return "link";
5700 : }
5701 0 : llvm_unreachable("No enumerator with that value");
5702 : }
5703 :
5704 0 : void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
5705 : // Use fake syntax because it is for testing and debugging purpose only.
5706 0 : if (getMapType() != MT_To)
5707 0 : OS << ' ' << ConvertMapTypeTyToStr(getMapType());
5708 0 : }
5709 : static llvm::Optional<MapTypeTy>
5710 223242 : isDeclareTargetDeclaration(const ValueDecl *VD) {
5711 223242 : if (!VD->hasAttrs())
5712 : return llvm::None;
5713 11931 : if (const auto *Attr = VD->getAttr<OMPDeclareTargetDeclAttr>())
5714 1055 : return Attr->getMapType();
5715 :
5716 : return llvm::None;
5717 : }
5718 :
5719 :
5720 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OMPDeclareTargetDecl; }
5721 : };
5722 :
5723 : class OMPReferencedVarAttr : public Attr {
5724 : Expr * ref;
5725 :
5726 : public:
5727 102294 : static OMPReferencedVarAttr *CreateImplicit(ASTContext &Ctx, Expr * Ref, SourceRange Loc = SourceRange()) {
5728 102294 : auto *A = new (Ctx) OMPReferencedVarAttr(Loc, Ctx, Ref, 0);
5729 : A->setImplicit(true);
5730 102294 : return A;
5731 : }
5732 :
5733 : OMPReferencedVarAttr(SourceRange R, ASTContext &Ctx
5734 : , Expr * Ref
5735 : , unsigned SI
5736 : )
5737 110394 : : Attr(attr::OMPReferencedVar, R, SI, false)
5738 110394 : , ref(Ref)
5739 : {
5740 : }
5741 :
5742 : OMPReferencedVarAttr *clone(ASTContext &C) const;
5743 : void printPretty(raw_ostream &OS,
5744 : const PrintingPolicy &Policy) const;
5745 : const char *getSpelling() const;
5746 0 : Expr * getRef() const {
5747 0 : return ref;
5748 : }
5749 :
5750 :
5751 :
5752 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OMPReferencedVar; }
5753 : };
5754 :
5755 : class OMPThreadPrivateDeclAttr : public InheritableAttr {
5756 : public:
5757 1634 : static OMPThreadPrivateDeclAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5758 1634 : auto *A = new (Ctx) OMPThreadPrivateDeclAttr(Loc, Ctx, 0);
5759 : A->setImplicit(true);
5760 1634 : return A;
5761 : }
5762 :
5763 : OMPThreadPrivateDeclAttr(SourceRange R, ASTContext &Ctx
5764 : , unsigned SI
5765 : )
5766 : : InheritableAttr(attr::OMPThreadPrivateDecl, R, SI, false, false)
5767 : {
5768 : }
5769 :
5770 : OMPThreadPrivateDeclAttr *clone(ASTContext &C) const;
5771 : void printPretty(raw_ostream &OS,
5772 : const PrintingPolicy &Policy) const;
5773 : const char *getSpelling() const;
5774 :
5775 :
5776 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OMPThreadPrivateDecl; }
5777 : };
5778 :
5779 : class ObjCBoxableAttr : public Attr {
5780 : public:
5781 : static ObjCBoxableAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5782 : auto *A = new (Ctx) ObjCBoxableAttr(Loc, Ctx, 0);
5783 : A->setImplicit(true);
5784 : return A;
5785 : }
5786 :
5787 : ObjCBoxableAttr(SourceRange R, ASTContext &Ctx
5788 : , unsigned SI
5789 : )
5790 : : Attr(attr::ObjCBoxable, R, SI, false)
5791 : {
5792 : }
5793 :
5794 : ObjCBoxableAttr *clone(ASTContext &C) const;
5795 : void printPretty(raw_ostream &OS,
5796 : const PrintingPolicy &Policy) const;
5797 : const char *getSpelling() const;
5798 :
5799 :
5800 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCBoxable; }
5801 : };
5802 :
5803 : class ObjCBridgeAttr : public InheritableAttr {
5804 : IdentifierInfo * bridgedType;
5805 :
5806 : public:
5807 : static ObjCBridgeAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Loc = SourceRange()) {
5808 : auto *A = new (Ctx) ObjCBridgeAttr(Loc, Ctx, BridgedType, 0);
5809 : A->setImplicit(true);
5810 : return A;
5811 : }
5812 :
5813 : ObjCBridgeAttr(SourceRange R, ASTContext &Ctx
5814 : , IdentifierInfo * BridgedType
5815 : , unsigned SI
5816 : )
5817 49 : : InheritableAttr(attr::ObjCBridge, R, SI, false, false)
5818 49 : , bridgedType(BridgedType)
5819 : {
5820 : }
5821 :
5822 : ObjCBridgeAttr *clone(ASTContext &C) const;
5823 : void printPretty(raw_ostream &OS,
5824 : const PrintingPolicy &Policy) const;
5825 : const char *getSpelling() const;
5826 0 : IdentifierInfo * getBridgedType() const {
5827 0 : return bridgedType;
5828 : }
5829 :
5830 :
5831 :
5832 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCBridge; }
5833 : };
5834 :
5835 : class ObjCBridgeMutableAttr : public InheritableAttr {
5836 : IdentifierInfo * bridgedType;
5837 :
5838 : public:
5839 : static ObjCBridgeMutableAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Loc = SourceRange()) {
5840 : auto *A = new (Ctx) ObjCBridgeMutableAttr(Loc, Ctx, BridgedType, 0);
5841 : A->setImplicit(true);
5842 : return A;
5843 : }
5844 :
5845 : ObjCBridgeMutableAttr(SourceRange R, ASTContext &Ctx
5846 : , IdentifierInfo * BridgedType
5847 : , unsigned SI
5848 : )
5849 6 : : InheritableAttr(attr::ObjCBridgeMutable, R, SI, false, false)
5850 6 : , bridgedType(BridgedType)
5851 : {
5852 : }
5853 :
5854 : ObjCBridgeMutableAttr *clone(ASTContext &C) const;
5855 : void printPretty(raw_ostream &OS,
5856 : const PrintingPolicy &Policy) const;
5857 : const char *getSpelling() const;
5858 0 : IdentifierInfo * getBridgedType() const {
5859 0 : return bridgedType;
5860 : }
5861 :
5862 :
5863 :
5864 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCBridgeMutable; }
5865 : };
5866 :
5867 : class ObjCBridgeRelatedAttr : public InheritableAttr {
5868 : IdentifierInfo * relatedClass;
5869 :
5870 : IdentifierInfo * classMethod;
5871 :
5872 : IdentifierInfo * instanceMethod;
5873 :
5874 : public:
5875 : static ObjCBridgeRelatedAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, SourceRange Loc = SourceRange()) {
5876 : auto *A = new (Ctx) ObjCBridgeRelatedAttr(Loc, Ctx, RelatedClass, ClassMethod, InstanceMethod, 0);
5877 : A->setImplicit(true);
5878 : return A;
5879 : }
5880 :
5881 : ObjCBridgeRelatedAttr(SourceRange R, ASTContext &Ctx
5882 : , IdentifierInfo * RelatedClass
5883 : , IdentifierInfo * ClassMethod
5884 : , IdentifierInfo * InstanceMethod
5885 : , unsigned SI
5886 : )
5887 26 : : InheritableAttr(attr::ObjCBridgeRelated, R, SI, false, false)
5888 : , relatedClass(RelatedClass)
5889 : , classMethod(ClassMethod)
5890 26 : , instanceMethod(InstanceMethod)
5891 : {
5892 : }
5893 :
5894 : ObjCBridgeRelatedAttr *clone(ASTContext &C) const;
5895 : void printPretty(raw_ostream &OS,
5896 : const PrintingPolicy &Policy) const;
5897 : const char *getSpelling() const;
5898 0 : IdentifierInfo * getRelatedClass() const {
5899 0 : return relatedClass;
5900 : }
5901 :
5902 0 : IdentifierInfo * getClassMethod() const {
5903 0 : return classMethod;
5904 : }
5905 :
5906 0 : IdentifierInfo * getInstanceMethod() const {
5907 0 : return instanceMethod;
5908 : }
5909 :
5910 :
5911 :
5912 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCBridgeRelated; }
5913 : };
5914 :
5915 : class ObjCDesignatedInitializerAttr : public Attr {
5916 : public:
5917 : static ObjCDesignatedInitializerAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5918 : auto *A = new (Ctx) ObjCDesignatedInitializerAttr(Loc, Ctx, 0);
5919 : A->setImplicit(true);
5920 : return A;
5921 : }
5922 :
5923 : ObjCDesignatedInitializerAttr(SourceRange R, ASTContext &Ctx
5924 : , unsigned SI
5925 : )
5926 : : Attr(attr::ObjCDesignatedInitializer, R, SI, false)
5927 : {
5928 : }
5929 :
5930 : ObjCDesignatedInitializerAttr *clone(ASTContext &C) const;
5931 : void printPretty(raw_ostream &OS,
5932 : const PrintingPolicy &Policy) const;
5933 : const char *getSpelling() const;
5934 :
5935 :
5936 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCDesignatedInitializer; }
5937 : };
5938 :
5939 : class ObjCExceptionAttr : public InheritableAttr {
5940 : public:
5941 : static ObjCExceptionAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5942 : auto *A = new (Ctx) ObjCExceptionAttr(Loc, Ctx, 0);
5943 : A->setImplicit(true);
5944 : return A;
5945 : }
5946 :
5947 : ObjCExceptionAttr(SourceRange R, ASTContext &Ctx
5948 : , unsigned SI
5949 : )
5950 : : InheritableAttr(attr::ObjCException, R, SI, false, false)
5951 : {
5952 : }
5953 :
5954 : ObjCExceptionAttr *clone(ASTContext &C) const;
5955 : void printPretty(raw_ostream &OS,
5956 : const PrintingPolicy &Policy) const;
5957 : const char *getSpelling() const;
5958 :
5959 :
5960 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCException; }
5961 : };
5962 :
5963 : class ObjCExplicitProtocolImplAttr : public InheritableAttr {
5964 : public:
5965 : static ObjCExplicitProtocolImplAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
5966 : auto *A = new (Ctx) ObjCExplicitProtocolImplAttr(Loc, Ctx, 0);
5967 : A->setImplicit(true);
5968 : return A;
5969 : }
5970 :
5971 : ObjCExplicitProtocolImplAttr(SourceRange R, ASTContext &Ctx
5972 : , unsigned SI
5973 : )
5974 : : InheritableAttr(attr::ObjCExplicitProtocolImpl, R, SI, false, false)
5975 : {
5976 : }
5977 :
5978 : ObjCExplicitProtocolImplAttr *clone(ASTContext &C) const;
5979 : void printPretty(raw_ostream &OS,
5980 : const PrintingPolicy &Policy) const;
5981 : const char *getSpelling() const;
5982 :
5983 :
5984 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCExplicitProtocolImpl; }
5985 : };
5986 :
5987 : class ObjCGCAttr : public TypeAttr {
5988 : IdentifierInfo * kind;
5989 :
5990 : public:
5991 : static ObjCGCAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Loc = SourceRange()) {
5992 : auto *A = new (Ctx) ObjCGCAttr(Loc, Ctx, Kind, 0);
5993 : A->setImplicit(true);
5994 : return A;
5995 : }
5996 :
5997 : ObjCGCAttr(SourceRange R, ASTContext &Ctx
5998 : , IdentifierInfo * Kind
5999 : , unsigned SI
6000 : )
6001 214 : : TypeAttr(attr::ObjCGC, R, SI, false)
6002 214 : , kind(Kind)
6003 : {
6004 : }
6005 :
6006 : ObjCGCAttr *clone(ASTContext &C) const;
6007 : void printPretty(raw_ostream &OS,
6008 : const PrintingPolicy &Policy) const;
6009 : const char *getSpelling() const;
6010 0 : IdentifierInfo * getKind() const {
6011 0 : return kind;
6012 : }
6013 :
6014 :
6015 :
6016 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCGC; }
6017 : };
6018 :
6019 : class ObjCIndependentClassAttr : public InheritableAttr {
6020 : public:
6021 : static ObjCIndependentClassAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6022 : auto *A = new (Ctx) ObjCIndependentClassAttr(Loc, Ctx, 0);
6023 : A->setImplicit(true);
6024 : return A;
6025 : }
6026 :
6027 : ObjCIndependentClassAttr(SourceRange R, ASTContext &Ctx
6028 : , unsigned SI
6029 : )
6030 : : InheritableAttr(attr::ObjCIndependentClass, R, SI, false, false)
6031 : {
6032 : }
6033 :
6034 : ObjCIndependentClassAttr *clone(ASTContext &C) const;
6035 : void printPretty(raw_ostream &OS,
6036 : const PrintingPolicy &Policy) const;
6037 : const char *getSpelling() const;
6038 :
6039 :
6040 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCIndependentClass; }
6041 : };
6042 :
6043 : class ObjCInertUnsafeUnretainedAttr : public TypeAttr {
6044 : public:
6045 : static ObjCInertUnsafeUnretainedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6046 : auto *A = new (Ctx) ObjCInertUnsafeUnretainedAttr(Loc, Ctx, 0);
6047 : A->setImplicit(true);
6048 : return A;
6049 : }
6050 :
6051 : ObjCInertUnsafeUnretainedAttr(SourceRange R, ASTContext &Ctx
6052 : , unsigned SI
6053 : )
6054 : : TypeAttr(attr::ObjCInertUnsafeUnretained, R, SI, false)
6055 : {
6056 : }
6057 :
6058 : ObjCInertUnsafeUnretainedAttr *clone(ASTContext &C) const;
6059 : void printPretty(raw_ostream &OS,
6060 : const PrintingPolicy &Policy) const;
6061 : const char *getSpelling() const;
6062 :
6063 :
6064 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCInertUnsafeUnretained; }
6065 : };
6066 :
6067 : class ObjCKindOfAttr : public TypeAttr {
6068 : public:
6069 : static ObjCKindOfAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6070 : auto *A = new (Ctx) ObjCKindOfAttr(Loc, Ctx, 0);
6071 : A->setImplicit(true);
6072 : return A;
6073 : }
6074 :
6075 : ObjCKindOfAttr(SourceRange R, ASTContext &Ctx
6076 : , unsigned SI
6077 : )
6078 : : TypeAttr(attr::ObjCKindOf, R, SI, false)
6079 : {
6080 : }
6081 :
6082 : ObjCKindOfAttr *clone(ASTContext &C) const;
6083 : void printPretty(raw_ostream &OS,
6084 : const PrintingPolicy &Policy) const;
6085 : const char *getSpelling() const;
6086 :
6087 :
6088 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCKindOf; }
6089 : };
6090 :
6091 : class ObjCMethodFamilyAttr : public InheritableAttr {
6092 : public:
6093 : enum FamilyKind {
6094 : OMF_None,
6095 : OMF_alloc,
6096 : OMF_copy,
6097 : OMF_init,
6098 : OMF_mutableCopy,
6099 : OMF_new
6100 : };
6101 : private:
6102 : FamilyKind family;
6103 :
6104 : public:
6105 : static ObjCMethodFamilyAttr *CreateImplicit(ASTContext &Ctx, FamilyKind Family, SourceRange Loc = SourceRange()) {
6106 : auto *A = new (Ctx) ObjCMethodFamilyAttr(Loc, Ctx, Family, 0);
6107 : A->setImplicit(true);
6108 : return A;
6109 : }
6110 :
6111 : ObjCMethodFamilyAttr(SourceRange R, ASTContext &Ctx
6112 : , FamilyKind Family
6113 : , unsigned SI
6114 : )
6115 20 : : InheritableAttr(attr::ObjCMethodFamily, R, SI, false, false)
6116 20 : , family(Family)
6117 : {
6118 : }
6119 :
6120 : ObjCMethodFamilyAttr *clone(ASTContext &C) const;
6121 : void printPretty(raw_ostream &OS,
6122 : const PrintingPolicy &Policy) const;
6123 : const char *getSpelling() const;
6124 0 : FamilyKind getFamily() const {
6125 0 : return family;
6126 : }
6127 :
6128 11 : static bool ConvertStrToFamilyKind(StringRef Val, FamilyKind &Out) {
6129 11 : Optional<FamilyKind> R = llvm::StringSwitch<Optional<FamilyKind>>(Val)
6130 11 : .Case("none", ObjCMethodFamilyAttr::OMF_None)
6131 11 : .Case("alloc", ObjCMethodFamilyAttr::OMF_alloc)
6132 11 : .Case("copy", ObjCMethodFamilyAttr::OMF_copy)
6133 11 : .Case("init", ObjCMethodFamilyAttr::OMF_init)
6134 11 : .Case("mutableCopy", ObjCMethodFamilyAttr::OMF_mutableCopy)
6135 11 : .Case("new", ObjCMethodFamilyAttr::OMF_new)
6136 : .Default(Optional<FamilyKind>());
6137 11 : if (R) {
6138 11 : Out = *R;
6139 11 : return true;
6140 : }
6141 : return false;
6142 : }
6143 :
6144 : static const char *ConvertFamilyKindToStr(FamilyKind Val) {
6145 0 : switch(Val) {
6146 : case ObjCMethodFamilyAttr::OMF_None: return "none";
6147 0 : case ObjCMethodFamilyAttr::OMF_alloc: return "alloc";
6148 0 : case ObjCMethodFamilyAttr::OMF_copy: return "copy";
6149 0 : case ObjCMethodFamilyAttr::OMF_init: return "init";
6150 0 : case ObjCMethodFamilyAttr::OMF_mutableCopy: return "mutableCopy";
6151 0 : case ObjCMethodFamilyAttr::OMF_new: return "new";
6152 : }
6153 0 : llvm_unreachable("No enumerator with that value");
6154 : }
6155 :
6156 :
6157 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCMethodFamily; }
6158 : };
6159 :
6160 : class ObjCNSObjectAttr : public InheritableAttr {
6161 : public:
6162 : static ObjCNSObjectAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6163 : auto *A = new (Ctx) ObjCNSObjectAttr(Loc, Ctx, 0);
6164 : A->setImplicit(true);
6165 : return A;
6166 : }
6167 :
6168 : ObjCNSObjectAttr(SourceRange R, ASTContext &Ctx
6169 : , unsigned SI
6170 : )
6171 : : InheritableAttr(attr::ObjCNSObject, R, SI, false, false)
6172 : {
6173 : }
6174 :
6175 : ObjCNSObjectAttr *clone(ASTContext &C) const;
6176 : void printPretty(raw_ostream &OS,
6177 : const PrintingPolicy &Policy) const;
6178 : const char *getSpelling() const;
6179 :
6180 :
6181 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCNSObject; }
6182 : };
6183 :
6184 : class ObjCOwnershipAttr : public InheritableAttr {
6185 : IdentifierInfo * kind;
6186 :
6187 : public:
6188 : static ObjCOwnershipAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Loc = SourceRange()) {
6189 : auto *A = new (Ctx) ObjCOwnershipAttr(Loc, Ctx, Kind, 0);
6190 : A->setImplicit(true);
6191 : return A;
6192 : }
6193 :
6194 : ObjCOwnershipAttr(SourceRange R, ASTContext &Ctx
6195 : , IdentifierInfo * Kind
6196 : , unsigned SI
6197 : )
6198 1922 : : InheritableAttr(attr::ObjCOwnership, R, SI, false, false)
6199 1922 : , kind(Kind)
6200 : {
6201 : }
6202 :
6203 : ObjCOwnershipAttr *clone(ASTContext &C) const;
6204 : void printPretty(raw_ostream &OS,
6205 : const PrintingPolicy &Policy) const;
6206 : const char *getSpelling() const;
6207 0 : IdentifierInfo * getKind() const {
6208 0 : return kind;
6209 : }
6210 :
6211 :
6212 :
6213 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCOwnership; }
6214 : };
6215 :
6216 : class ObjCPreciseLifetimeAttr : public InheritableAttr {
6217 : public:
6218 : static ObjCPreciseLifetimeAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6219 : auto *A = new (Ctx) ObjCPreciseLifetimeAttr(Loc, Ctx, 0);
6220 : A->setImplicit(true);
6221 : return A;
6222 : }
6223 :
6224 : ObjCPreciseLifetimeAttr(SourceRange R, ASTContext &Ctx
6225 : , unsigned SI
6226 : )
6227 : : InheritableAttr(attr::ObjCPreciseLifetime, R, SI, false, false)
6228 : {
6229 : }
6230 :
6231 : ObjCPreciseLifetimeAttr *clone(ASTContext &C) const;
6232 : void printPretty(raw_ostream &OS,
6233 : const PrintingPolicy &Policy) const;
6234 : const char *getSpelling() const;
6235 :
6236 :
6237 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCPreciseLifetime; }
6238 : };
6239 :
6240 : class ObjCRequiresPropertyDefsAttr : public InheritableAttr {
6241 : public:
6242 : static ObjCRequiresPropertyDefsAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6243 : auto *A = new (Ctx) ObjCRequiresPropertyDefsAttr(Loc, Ctx, 0);
6244 : A->setImplicit(true);
6245 : return A;
6246 : }
6247 :
6248 : ObjCRequiresPropertyDefsAttr(SourceRange R, ASTContext &Ctx
6249 : , unsigned SI
6250 : )
6251 : : InheritableAttr(attr::ObjCRequiresPropertyDefs, R, SI, false, false)
6252 : {
6253 : }
6254 :
6255 : ObjCRequiresPropertyDefsAttr *clone(ASTContext &C) const;
6256 : void printPretty(raw_ostream &OS,
6257 : const PrintingPolicy &Policy) const;
6258 : const char *getSpelling() const;
6259 :
6260 :
6261 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCRequiresPropertyDefs; }
6262 : };
6263 :
6264 : class ObjCRequiresSuperAttr : public InheritableAttr {
6265 : public:
6266 80 : static ObjCRequiresSuperAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6267 80 : auto *A = new (Ctx) ObjCRequiresSuperAttr(Loc, Ctx, 0);
6268 : A->setImplicit(true);
6269 80 : return A;
6270 : }
6271 :
6272 : ObjCRequiresSuperAttr(SourceRange R, ASTContext &Ctx
6273 : , unsigned SI
6274 : )
6275 : : InheritableAttr(attr::ObjCRequiresSuper, R, SI, false, false)
6276 : {
6277 : }
6278 :
6279 : ObjCRequiresSuperAttr *clone(ASTContext &C) const;
6280 : void printPretty(raw_ostream &OS,
6281 : const PrintingPolicy &Policy) const;
6282 : const char *getSpelling() const;
6283 :
6284 :
6285 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCRequiresSuper; }
6286 : };
6287 :
6288 : class ObjCReturnsInnerPointerAttr : public InheritableAttr {
6289 : public:
6290 11 : static ObjCReturnsInnerPointerAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6291 11 : auto *A = new (Ctx) ObjCReturnsInnerPointerAttr(Loc, Ctx, 0);
6292 : A->setImplicit(true);
6293 11 : return A;
6294 : }
6295 :
6296 : ObjCReturnsInnerPointerAttr(SourceRange R, ASTContext &Ctx
6297 : , unsigned SI
6298 : )
6299 : : InheritableAttr(attr::ObjCReturnsInnerPointer, R, SI, false, false)
6300 : {
6301 : }
6302 :
6303 : ObjCReturnsInnerPointerAttr *clone(ASTContext &C) const;
6304 : void printPretty(raw_ostream &OS,
6305 : const PrintingPolicy &Policy) const;
6306 : const char *getSpelling() const;
6307 :
6308 :
6309 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCReturnsInnerPointer; }
6310 : };
6311 :
6312 : class ObjCRootClassAttr : public InheritableAttr {
6313 : public:
6314 : static ObjCRootClassAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6315 : auto *A = new (Ctx) ObjCRootClassAttr(Loc, Ctx, 0);
6316 : A->setImplicit(true);
6317 : return A;
6318 : }
6319 :
6320 : ObjCRootClassAttr(SourceRange R, ASTContext &Ctx
6321 : , unsigned SI
6322 : )
6323 : : InheritableAttr(attr::ObjCRootClass, R, SI, false, false)
6324 : {
6325 : }
6326 :
6327 : ObjCRootClassAttr *clone(ASTContext &C) const;
6328 : void printPretty(raw_ostream &OS,
6329 : const PrintingPolicy &Policy) const;
6330 : const char *getSpelling() const;
6331 :
6332 :
6333 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCRootClass; }
6334 : };
6335 :
6336 : class ObjCRuntimeNameAttr : public Attr {
6337 : unsigned metadataNameLength;
6338 : char *metadataName;
6339 :
6340 : public:
6341 : static ObjCRuntimeNameAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef MetadataName, SourceRange Loc = SourceRange()) {
6342 : auto *A = new (Ctx) ObjCRuntimeNameAttr(Loc, Ctx, MetadataName, 0);
6343 : A->setImplicit(true);
6344 : return A;
6345 : }
6346 :
6347 28 : ObjCRuntimeNameAttr(SourceRange R, ASTContext &Ctx
6348 : , llvm::StringRef MetadataName
6349 : , unsigned SI
6350 : )
6351 28 : : Attr(attr::ObjCRuntimeName, R, SI, false)
6352 28 : , metadataNameLength(MetadataName.size()),metadataName(new (Ctx, 1) char[metadataNameLength])
6353 : {
6354 28 : if (!MetadataName.empty())
6355 56 : std::memcpy(metadataName, MetadataName.data(), metadataNameLength);
6356 28 : }
6357 :
6358 : ObjCRuntimeNameAttr *clone(ASTContext &C) const;
6359 : void printPretty(raw_ostream &OS,
6360 : const PrintingPolicy &Policy) const;
6361 : const char *getSpelling() const;
6362 0 : llvm::StringRef getMetadataName() const {
6363 181 : return llvm::StringRef(metadataName, metadataNameLength);
6364 : }
6365 : unsigned getMetadataNameLength() const {
6366 : return metadataNameLength;
6367 : }
6368 : void setMetadataName(ASTContext &C, llvm::StringRef S) {
6369 : metadataNameLength = S.size();
6370 : this->metadataName = new (C, 1) char [metadataNameLength];
6371 : if (!S.empty())
6372 : std::memcpy(this->metadataName, S.data(), metadataNameLength);
6373 : }
6374 :
6375 :
6376 :
6377 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCRuntimeName; }
6378 : };
6379 :
6380 : class ObjCRuntimeVisibleAttr : public Attr {
6381 : public:
6382 : static ObjCRuntimeVisibleAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6383 : auto *A = new (Ctx) ObjCRuntimeVisibleAttr(Loc, Ctx, 0);
6384 : A->setImplicit(true);
6385 : return A;
6386 : }
6387 :
6388 : ObjCRuntimeVisibleAttr(SourceRange R, ASTContext &Ctx
6389 : , unsigned SI
6390 : )
6391 : : Attr(attr::ObjCRuntimeVisible, R, SI, false)
6392 : {
6393 : }
6394 :
6395 : ObjCRuntimeVisibleAttr *clone(ASTContext &C) const;
6396 : void printPretty(raw_ostream &OS,
6397 : const PrintingPolicy &Policy) const;
6398 : const char *getSpelling() const;
6399 :
6400 :
6401 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCRuntimeVisible; }
6402 : };
6403 :
6404 : class ObjCSubclassingRestrictedAttr : public InheritableAttr {
6405 : public:
6406 : static ObjCSubclassingRestrictedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6407 : auto *A = new (Ctx) ObjCSubclassingRestrictedAttr(Loc, Ctx, 0);
6408 : A->setImplicit(true);
6409 : return A;
6410 : }
6411 :
6412 : ObjCSubclassingRestrictedAttr(SourceRange R, ASTContext &Ctx
6413 : , unsigned SI
6414 : )
6415 : : InheritableAttr(attr::ObjCSubclassingRestricted, R, SI, false, false)
6416 : {
6417 : }
6418 :
6419 : ObjCSubclassingRestrictedAttr *clone(ASTContext &C) const;
6420 : void printPretty(raw_ostream &OS,
6421 : const PrintingPolicy &Policy) const;
6422 : const char *getSpelling() const;
6423 :
6424 :
6425 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ObjCSubclassingRestricted; }
6426 : };
6427 :
6428 : class OpenCLAccessAttr : public Attr {
6429 : public:
6430 : enum Spelling {
6431 : Keyword_read_only = 0,
6432 : Keyword_write_only = 2,
6433 : Keyword_read_write = 4
6434 : };
6435 :
6436 : static OpenCLAccessAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
6437 : auto *A = new (Ctx) OpenCLAccessAttr(Loc, Ctx, S);
6438 : A->setImplicit(true);
6439 : return A;
6440 : }
6441 :
6442 : OpenCLAccessAttr(SourceRange R, ASTContext &Ctx
6443 : , unsigned SI
6444 : )
6445 : : Attr(attr::OpenCLAccess, R, SI, false)
6446 : {
6447 : }
6448 :
6449 : OpenCLAccessAttr *clone(ASTContext &C) const;
6450 : void printPretty(raw_ostream &OS,
6451 : const PrintingPolicy &Policy) const;
6452 : const char *getSpelling() const;
6453 : Spelling getSemanticSpelling() const {
6454 8 : switch (SpellingListIndex) {
6455 0 : default: llvm_unreachable("Unknown spelling list index");
6456 : case 0: return Keyword_read_only;
6457 : case 1: return Keyword_read_only;
6458 : case 2: return Keyword_write_only;
6459 : case 3: return Keyword_write_only;
6460 : case 4: return Keyword_read_write;
6461 : case 5: return Keyword_read_write;
6462 : }
6463 : }
6464 27 : bool isReadOnly() const { return SpellingListIndex == 0 ||
6465 : SpellingListIndex == 1; }
6466 12 : bool isReadWrite() const { return SpellingListIndex == 4 ||
6467 : SpellingListIndex == 5; }
6468 44 : bool isWriteOnly() const { return SpellingListIndex == 2 ||
6469 : SpellingListIndex == 3; }
6470 :
6471 :
6472 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OpenCLAccess; }
6473 : };
6474 :
6475 : class OpenCLConstantAddressSpaceAttr : public TypeAttr {
6476 : public:
6477 : static OpenCLConstantAddressSpaceAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6478 : auto *A = new (Ctx) OpenCLConstantAddressSpaceAttr(Loc, Ctx, 0);
6479 : A->setImplicit(true);
6480 : return A;
6481 : }
6482 :
6483 : OpenCLConstantAddressSpaceAttr(SourceRange R, ASTContext &Ctx
6484 : , unsigned SI
6485 : )
6486 : : TypeAttr(attr::OpenCLConstantAddressSpace, R, SI, false)
6487 : {
6488 : }
6489 :
6490 : OpenCLConstantAddressSpaceAttr *clone(ASTContext &C) const;
6491 : void printPretty(raw_ostream &OS,
6492 : const PrintingPolicy &Policy) const;
6493 : const char *getSpelling() const;
6494 :
6495 :
6496 : static bool classof(const Attr *A) { return A->getKind() == attr::OpenCLConstantAddressSpace; }
6497 : };
6498 :
6499 : class OpenCLGenericAddressSpaceAttr : public TypeAttr {
6500 : public:
6501 : static OpenCLGenericAddressSpaceAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6502 : auto *A = new (Ctx) OpenCLGenericAddressSpaceAttr(Loc, Ctx, 0);
6503 : A->setImplicit(true);
6504 : return A;
6505 : }
6506 :
6507 : OpenCLGenericAddressSpaceAttr(SourceRange R, ASTContext &Ctx
6508 : , unsigned SI
6509 : )
6510 : : TypeAttr(attr::OpenCLGenericAddressSpace, R, SI, false)
6511 : {
6512 : }
6513 :
6514 : OpenCLGenericAddressSpaceAttr *clone(ASTContext &C) const;
6515 : void printPretty(raw_ostream &OS,
6516 : const PrintingPolicy &Policy) const;
6517 : const char *getSpelling() const;
6518 :
6519 :
6520 : static bool classof(const Attr *A) { return A->getKind() == attr::OpenCLGenericAddressSpace; }
6521 : };
6522 :
6523 : class OpenCLGlobalAddressSpaceAttr : public TypeAttr {
6524 : public:
6525 : static OpenCLGlobalAddressSpaceAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6526 : auto *A = new (Ctx) OpenCLGlobalAddressSpaceAttr(Loc, Ctx, 0);
6527 : A->setImplicit(true);
6528 : return A;
6529 : }
6530 :
6531 : OpenCLGlobalAddressSpaceAttr(SourceRange R, ASTContext &Ctx
6532 : , unsigned SI
6533 : )
6534 : : TypeAttr(attr::OpenCLGlobalAddressSpace, R, SI, false)
6535 : {
6536 : }
6537 :
6538 : OpenCLGlobalAddressSpaceAttr *clone(ASTContext &C) const;
6539 : void printPretty(raw_ostream &OS,
6540 : const PrintingPolicy &Policy) const;
6541 : const char *getSpelling() const;
6542 :
6543 :
6544 : static bool classof(const Attr *A) { return A->getKind() == attr::OpenCLGlobalAddressSpace; }
6545 : };
6546 :
6547 : class OpenCLIntelReqdSubGroupSizeAttr : public InheritableAttr {
6548 : unsigned subGroupSize;
6549 :
6550 : public:
6551 : static OpenCLIntelReqdSubGroupSizeAttr *CreateImplicit(ASTContext &Ctx, unsigned SubGroupSize, SourceRange Loc = SourceRange()) {
6552 : auto *A = new (Ctx) OpenCLIntelReqdSubGroupSizeAttr(Loc, Ctx, SubGroupSize, 0);
6553 : A->setImplicit(true);
6554 : return A;
6555 : }
6556 :
6557 : OpenCLIntelReqdSubGroupSizeAttr(SourceRange R, ASTContext &Ctx
6558 : , unsigned SubGroupSize
6559 : , unsigned SI
6560 : )
6561 5 : : InheritableAttr(attr::OpenCLIntelReqdSubGroupSize, R, SI, false, false)
6562 5 : , subGroupSize(SubGroupSize)
6563 : {
6564 : }
6565 :
6566 : OpenCLIntelReqdSubGroupSizeAttr *clone(ASTContext &C) const;
6567 : void printPretty(raw_ostream &OS,
6568 : const PrintingPolicy &Policy) const;
6569 : const char *getSpelling() const;
6570 0 : unsigned getSubGroupSize() const {
6571 0 : return subGroupSize;
6572 : }
6573 :
6574 :
6575 :
6576 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OpenCLIntelReqdSubGroupSize; }
6577 : };
6578 :
6579 : class OpenCLKernelAttr : public InheritableAttr {
6580 : public:
6581 : static OpenCLKernelAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6582 : auto *A = new (Ctx) OpenCLKernelAttr(Loc, Ctx, 0);
6583 : A->setImplicit(true);
6584 : return A;
6585 : }
6586 :
6587 : OpenCLKernelAttr(SourceRange R, ASTContext &Ctx
6588 : , unsigned SI
6589 : )
6590 : : InheritableAttr(attr::OpenCLKernel, R, SI, false, false)
6591 : {
6592 : }
6593 :
6594 : OpenCLKernelAttr *clone(ASTContext &C) const;
6595 : void printPretty(raw_ostream &OS,
6596 : const PrintingPolicy &Policy) const;
6597 : const char *getSpelling() const;
6598 :
6599 :
6600 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OpenCLKernel; }
6601 : };
6602 :
6603 : class OpenCLLocalAddressSpaceAttr : public TypeAttr {
6604 : public:
6605 : static OpenCLLocalAddressSpaceAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6606 : auto *A = new (Ctx) OpenCLLocalAddressSpaceAttr(Loc, Ctx, 0);
6607 : A->setImplicit(true);
6608 : return A;
6609 : }
6610 :
6611 : OpenCLLocalAddressSpaceAttr(SourceRange R, ASTContext &Ctx
6612 : , unsigned SI
6613 : )
6614 : : TypeAttr(attr::OpenCLLocalAddressSpace, R, SI, false)
6615 : {
6616 : }
6617 :
6618 : OpenCLLocalAddressSpaceAttr *clone(ASTContext &C) const;
6619 : void printPretty(raw_ostream &OS,
6620 : const PrintingPolicy &Policy) const;
6621 : const char *getSpelling() const;
6622 :
6623 :
6624 : static bool classof(const Attr *A) { return A->getKind() == attr::OpenCLLocalAddressSpace; }
6625 : };
6626 :
6627 : class OpenCLPrivateAddressSpaceAttr : public TypeAttr {
6628 : public:
6629 : static OpenCLPrivateAddressSpaceAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6630 : auto *A = new (Ctx) OpenCLPrivateAddressSpaceAttr(Loc, Ctx, 0);
6631 : A->setImplicit(true);
6632 : return A;
6633 : }
6634 :
6635 : OpenCLPrivateAddressSpaceAttr(SourceRange R, ASTContext &Ctx
6636 : , unsigned SI
6637 : )
6638 : : TypeAttr(attr::OpenCLPrivateAddressSpace, R, SI, false)
6639 : {
6640 : }
6641 :
6642 : OpenCLPrivateAddressSpaceAttr *clone(ASTContext &C) const;
6643 : void printPretty(raw_ostream &OS,
6644 : const PrintingPolicy &Policy) const;
6645 : const char *getSpelling() const;
6646 :
6647 :
6648 : static bool classof(const Attr *A) { return A->getKind() == attr::OpenCLPrivateAddressSpace; }
6649 : };
6650 :
6651 : class OpenCLUnrollHintAttr : public InheritableAttr {
6652 : unsigned unrollHint;
6653 :
6654 : public:
6655 18 : static OpenCLUnrollHintAttr *CreateImplicit(ASTContext &Ctx, unsigned UnrollHint, SourceRange Loc = SourceRange()) {
6656 18 : auto *A = new (Ctx) OpenCLUnrollHintAttr(Loc, Ctx, UnrollHint, 0);
6657 : A->setImplicit(true);
6658 18 : return A;
6659 : }
6660 :
6661 : OpenCLUnrollHintAttr(SourceRange R, ASTContext &Ctx
6662 : , unsigned UnrollHint
6663 : , unsigned SI
6664 : )
6665 18 : : InheritableAttr(attr::OpenCLUnrollHint, R, SI, false, false)
6666 18 : , unrollHint(UnrollHint)
6667 : {
6668 : }
6669 :
6670 : OpenCLUnrollHintAttr *clone(ASTContext &C) const;
6671 : void printPretty(raw_ostream &OS,
6672 : const PrintingPolicy &Policy) const;
6673 : const char *getSpelling() const;
6674 0 : unsigned getUnrollHint() const {
6675 0 : return unrollHint;
6676 : }
6677 :
6678 :
6679 :
6680 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OpenCLUnrollHint; }
6681 : };
6682 :
6683 : class OptimizeNoneAttr : public InheritableAttr {
6684 : public:
6685 22 : static OptimizeNoneAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6686 22 : auto *A = new (Ctx) OptimizeNoneAttr(Loc, Ctx, 0);
6687 : A->setImplicit(true);
6688 22 : return A;
6689 : }
6690 :
6691 : OptimizeNoneAttr(SourceRange R, ASTContext &Ctx
6692 : , unsigned SI
6693 : )
6694 : : InheritableAttr(attr::OptimizeNone, R, SI, false, false)
6695 : {
6696 : }
6697 :
6698 : OptimizeNoneAttr *clone(ASTContext &C) const;
6699 : void printPretty(raw_ostream &OS,
6700 : const PrintingPolicy &Policy) const;
6701 : const char *getSpelling() const;
6702 :
6703 :
6704 0 : static bool classof(const Attr *A) { return A->getKind() == attr::OptimizeNone; }
6705 : };
6706 :
6707 : class OverloadableAttr : public Attr {
6708 : public:
6709 18 : static OverloadableAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6710 18 : auto *A = new (Ctx) OverloadableAttr(Loc, Ctx, 0);
6711 : A->setImplicit(true);
6712 18 : return A;
6713 : }
6714 :
6715 : OverloadableAttr(SourceRange R, ASTContext &Ctx
6716 : , unsigned SI
6717 : )
6718 : : Attr(attr::Overloadable, R, SI, false)
6719 : {
6720 : }
6721 :
6722 : OverloadableAttr *clone(ASTContext &C) const;
6723 : void printPretty(raw_ostream &OS,
6724 : const PrintingPolicy &Policy) const;
6725 : const char *getSpelling() const;
6726 :
6727 :
6728 4 : static bool classof(const Attr *A) { return A->getKind() == attr::Overloadable; }
6729 : };
6730 :
6731 : class OverrideAttr : public InheritableAttr {
6732 : public:
6733 : static OverrideAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6734 : auto *A = new (Ctx) OverrideAttr(Loc, Ctx, 0);
6735 : A->setImplicit(true);
6736 : return A;
6737 : }
6738 :
6739 : OverrideAttr(SourceRange R, ASTContext &Ctx
6740 : , unsigned SI
6741 : )
6742 : : InheritableAttr(attr::Override, R, SI, false, false)
6743 : {
6744 : }
6745 :
6746 : OverrideAttr *clone(ASTContext &C) const;
6747 : void printPretty(raw_ostream &OS,
6748 : const PrintingPolicy &Policy) const;
6749 : const char *getSpelling() const;
6750 :
6751 :
6752 8 : static bool classof(const Attr *A) { return A->getKind() == attr::Override; }
6753 : };
6754 :
6755 : class OwnershipAttr : public InheritableAttr {
6756 : IdentifierInfo * module;
6757 :
6758 : unsigned args_Size;
6759 : ParamIdx *args_;
6760 :
6761 : public:
6762 : enum Spelling {
6763 : GNU_ownership_holds = 0,
6764 : CXX11_clang_ownership_holds = 1,
6765 : C2x_clang_ownership_holds = 2,
6766 : GNU_ownership_returns = 3,
6767 : CXX11_clang_ownership_returns = 4,
6768 : C2x_clang_ownership_returns = 5,
6769 : GNU_ownership_takes = 6,
6770 : CXX11_clang_ownership_takes = 7,
6771 : C2x_clang_ownership_takes = 8
6772 : };
6773 :
6774 : static OwnershipAttr *CreateImplicit(ASTContext &Ctx, Spelling S, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
6775 : auto *A = new (Ctx) OwnershipAttr(Loc, Ctx, Module, Args, ArgsSize, S);
6776 : A->setImplicit(true);
6777 : return A;
6778 : }
6779 :
6780 90 : OwnershipAttr(SourceRange R, ASTContext &Ctx
6781 : , IdentifierInfo * Module
6782 : , ParamIdx *Args, unsigned ArgsSize
6783 : , unsigned SI
6784 : )
6785 90 : : InheritableAttr(attr::Ownership, R, SI, false, false)
6786 : , module(Module)
6787 139 : , args_Size(ArgsSize), args_(new (Ctx, 16) ParamIdx[args_Size])
6788 : {
6789 90 : std::copy(Args, Args + args_Size, args_);
6790 90 : }
6791 :
6792 : OwnershipAttr(SourceRange R, ASTContext &Ctx
6793 : , IdentifierInfo * Module
6794 : , unsigned SI
6795 : )
6796 : : InheritableAttr(attr::Ownership, R, SI, false, false)
6797 : , module(Module)
6798 : , args_Size(0), args_(nullptr)
6799 : {
6800 : }
6801 :
6802 : OwnershipAttr *clone(ASTContext &C) const;
6803 : void printPretty(raw_ostream &OS,
6804 : const PrintingPolicy &Policy) const;
6805 : const char *getSpelling() const;
6806 : Spelling getSemanticSpelling() const {
6807 : switch (SpellingListIndex) {
6808 : default: llvm_unreachable("Unknown spelling list index");
6809 : case 0: return GNU_ownership_holds;
6810 : case 1: return CXX11_clang_ownership_holds;
6811 : case 2: return C2x_clang_ownership_holds;
6812 : case 3: return GNU_ownership_returns;
6813 : case 4: return CXX11_clang_ownership_returns;
6814 : case 5: return C2x_clang_ownership_returns;
6815 : case 6: return GNU_ownership_takes;
6816 : case 7: return CXX11_clang_ownership_takes;
6817 : case 8: return C2x_clang_ownership_takes;
6818 : }
6819 : }
6820 142 : bool isHolds() const { return SpellingListIndex == 0 ||
6821 144 : SpellingListIndex == 1 ||
6822 91 : SpellingListIndex == 2; }
6823 : bool isReturns() const { return SpellingListIndex == 3 ||
6824 : SpellingListIndex == 4 ||
6825 : SpellingListIndex == 5; }
6826 : bool isTakes() const { return SpellingListIndex == 6 ||
6827 91 : SpellingListIndex == 7 ||
6828 : SpellingListIndex == 8; }
6829 0 : IdentifierInfo * getModule() const {
6830 0 : return module;
6831 : }
6832 :
6833 : typedef ParamIdx* args_iterator;
6834 0 : args_iterator args_begin() const { return args_; }
6835 22 : args_iterator args_end() const { return args_ + args_Size; }
6836 0 : unsigned args_size() const { return args_Size; }
6837 29 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
6838 :
6839 :
6840 :
6841 : enum OwnershipKind { Holds, Returns, Takes };
6842 : OwnershipKind getOwnKind() const {
6843 : return isHolds() ? Holds :
6844 : isTakes() ? Takes :
6845 : Returns;
6846 : }
6847 :
6848 :
6849 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Ownership; }
6850 : };
6851 :
6852 : class PackedAttr : public InheritableAttr {
6853 : public:
6854 1328 : static PackedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6855 1328 : auto *A = new (Ctx) PackedAttr(Loc, Ctx, 0);
6856 : A->setImplicit(true);
6857 1328 : return A;
6858 : }
6859 :
6860 : PackedAttr(SourceRange R, ASTContext &Ctx
6861 : , unsigned SI
6862 : )
6863 : : InheritableAttr(attr::Packed, R, SI, false, false)
6864 : {
6865 : }
6866 :
6867 : PackedAttr *clone(ASTContext &C) const;
6868 : void printPretty(raw_ostream &OS,
6869 : const PrintingPolicy &Policy) const;
6870 : const char *getSpelling() const;
6871 :
6872 :
6873 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Packed; }
6874 : };
6875 :
6876 : class ParamTypestateAttr : public InheritableAttr {
6877 : public:
6878 : enum ConsumedState {
6879 : Unknown,
6880 : Consumed,
6881 : Unconsumed
6882 : };
6883 : private:
6884 : ConsumedState paramState;
6885 :
6886 : public:
6887 : static ParamTypestateAttr *CreateImplicit(ASTContext &Ctx, ConsumedState ParamState, SourceRange Loc = SourceRange()) {
6888 : auto *A = new (Ctx) ParamTypestateAttr(Loc, Ctx, ParamState, 0);
6889 : A->setImplicit(true);
6890 : return A;
6891 : }
6892 :
6893 : ParamTypestateAttr(SourceRange R, ASTContext &Ctx
6894 : , ConsumedState ParamState
6895 : , unsigned SI
6896 : )
6897 7 : : InheritableAttr(attr::ParamTypestate, R, SI, false, false)
6898 7 : , paramState(ParamState)
6899 : {
6900 : }
6901 :
6902 : ParamTypestateAttr *clone(ASTContext &C) const;
6903 : void printPretty(raw_ostream &OS,
6904 : const PrintingPolicy &Policy) const;
6905 : const char *getSpelling() const;
6906 0 : ConsumedState getParamState() const {
6907 0 : return paramState;
6908 : }
6909 :
6910 7 : static bool ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) {
6911 7 : Optional<ConsumedState> R = llvm::StringSwitch<Optional<ConsumedState>>(Val)
6912 7 : .Case("unknown", ParamTypestateAttr::Unknown)
6913 7 : .Case("consumed", ParamTypestateAttr::Consumed)
6914 7 : .Case("unconsumed", ParamTypestateAttr::Unconsumed)
6915 : .Default(Optional<ConsumedState>());
6916 7 : if (R) {
6917 7 : Out = *R;
6918 7 : return true;
6919 : }
6920 : return false;
6921 : }
6922 :
6923 : static const char *ConvertConsumedStateToStr(ConsumedState Val) {
6924 0 : switch(Val) {
6925 : case ParamTypestateAttr::Unknown: return "unknown";
6926 0 : case ParamTypestateAttr::Consumed: return "consumed";
6927 0 : case ParamTypestateAttr::Unconsumed: return "unconsumed";
6928 : }
6929 0 : llvm_unreachable("No enumerator with that value");
6930 : }
6931 :
6932 :
6933 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ParamTypestate; }
6934 : };
6935 :
6936 : class PascalAttr : public InheritableAttr {
6937 : public:
6938 : static PascalAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
6939 : auto *A = new (Ctx) PascalAttr(Loc, Ctx, 0);
6940 : A->setImplicit(true);
6941 : return A;
6942 : }
6943 :
6944 : PascalAttr(SourceRange R, ASTContext &Ctx
6945 : , unsigned SI
6946 : )
6947 : : InheritableAttr(attr::Pascal, R, SI, false, false)
6948 : {
6949 : }
6950 :
6951 : PascalAttr *clone(ASTContext &C) const;
6952 : void printPretty(raw_ostream &OS,
6953 : const PrintingPolicy &Policy) const;
6954 : const char *getSpelling() const;
6955 :
6956 :
6957 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Pascal; }
6958 : };
6959 :
6960 : class PassObjectSizeAttr : public InheritableParamAttr {
6961 : int type;
6962 :
6963 : public:
6964 : static PassObjectSizeAttr *CreateImplicit(ASTContext &Ctx, int Type, SourceRange Loc = SourceRange()) {
6965 : auto *A = new (Ctx) PassObjectSizeAttr(Loc, Ctx, Type, 0);
6966 : A->setImplicit(true);
6967 : return A;
6968 : }
6969 :
6970 : PassObjectSizeAttr(SourceRange R, ASTContext &Ctx
6971 : , int Type
6972 : , unsigned SI
6973 : )
6974 139 : : InheritableParamAttr(attr::PassObjectSize, R, SI, false, false)
6975 139 : , type(Type)
6976 : {
6977 : }
6978 :
6979 : PassObjectSizeAttr *clone(ASTContext &C) const;
6980 : void printPretty(raw_ostream &OS,
6981 : const PrintingPolicy &Policy) const;
6982 : const char *getSpelling() const;
6983 0 : int getType() const {
6984 0 : return type;
6985 : }
6986 :
6987 :
6988 :
6989 0 : static bool classof(const Attr *A) { return A->getKind() == attr::PassObjectSize; }
6990 : };
6991 :
6992 : class PcsAttr : public InheritableAttr {
6993 : public:
6994 : enum PCSType {
6995 : AAPCS,
6996 : AAPCS_VFP
6997 : };
6998 : private:
6999 : PCSType pCS;
7000 :
7001 : public:
7002 : static PcsAttr *CreateImplicit(ASTContext &Ctx, PCSType PCS, SourceRange Loc = SourceRange()) {
7003 : auto *A = new (Ctx) PcsAttr(Loc, Ctx, PCS, 0);
7004 : A->setImplicit(true);
7005 : return A;
7006 : }
7007 :
7008 : PcsAttr(SourceRange R, ASTContext &Ctx
7009 : , PCSType PCS
7010 : , unsigned SI
7011 : )
7012 20 : : InheritableAttr(attr::Pcs, R, SI, false, false)
7013 20 : , pCS(PCS)
7014 : {
7015 : }
7016 :
7017 : PcsAttr *clone(ASTContext &C) const;
7018 : void printPretty(raw_ostream &OS,
7019 : const PrintingPolicy &Policy) const;
7020 : const char *getSpelling() const;
7021 0 : PCSType getPCS() const {
7022 0 : return pCS;
7023 : }
7024 :
7025 20 : static bool ConvertStrToPCSType(StringRef Val, PCSType &Out) {
7026 20 : Optional<PCSType> R = llvm::StringSwitch<Optional<PCSType>>(Val)
7027 20 : .Case("aapcs", PcsAttr::AAPCS)
7028 20 : .Case("aapcs-vfp", PcsAttr::AAPCS_VFP)
7029 : .Default(Optional<PCSType>());
7030 20 : if (R) {
7031 20 : Out = *R;
7032 20 : return true;
7033 : }
7034 : return false;
7035 : }
7036 :
7037 : static const char *ConvertPCSTypeToStr(PCSType Val) {
7038 0 : switch(Val) {
7039 : case PcsAttr::AAPCS: return "aapcs";
7040 0 : case PcsAttr::AAPCS_VFP: return "aapcs-vfp";
7041 : }
7042 0 : llvm_unreachable("No enumerator with that value");
7043 : }
7044 :
7045 :
7046 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Pcs; }
7047 : };
7048 :
7049 : class PragmaClangBSSSectionAttr : public InheritableAttr {
7050 : unsigned nameLength;
7051 : char *name;
7052 :
7053 : public:
7054 22 : static PragmaClangBSSSectionAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Loc = SourceRange()) {
7055 22 : auto *A = new (Ctx) PragmaClangBSSSectionAttr(Loc, Ctx, Name, 0);
7056 : A->setImplicit(true);
7057 22 : return A;
7058 : }
7059 :
7060 27 : PragmaClangBSSSectionAttr(SourceRange R, ASTContext &Ctx
7061 : , llvm::StringRef Name
7062 : , unsigned SI
7063 : )
7064 27 : : InheritableAttr(attr::PragmaClangBSSSection, R, SI, false, false)
7065 27 : , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
7066 : {
7067 27 : if (!Name.empty())
7068 54 : std::memcpy(name, Name.data(), nameLength);
7069 27 : }
7070 :
7071 : PragmaClangBSSSectionAttr *clone(ASTContext &C) const;
7072 : void printPretty(raw_ostream &OS,
7073 : const PrintingPolicy &Policy) const;
7074 : const char *getSpelling() const;
7075 0 : llvm::StringRef getName() const {
7076 23 : return llvm::StringRef(name, nameLength);
7077 : }
7078 : unsigned getNameLength() const {
7079 : return nameLength;
7080 : }
7081 : void setName(ASTContext &C, llvm::StringRef S) {
7082 : nameLength = S.size();
7083 : this->name = new (C, 1) char [nameLength];
7084 : if (!S.empty())
7085 : std::memcpy(this->name, S.data(), nameLength);
7086 : }
7087 :
7088 :
7089 :
7090 0 : static bool classof(const Attr *A) { return A->getKind() == attr::PragmaClangBSSSection; }
7091 : };
7092 :
7093 : class PragmaClangDataSectionAttr : public InheritableAttr {
7094 : unsigned nameLength;
7095 : char *name;
7096 :
7097 : public:
7098 10 : static PragmaClangDataSectionAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Loc = SourceRange()) {
7099 10 : auto *A = new (Ctx) PragmaClangDataSectionAttr(Loc, Ctx, Name, 0);
7100 : A->setImplicit(true);
7101 10 : return A;
7102 : }
7103 :
7104 10 : PragmaClangDataSectionAttr(SourceRange R, ASTContext &Ctx
7105 : , llvm::StringRef Name
7106 : , unsigned SI
7107 : )
7108 10 : : InheritableAttr(attr::PragmaClangDataSection, R, SI, false, false)
7109 10 : , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
7110 : {
7111 10 : if (!Name.empty())
7112 20 : std::memcpy(name, Name.data(), nameLength);
7113 10 : }
7114 :
7115 : PragmaClangDataSectionAttr *clone(ASTContext &C) const;
7116 : void printPretty(raw_ostream &OS,
7117 : const PrintingPolicy &Policy) const;
7118 : const char *getSpelling() const;
7119 0 : llvm::StringRef getName() const {
7120 10 : return llvm::StringRef(name, nameLength);
7121 : }
7122 : unsigned getNameLength() const {
7123 : return nameLength;
7124 : }
7125 : void setName(ASTContext &C, llvm::StringRef S) {
7126 : nameLength = S.size();
7127 : this->name = new (C, 1) char [nameLength];
7128 : if (!S.empty())
7129 : std::memcpy(this->name, S.data(), nameLength);
7130 : }
7131 :
7132 :
7133 :
7134 0 : static bool classof(const Attr *A) { return A->getKind() == attr::PragmaClangDataSection; }
7135 : };
7136 :
7137 : class PragmaClangRodataSectionAttr : public InheritableAttr {
7138 : unsigned nameLength;
7139 : char *name;
7140 :
7141 : public:
7142 17 : static PragmaClangRodataSectionAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Loc = SourceRange()) {
7143 17 : auto *A = new (Ctx) PragmaClangRodataSectionAttr(Loc, Ctx, Name, 0);
7144 : A->setImplicit(true);
7145 17 : return A;
7146 : }
7147 :
7148 19 : PragmaClangRodataSectionAttr(SourceRange R, ASTContext &Ctx
7149 : , llvm::StringRef Name
7150 : , unsigned SI
7151 : )
7152 19 : : InheritableAttr(attr::PragmaClangRodataSection, R, SI, false, false)
7153 19 : , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
7154 : {
7155 19 : if (!Name.empty())
7156 38 : std::memcpy(name, Name.data(), nameLength);
7157 19 : }
7158 :
7159 : PragmaClangRodataSectionAttr *clone(ASTContext &C) const;
7160 : void printPretty(raw_ostream &OS,
7161 : const PrintingPolicy &Policy) const;
7162 : const char *getSpelling() const;
7163 0 : llvm::StringRef getName() const {
7164 18 : return llvm::StringRef(name, nameLength);
7165 : }
7166 : unsigned getNameLength() const {
7167 : return nameLength;
7168 : }
7169 : void setName(ASTContext &C, llvm::StringRef S) {
7170 : nameLength = S.size();
7171 : this->name = new (C, 1) char [nameLength];
7172 : if (!S.empty())
7173 : std::memcpy(this->name, S.data(), nameLength);
7174 : }
7175 :
7176 :
7177 :
7178 0 : static bool classof(const Attr *A) { return A->getKind() == attr::PragmaClangRodataSection; }
7179 : };
7180 :
7181 : class PragmaClangTextSectionAttr : public InheritableAttr {
7182 : unsigned nameLength;
7183 : char *name;
7184 :
7185 : public:
7186 6 : static PragmaClangTextSectionAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Loc = SourceRange()) {
7187 6 : auto *A = new (Ctx) PragmaClangTextSectionAttr(Loc, Ctx, Name, 0);
7188 : A->setImplicit(true);
7189 6 : return A;
7190 : }
7191 :
7192 6 : PragmaClangTextSectionAttr(SourceRange R, ASTContext &Ctx
7193 : , llvm::StringRef Name
7194 : , unsigned SI
7195 : )
7196 6 : : InheritableAttr(attr::PragmaClangTextSection, R, SI, false, false)
7197 6 : , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
7198 : {
7199 6 : if (!Name.empty())
7200 12 : std::memcpy(name, Name.data(), nameLength);
7201 6 : }
7202 :
7203 : PragmaClangTextSectionAttr *clone(ASTContext &C) const;
7204 : void printPretty(raw_ostream &OS,
7205 : const PrintingPolicy &Policy) const;
7206 : const char *getSpelling() const;
7207 0 : llvm::StringRef getName() const {
7208 2 : return llvm::StringRef(name, nameLength);
7209 : }
7210 : unsigned getNameLength() const {
7211 : return nameLength;
7212 : }
7213 : void setName(ASTContext &C, llvm::StringRef S) {
7214 : nameLength = S.size();
7215 : this->name = new (C, 1) char [nameLength];
7216 : if (!S.empty())
7217 : std::memcpy(this->name, S.data(), nameLength);
7218 : }
7219 :
7220 :
7221 :
7222 0 : static bool classof(const Attr *A) { return A->getKind() == attr::PragmaClangTextSection; }
7223 : };
7224 :
7225 : class PreserveAllAttr : public InheritableAttr {
7226 : public:
7227 : static PreserveAllAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7228 : auto *A = new (Ctx) PreserveAllAttr(Loc, Ctx, 0);
7229 : A->setImplicit(true);
7230 : return A;
7231 : }
7232 :
7233 : PreserveAllAttr(SourceRange R, ASTContext &Ctx
7234 : , unsigned SI
7235 : )
7236 : : InheritableAttr(attr::PreserveAll, R, SI, false, false)
7237 : {
7238 : }
7239 :
7240 : PreserveAllAttr *clone(ASTContext &C) const;
7241 : void printPretty(raw_ostream &OS,
7242 : const PrintingPolicy &Policy) const;
7243 : const char *getSpelling() const;
7244 :
7245 :
7246 0 : static bool classof(const Attr *A) { return A->getKind() == attr::PreserveAll; }
7247 : };
7248 :
7249 : class PreserveMostAttr : public InheritableAttr {
7250 : public:
7251 : static PreserveMostAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7252 : auto *A = new (Ctx) PreserveMostAttr(Loc, Ctx, 0);
7253 : A->setImplicit(true);
7254 : return A;
7255 : }
7256 :
7257 : PreserveMostAttr(SourceRange R, ASTContext &Ctx
7258 : , unsigned SI
7259 : )
7260 : : InheritableAttr(attr::PreserveMost, R, SI, false, false)
7261 : {
7262 : }
7263 :
7264 : PreserveMostAttr *clone(ASTContext &C) const;
7265 : void printPretty(raw_ostream &OS,
7266 : const PrintingPolicy &Policy) const;
7267 : const char *getSpelling() const;
7268 :
7269 :
7270 0 : static bool classof(const Attr *A) { return A->getKind() == attr::PreserveMost; }
7271 : };
7272 :
7273 : class PtGuardedByAttr : public InheritableAttr {
7274 : Expr * arg;
7275 :
7276 : public:
7277 : static PtGuardedByAttr *CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Loc = SourceRange()) {
7278 : auto *A = new (Ctx) PtGuardedByAttr(Loc, Ctx, Arg, 0);
7279 : A->setImplicit(true);
7280 : return A;
7281 : }
7282 :
7283 : PtGuardedByAttr(SourceRange R, ASTContext &Ctx
7284 : , Expr * Arg
7285 : , unsigned SI
7286 : )
7287 125 : : InheritableAttr(attr::PtGuardedBy, R, SI, true, true)
7288 125 : , arg(Arg)
7289 : {
7290 : }
7291 :
7292 : PtGuardedByAttr *clone(ASTContext &C) const;
7293 : void printPretty(raw_ostream &OS,
7294 : const PrintingPolicy &Policy) const;
7295 : const char *getSpelling() const;
7296 0 : Expr * getArg() const {
7297 0 : return arg;
7298 : }
7299 :
7300 :
7301 :
7302 0 : static bool classof(const Attr *A) { return A->getKind() == attr::PtGuardedBy; }
7303 : };
7304 :
7305 : class PtGuardedVarAttr : public InheritableAttr {
7306 : public:
7307 : static PtGuardedVarAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7308 : auto *A = new (Ctx) PtGuardedVarAttr(Loc, Ctx, 0);
7309 : A->setImplicit(true);
7310 : return A;
7311 : }
7312 :
7313 : PtGuardedVarAttr(SourceRange R, ASTContext &Ctx
7314 : , unsigned SI
7315 : )
7316 : : InheritableAttr(attr::PtGuardedVar, R, SI, false, false)
7317 : {
7318 : }
7319 :
7320 : PtGuardedVarAttr *clone(ASTContext &C) const;
7321 : void printPretty(raw_ostream &OS,
7322 : const PrintingPolicy &Policy) const;
7323 : const char *getSpelling() const;
7324 :
7325 :
7326 0 : static bool classof(const Attr *A) { return A->getKind() == attr::PtGuardedVar; }
7327 : };
7328 :
7329 : class Ptr32Attr : public TypeAttr {
7330 : public:
7331 : static Ptr32Attr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7332 : auto *A = new (Ctx) Ptr32Attr(Loc, Ctx, 0);
7333 : A->setImplicit(true);
7334 : return A;
7335 : }
7336 :
7337 : Ptr32Attr(SourceRange R, ASTContext &Ctx
7338 : , unsigned SI
7339 : )
7340 : : TypeAttr(attr::Ptr32, R, SI, false)
7341 : {
7342 : }
7343 :
7344 : Ptr32Attr *clone(ASTContext &C) const;
7345 : void printPretty(raw_ostream &OS,
7346 : const PrintingPolicy &Policy) const;
7347 : const char *getSpelling() const;
7348 :
7349 :
7350 : static bool classof(const Attr *A) { return A->getKind() == attr::Ptr32; }
7351 : };
7352 :
7353 : class Ptr64Attr : public TypeAttr {
7354 : public:
7355 : static Ptr64Attr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7356 : auto *A = new (Ctx) Ptr64Attr(Loc, Ctx, 0);
7357 : A->setImplicit(true);
7358 : return A;
7359 : }
7360 :
7361 : Ptr64Attr(SourceRange R, ASTContext &Ctx
7362 : , unsigned SI
7363 : )
7364 : : TypeAttr(attr::Ptr64, R, SI, false)
7365 : {
7366 : }
7367 :
7368 : Ptr64Attr *clone(ASTContext &C) const;
7369 : void printPretty(raw_ostream &OS,
7370 : const PrintingPolicy &Policy) const;
7371 : const char *getSpelling() const;
7372 :
7373 :
7374 : static bool classof(const Attr *A) { return A->getKind() == attr::Ptr64; }
7375 : };
7376 :
7377 : class PureAttr : public InheritableAttr {
7378 : public:
7379 73699 : static PureAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7380 73699 : auto *A = new (Ctx) PureAttr(Loc, Ctx, 0);
7381 : A->setImplicit(true);
7382 73699 : return A;
7383 : }
7384 :
7385 : PureAttr(SourceRange R, ASTContext &Ctx
7386 : , unsigned SI
7387 : )
7388 : : InheritableAttr(attr::Pure, R, SI, false, false)
7389 : {
7390 : }
7391 :
7392 : PureAttr *clone(ASTContext &C) const;
7393 : void printPretty(raw_ostream &OS,
7394 : const PrintingPolicy &Policy) const;
7395 : const char *getSpelling() const;
7396 :
7397 :
7398 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Pure; }
7399 : };
7400 :
7401 : class RISCVInterruptAttr : public InheritableAttr {
7402 : public:
7403 : enum InterruptType {
7404 : user,
7405 : supervisor,
7406 : machine
7407 : };
7408 : private:
7409 : InterruptType interrupt;
7410 :
7411 : public:
7412 : static RISCVInterruptAttr *CreateImplicit(ASTContext &Ctx, InterruptType Interrupt, SourceRange Loc = SourceRange()) {
7413 : auto *A = new (Ctx) RISCVInterruptAttr(Loc, Ctx, Interrupt, 0);
7414 : A->setImplicit(true);
7415 : return A;
7416 : }
7417 :
7418 : RISCVInterruptAttr(SourceRange R, ASTContext &Ctx
7419 : , InterruptType Interrupt
7420 : , unsigned SI
7421 : )
7422 40 : : InheritableAttr(attr::RISCVInterrupt, R, SI, false, false)
7423 40 : , interrupt(Interrupt)
7424 : {
7425 : }
7426 :
7427 : RISCVInterruptAttr(SourceRange R, ASTContext &Ctx
7428 : , unsigned SI
7429 : )
7430 : : InheritableAttr(attr::RISCVInterrupt, R, SI, false, false)
7431 : , interrupt(InterruptType(0))
7432 : {
7433 : }
7434 :
7435 : RISCVInterruptAttr *clone(ASTContext &C) const;
7436 : void printPretty(raw_ostream &OS,
7437 : const PrintingPolicy &Policy) const;
7438 : const char *getSpelling() const;
7439 0 : InterruptType getInterrupt() const {
7440 0 : return interrupt;
7441 : }
7442 :
7443 44 : static bool ConvertStrToInterruptType(StringRef Val, InterruptType &Out) {
7444 44 : Optional<InterruptType> R = llvm::StringSwitch<Optional<InterruptType>>(Val)
7445 44 : .Case("user", RISCVInterruptAttr::user)
7446 44 : .Case("supervisor", RISCVInterruptAttr::supervisor)
7447 44 : .Case("machine", RISCVInterruptAttr::machine)
7448 : .Default(Optional<InterruptType>());
7449 44 : if (R) {
7450 40 : Out = *R;
7451 40 : return true;
7452 : }
7453 : return false;
7454 : }
7455 :
7456 : static const char *ConvertInterruptTypeToStr(InterruptType Val) {
7457 0 : switch(Val) {
7458 : case RISCVInterruptAttr::user: return "user";
7459 0 : case RISCVInterruptAttr::supervisor: return "supervisor";
7460 0 : case RISCVInterruptAttr::machine: return "machine";
7461 : }
7462 0 : llvm_unreachable("No enumerator with that value");
7463 : }
7464 :
7465 :
7466 0 : static bool classof(const Attr *A) { return A->getKind() == attr::RISCVInterrupt; }
7467 : };
7468 :
7469 : class RegCallAttr : public InheritableAttr {
7470 : public:
7471 : static RegCallAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7472 : auto *A = new (Ctx) RegCallAttr(Loc, Ctx, 0);
7473 : A->setImplicit(true);
7474 : return A;
7475 : }
7476 :
7477 : RegCallAttr(SourceRange R, ASTContext &Ctx
7478 : , unsigned SI
7479 : )
7480 : : InheritableAttr(attr::RegCall, R, SI, false, false)
7481 : {
7482 : }
7483 :
7484 : RegCallAttr *clone(ASTContext &C) const;
7485 : void printPretty(raw_ostream &OS,
7486 : const PrintingPolicy &Policy) const;
7487 : const char *getSpelling() const;
7488 :
7489 :
7490 0 : static bool classof(const Attr *A) { return A->getKind() == attr::RegCall; }
7491 : };
7492 :
7493 : class ReinitializesAttr : public InheritableAttr {
7494 : public:
7495 : static ReinitializesAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7496 : auto *A = new (Ctx) ReinitializesAttr(Loc, Ctx, 0);
7497 : A->setImplicit(true);
7498 : return A;
7499 : }
7500 :
7501 : ReinitializesAttr(SourceRange R, ASTContext &Ctx
7502 : , unsigned SI
7503 : )
7504 : : InheritableAttr(attr::Reinitializes, R, SI, false, false)
7505 : {
7506 : }
7507 :
7508 : ReinitializesAttr *clone(ASTContext &C) const;
7509 : void printPretty(raw_ostream &OS,
7510 : const PrintingPolicy &Policy) const;
7511 : const char *getSpelling() const;
7512 :
7513 :
7514 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Reinitializes; }
7515 : };
7516 :
7517 : class ReleaseCapabilityAttr : public InheritableAttr {
7518 : unsigned args_Size;
7519 : Expr * *args_;
7520 :
7521 : public:
7522 : enum Spelling {
7523 : GNU_release_capability = 0,
7524 : CXX11_clang_release_capability = 1,
7525 : GNU_release_shared_capability = 2,
7526 : CXX11_clang_release_shared_capability = 3,
7527 : GNU_release_generic_capability = 4,
7528 : CXX11_clang_release_generic_capability = 5,
7529 : GNU_unlock_function = 6,
7530 : CXX11_clang_unlock_function = 7
7531 : };
7532 :
7533 : static ReleaseCapabilityAttr *CreateImplicit(ASTContext &Ctx, Spelling S, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
7534 : auto *A = new (Ctx) ReleaseCapabilityAttr(Loc, Ctx, Args, ArgsSize, S);
7535 : A->setImplicit(true);
7536 : return A;
7537 : }
7538 :
7539 455 : ReleaseCapabilityAttr(SourceRange R, ASTContext &Ctx
7540 : , Expr * *Args, unsigned ArgsSize
7541 : , unsigned SI
7542 : )
7543 455 : : InheritableAttr(attr::ReleaseCapability, R, SI, true, true)
7544 455 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
7545 : {
7546 455 : std::copy(Args, Args + args_Size, args_);
7547 455 : }
7548 :
7549 : ReleaseCapabilityAttr(SourceRange R, ASTContext &Ctx
7550 : , unsigned SI
7551 : )
7552 : : InheritableAttr(attr::ReleaseCapability, R, SI, true, true)
7553 : , args_Size(0), args_(nullptr)
7554 : {
7555 : }
7556 :
7557 : ReleaseCapabilityAttr *clone(ASTContext &C) const;
7558 : void printPretty(raw_ostream &OS,
7559 : const PrintingPolicy &Policy) const;
7560 : const char *getSpelling() const;
7561 : Spelling getSemanticSpelling() const {
7562 : switch (SpellingListIndex) {
7563 : default: llvm_unreachable("Unknown spelling list index");
7564 : case 0: return GNU_release_capability;
7565 : case 1: return CXX11_clang_release_capability;
7566 : case 2: return GNU_release_shared_capability;
7567 : case 3: return CXX11_clang_release_shared_capability;
7568 : case 4: return GNU_release_generic_capability;
7569 : case 5: return CXX11_clang_release_generic_capability;
7570 : case 6: return GNU_unlock_function;
7571 : case 7: return CXX11_clang_unlock_function;
7572 : }
7573 : }
7574 77 : bool isShared() const { return SpellingListIndex == 2 ||
7575 : SpellingListIndex == 3; }
7576 1791 : bool isGeneric() const { return SpellingListIndex == 4 ||
7577 1791 : SpellingListIndex == 5 ||
7578 1791 : SpellingListIndex == 6 ||
7579 : SpellingListIndex == 7; }
7580 : typedef Expr ** args_iterator;
7581 0 : args_iterator args_begin() const { return args_; }
7582 2391 : args_iterator args_end() const { return args_ + args_Size; }
7583 0 : unsigned args_size() const { return args_Size; }
7584 2377 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
7585 :
7586 :
7587 :
7588 :
7589 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ReleaseCapability; }
7590 : };
7591 :
7592 : class RenderScriptKernelAttr : public Attr {
7593 : public:
7594 : static RenderScriptKernelAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7595 : auto *A = new (Ctx) RenderScriptKernelAttr(Loc, Ctx, 0);
7596 : A->setImplicit(true);
7597 : return A;
7598 : }
7599 :
7600 : RenderScriptKernelAttr(SourceRange R, ASTContext &Ctx
7601 : , unsigned SI
7602 : )
7603 : : Attr(attr::RenderScriptKernel, R, SI, false)
7604 : {
7605 : }
7606 :
7607 : RenderScriptKernelAttr *clone(ASTContext &C) const;
7608 : void printPretty(raw_ostream &OS,
7609 : const PrintingPolicy &Policy) const;
7610 : const char *getSpelling() const;
7611 :
7612 :
7613 : static bool classof(const Attr *A) { return A->getKind() == attr::RenderScriptKernel; }
7614 : };
7615 :
7616 : class ReqdWorkGroupSizeAttr : public InheritableAttr {
7617 : unsigned xDim;
7618 :
7619 : unsigned yDim;
7620 :
7621 : unsigned zDim;
7622 :
7623 : public:
7624 : static ReqdWorkGroupSizeAttr *CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Loc = SourceRange()) {
7625 : auto *A = new (Ctx) ReqdWorkGroupSizeAttr(Loc, Ctx, XDim, YDim, ZDim, 0);
7626 : A->setImplicit(true);
7627 : return A;
7628 : }
7629 :
7630 : ReqdWorkGroupSizeAttr(SourceRange R, ASTContext &Ctx
7631 : , unsigned XDim
7632 : , unsigned YDim
7633 : , unsigned ZDim
7634 : , unsigned SI
7635 : )
7636 10 : : InheritableAttr(attr::ReqdWorkGroupSize, R, SI, false, false)
7637 : , xDim(XDim)
7638 : , yDim(YDim)
7639 10 : , zDim(ZDim)
7640 : {
7641 : }
7642 :
7643 : ReqdWorkGroupSizeAttr *clone(ASTContext &C) const;
7644 : void printPretty(raw_ostream &OS,
7645 : const PrintingPolicy &Policy) const;
7646 : const char *getSpelling() const;
7647 0 : unsigned getXDim() const {
7648 0 : return xDim;
7649 : }
7650 :
7651 0 : unsigned getYDim() const {
7652 0 : return yDim;
7653 : }
7654 :
7655 0 : unsigned getZDim() const {
7656 0 : return zDim;
7657 : }
7658 :
7659 :
7660 :
7661 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ReqdWorkGroupSize; }
7662 : };
7663 :
7664 : class RequireConstantInitAttr : public InheritableAttr {
7665 : public:
7666 : static RequireConstantInitAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7667 : auto *A = new (Ctx) RequireConstantInitAttr(Loc, Ctx, 0);
7668 : A->setImplicit(true);
7669 : return A;
7670 : }
7671 :
7672 : RequireConstantInitAttr(SourceRange R, ASTContext &Ctx
7673 : , unsigned SI
7674 : )
7675 : : InheritableAttr(attr::RequireConstantInit, R, SI, false, false)
7676 : {
7677 : }
7678 :
7679 : RequireConstantInitAttr *clone(ASTContext &C) const;
7680 : void printPretty(raw_ostream &OS,
7681 : const PrintingPolicy &Policy) const;
7682 : const char *getSpelling() const;
7683 :
7684 :
7685 0 : static bool classof(const Attr *A) { return A->getKind() == attr::RequireConstantInit; }
7686 : };
7687 :
7688 : class RequiresCapabilityAttr : public InheritableAttr {
7689 : unsigned args_Size;
7690 : Expr * *args_;
7691 :
7692 : public:
7693 : enum Spelling {
7694 : GNU_requires_capability = 0,
7695 : CXX11_clang_requires_capability = 1,
7696 : GNU_exclusive_locks_required = 2,
7697 : CXX11_clang_exclusive_locks_required = 3,
7698 : GNU_requires_shared_capability = 4,
7699 : CXX11_clang_requires_shared_capability = 5,
7700 : GNU_shared_locks_required = 6,
7701 : CXX11_clang_shared_locks_required = 7
7702 : };
7703 :
7704 : static RequiresCapabilityAttr *CreateImplicit(ASTContext &Ctx, Spelling S, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
7705 : auto *A = new (Ctx) RequiresCapabilityAttr(Loc, Ctx, Args, ArgsSize, S);
7706 : A->setImplicit(true);
7707 : return A;
7708 : }
7709 :
7710 903 : RequiresCapabilityAttr(SourceRange R, ASTContext &Ctx
7711 : , Expr * *Args, unsigned ArgsSize
7712 : , unsigned SI
7713 : )
7714 903 : : InheritableAttr(attr::RequiresCapability, R, SI, true, true)
7715 903 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
7716 : {
7717 903 : std::copy(Args, Args + args_Size, args_);
7718 903 : }
7719 :
7720 : RequiresCapabilityAttr(SourceRange R, ASTContext &Ctx
7721 : , unsigned SI
7722 : )
7723 : : InheritableAttr(attr::RequiresCapability, R, SI, true, true)
7724 : , args_Size(0), args_(nullptr)
7725 : {
7726 : }
7727 :
7728 : RequiresCapabilityAttr *clone(ASTContext &C) const;
7729 : void printPretty(raw_ostream &OS,
7730 : const PrintingPolicy &Policy) const;
7731 : const char *getSpelling() const;
7732 : Spelling getSemanticSpelling() const {
7733 : switch (SpellingListIndex) {
7734 : default: llvm_unreachable("Unknown spelling list index");
7735 : case 0: return GNU_requires_capability;
7736 : case 1: return CXX11_clang_requires_capability;
7737 : case 2: return GNU_exclusive_locks_required;
7738 : case 3: return CXX11_clang_exclusive_locks_required;
7739 : case 4: return GNU_requires_shared_capability;
7740 : case 5: return CXX11_clang_requires_shared_capability;
7741 : case 6: return GNU_shared_locks_required;
7742 : case 7: return CXX11_clang_shared_locks_required;
7743 : }
7744 : }
7745 1020 : bool isShared() const { return SpellingListIndex == 4 ||
7746 937 : SpellingListIndex == 5 ||
7747 1020 : SpellingListIndex == 6 ||
7748 : SpellingListIndex == 7; }
7749 : typedef Expr ** args_iterator;
7750 0 : args_iterator args_begin() const { return args_; }
7751 2041 : args_iterator args_end() const { return args_ + args_Size; }
7752 0 : unsigned args_size() const { return args_Size; }
7753 1960 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
7754 :
7755 :
7756 :
7757 :
7758 0 : static bool classof(const Attr *A) { return A->getKind() == attr::RequiresCapability; }
7759 : };
7760 :
7761 : class RestrictAttr : public InheritableAttr {
7762 : public:
7763 : enum Spelling {
7764 : Declspec_restrict = 0,
7765 : GNU_malloc = 1,
7766 : CXX11_gnu_malloc = 2
7767 : };
7768 :
7769 : static RestrictAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
7770 : auto *A = new (Ctx) RestrictAttr(Loc, Ctx, S);
7771 : A->setImplicit(true);
7772 : return A;
7773 : }
7774 :
7775 : RestrictAttr(SourceRange R, ASTContext &Ctx
7776 : , unsigned SI
7777 : )
7778 : : InheritableAttr(attr::Restrict, R, SI, false, false)
7779 : {
7780 : }
7781 :
7782 : RestrictAttr *clone(ASTContext &C) const;
7783 : void printPretty(raw_ostream &OS,
7784 : const PrintingPolicy &Policy) const;
7785 : const char *getSpelling() const;
7786 : Spelling getSemanticSpelling() const {
7787 : switch (SpellingListIndex) {
7788 : default: llvm_unreachable("Unknown spelling list index");
7789 : case 0: return Declspec_restrict;
7790 : case 1: return GNU_malloc;
7791 : case 2: return CXX11_gnu_malloc;
7792 : }
7793 : }
7794 :
7795 :
7796 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Restrict; }
7797 : };
7798 :
7799 : class ReturnTypestateAttr : public InheritableAttr {
7800 : public:
7801 : enum ConsumedState {
7802 : Unknown,
7803 : Consumed,
7804 : Unconsumed
7805 : };
7806 : private:
7807 : ConsumedState state;
7808 :
7809 : public:
7810 : static ReturnTypestateAttr *CreateImplicit(ASTContext &Ctx, ConsumedState State, SourceRange Loc = SourceRange()) {
7811 : auto *A = new (Ctx) ReturnTypestateAttr(Loc, Ctx, State, 0);
7812 : A->setImplicit(true);
7813 : return A;
7814 : }
7815 :
7816 : ReturnTypestateAttr(SourceRange R, ASTContext &Ctx
7817 : , ConsumedState State
7818 : , unsigned SI
7819 : )
7820 16 : : InheritableAttr(attr::ReturnTypestate, R, SI, false, false)
7821 16 : , state(State)
7822 : {
7823 : }
7824 :
7825 : ReturnTypestateAttr *clone(ASTContext &C) const;
7826 : void printPretty(raw_ostream &OS,
7827 : const PrintingPolicy &Policy) const;
7828 : const char *getSpelling() const;
7829 0 : ConsumedState getState() const {
7830 0 : return state;
7831 : }
7832 :
7833 11 : static bool ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) {
7834 11 : Optional<ConsumedState> R = llvm::StringSwitch<Optional<ConsumedState>>(Val)
7835 11 : .Case("unknown", ReturnTypestateAttr::Unknown)
7836 11 : .Case("consumed", ReturnTypestateAttr::Consumed)
7837 11 : .Case("unconsumed", ReturnTypestateAttr::Unconsumed)
7838 : .Default(Optional<ConsumedState>());
7839 11 : if (R) {
7840 10 : Out = *R;
7841 10 : return true;
7842 : }
7843 : return false;
7844 : }
7845 :
7846 : static const char *ConvertConsumedStateToStr(ConsumedState Val) {
7847 0 : switch(Val) {
7848 : case ReturnTypestateAttr::Unknown: return "unknown";
7849 0 : case ReturnTypestateAttr::Consumed: return "consumed";
7850 0 : case ReturnTypestateAttr::Unconsumed: return "unconsumed";
7851 : }
7852 0 : llvm_unreachable("No enumerator with that value");
7853 : }
7854 :
7855 :
7856 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ReturnTypestate; }
7857 : };
7858 :
7859 : class ReturnsNonNullAttr : public InheritableAttr {
7860 : public:
7861 : static ReturnsNonNullAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7862 : auto *A = new (Ctx) ReturnsNonNullAttr(Loc, Ctx, 0);
7863 : A->setImplicit(true);
7864 : return A;
7865 : }
7866 :
7867 : ReturnsNonNullAttr(SourceRange R, ASTContext &Ctx
7868 : , unsigned SI
7869 : )
7870 : : InheritableAttr(attr::ReturnsNonNull, R, SI, false, false)
7871 : {
7872 : }
7873 :
7874 : ReturnsNonNullAttr *clone(ASTContext &C) const;
7875 : void printPretty(raw_ostream &OS,
7876 : const PrintingPolicy &Policy) const;
7877 : const char *getSpelling() const;
7878 :
7879 :
7880 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ReturnsNonNull; }
7881 : };
7882 :
7883 : class ReturnsTwiceAttr : public InheritableAttr {
7884 : public:
7885 2375 : static ReturnsTwiceAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7886 2375 : auto *A = new (Ctx) ReturnsTwiceAttr(Loc, Ctx, 0);
7887 : A->setImplicit(true);
7888 2375 : return A;
7889 : }
7890 :
7891 : ReturnsTwiceAttr(SourceRange R, ASTContext &Ctx
7892 : , unsigned SI
7893 : )
7894 : : InheritableAttr(attr::ReturnsTwice, R, SI, false, false)
7895 : {
7896 : }
7897 :
7898 : ReturnsTwiceAttr *clone(ASTContext &C) const;
7899 : void printPretty(raw_ostream &OS,
7900 : const PrintingPolicy &Policy) const;
7901 : const char *getSpelling() const;
7902 :
7903 :
7904 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ReturnsTwice; }
7905 : };
7906 :
7907 : class SPtrAttr : public TypeAttr {
7908 : public:
7909 : static SPtrAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7910 : auto *A = new (Ctx) SPtrAttr(Loc, Ctx, 0);
7911 : A->setImplicit(true);
7912 : return A;
7913 : }
7914 :
7915 : SPtrAttr(SourceRange R, ASTContext &Ctx
7916 : , unsigned SI
7917 : )
7918 : : TypeAttr(attr::SPtr, R, SI, false)
7919 : {
7920 : }
7921 :
7922 : SPtrAttr *clone(ASTContext &C) const;
7923 : void printPretty(raw_ostream &OS,
7924 : const PrintingPolicy &Policy) const;
7925 : const char *getSpelling() const;
7926 :
7927 :
7928 : static bool classof(const Attr *A) { return A->getKind() == attr::SPtr; }
7929 : };
7930 :
7931 : class ScopedLockableAttr : public InheritableAttr {
7932 : public:
7933 : static ScopedLockableAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
7934 : auto *A = new (Ctx) ScopedLockableAttr(Loc, Ctx, 0);
7935 : A->setImplicit(true);
7936 : return A;
7937 : }
7938 :
7939 : ScopedLockableAttr(SourceRange R, ASTContext &Ctx
7940 : , unsigned SI
7941 : )
7942 : : InheritableAttr(attr::ScopedLockable, R, SI, false, false)
7943 : {
7944 : }
7945 :
7946 : ScopedLockableAttr *clone(ASTContext &C) const;
7947 : void printPretty(raw_ostream &OS,
7948 : const PrintingPolicy &Policy) const;
7949 : const char *getSpelling() const;
7950 :
7951 :
7952 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ScopedLockable; }
7953 : };
7954 :
7955 : class SectionAttr : public InheritableAttr {
7956 : unsigned nameLength;
7957 : char *name;
7958 :
7959 : public:
7960 : enum Spelling {
7961 : GNU_section = 0,
7962 : CXX11_gnu_section = 1,
7963 : Declspec_allocate = 2
7964 : };
7965 :
7966 78 : static SectionAttr *CreateImplicit(ASTContext &Ctx, Spelling S, llvm::StringRef Name, SourceRange Loc = SourceRange()) {
7967 78 : auto *A = new (Ctx) SectionAttr(Loc, Ctx, Name, S);
7968 : A->setImplicit(true);
7969 78 : return A;
7970 : }
7971 :
7972 169 : SectionAttr(SourceRange R, ASTContext &Ctx
7973 : , llvm::StringRef Name
7974 : , unsigned SI
7975 : )
7976 169 : : InheritableAttr(attr::Section, R, SI, false, false)
7977 169 : , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength])
7978 : {
7979 169 : if (!Name.empty())
7980 338 : std::memcpy(name, Name.data(), nameLength);
7981 169 : }
7982 :
7983 : SectionAttr *clone(ASTContext &C) const;
7984 : void printPretty(raw_ostream &OS,
7985 : const PrintingPolicy &Policy) const;
7986 : const char *getSpelling() const;
7987 : Spelling getSemanticSpelling() const {
7988 : switch (SpellingListIndex) {
7989 : default: llvm_unreachable("Unknown spelling list index");
7990 : case 0: return GNU_section;
7991 : case 1: return CXX11_gnu_section;
7992 : case 2: return Declspec_allocate;
7993 : }
7994 : }
7995 0 : llvm::StringRef getName() const {
7996 261 : return llvm::StringRef(name, nameLength);
7997 : }
7998 : unsigned getNameLength() const {
7999 : return nameLength;
8000 : }
8001 : void setName(ASTContext &C, llvm::StringRef S) {
8002 : nameLength = S.size();
8003 : this->name = new (C, 1) char [nameLength];
8004 : if (!S.empty())
8005 : std::memcpy(this->name, S.data(), nameLength);
8006 : }
8007 :
8008 :
8009 :
8010 3 : static bool classof(const Attr *A) { return A->getKind() == attr::Section; }
8011 : };
8012 :
8013 : class SelectAnyAttr : public InheritableAttr {
8014 : public:
8015 : static SelectAnyAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8016 : auto *A = new (Ctx) SelectAnyAttr(Loc, Ctx, 0);
8017 : A->setImplicit(true);
8018 : return A;
8019 : }
8020 :
8021 : SelectAnyAttr(SourceRange R, ASTContext &Ctx
8022 : , unsigned SI
8023 : )
8024 : : InheritableAttr(attr::SelectAny, R, SI, false, false)
8025 : {
8026 : }
8027 :
8028 : SelectAnyAttr *clone(ASTContext &C) const;
8029 : void printPretty(raw_ostream &OS,
8030 : const PrintingPolicy &Policy) const;
8031 : const char *getSpelling() const;
8032 :
8033 :
8034 16 : static bool classof(const Attr *A) { return A->getKind() == attr::SelectAny; }
8035 : };
8036 :
8037 : class SentinelAttr : public InheritableAttr {
8038 : int sentinel;
8039 :
8040 : int nullPos;
8041 :
8042 : public:
8043 : static SentinelAttr *CreateImplicit(ASTContext &Ctx, int Sentinel, int NullPos, SourceRange Loc = SourceRange()) {
8044 : auto *A = new (Ctx) SentinelAttr(Loc, Ctx, Sentinel, NullPos, 0);
8045 : A->setImplicit(true);
8046 : return A;
8047 : }
8048 :
8049 : SentinelAttr(SourceRange R, ASTContext &Ctx
8050 : , int Sentinel
8051 : , int NullPos
8052 : , unsigned SI
8053 : )
8054 199 : : InheritableAttr(attr::Sentinel, R, SI, false, false)
8055 : , sentinel(Sentinel)
8056 199 : , nullPos(NullPos)
8057 : {
8058 : }
8059 :
8060 : SentinelAttr(SourceRange R, ASTContext &Ctx
8061 : , unsigned SI
8062 : )
8063 : : InheritableAttr(attr::Sentinel, R, SI, false, false)
8064 : , sentinel()
8065 : , nullPos()
8066 : {
8067 : }
8068 :
8069 : SentinelAttr *clone(ASTContext &C) const;
8070 : void printPretty(raw_ostream &OS,
8071 : const PrintingPolicy &Policy) const;
8072 : const char *getSpelling() const;
8073 0 : int getSentinel() const {
8074 0 : return sentinel;
8075 : }
8076 :
8077 : static const int DefaultSentinel = 0;
8078 :
8079 0 : int getNullPos() const {
8080 0 : return nullPos;
8081 : }
8082 :
8083 : static const int DefaultNullPos = 0;
8084 :
8085 :
8086 :
8087 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Sentinel; }
8088 : };
8089 :
8090 : class SetTypestateAttr : public InheritableAttr {
8091 : public:
8092 : enum ConsumedState {
8093 : Unknown,
8094 : Consumed,
8095 : Unconsumed
8096 : };
8097 : private:
8098 : ConsumedState newState;
8099 :
8100 : public:
8101 : static SetTypestateAttr *CreateImplicit(ASTContext &Ctx, ConsumedState NewState, SourceRange Loc = SourceRange()) {
8102 : auto *A = new (Ctx) SetTypestateAttr(Loc, Ctx, NewState, 0);
8103 : A->setImplicit(true);
8104 : return A;
8105 : }
8106 :
8107 : SetTypestateAttr(SourceRange R, ASTContext &Ctx
8108 : , ConsumedState NewState
8109 : , unsigned SI
8110 : )
8111 17 : : InheritableAttr(attr::SetTypestate, R, SI, false, false)
8112 17 : , newState(NewState)
8113 : {
8114 : }
8115 :
8116 : SetTypestateAttr *clone(ASTContext &C) const;
8117 : void printPretty(raw_ostream &OS,
8118 : const PrintingPolicy &Policy) const;
8119 : const char *getSpelling() const;
8120 0 : ConsumedState getNewState() const {
8121 0 : return newState;
8122 : }
8123 :
8124 9 : static bool ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) {
8125 9 : Optional<ConsumedState> R = llvm::StringSwitch<Optional<ConsumedState>>(Val)
8126 9 : .Case("unknown", SetTypestateAttr::Unknown)
8127 9 : .Case("consumed", SetTypestateAttr::Consumed)
8128 9 : .Case("unconsumed", SetTypestateAttr::Unconsumed)
8129 : .Default(Optional<ConsumedState>());
8130 9 : if (R) {
8131 9 : Out = *R;
8132 9 : return true;
8133 : }
8134 : return false;
8135 : }
8136 :
8137 : static const char *ConvertConsumedStateToStr(ConsumedState Val) {
8138 0 : switch(Val) {
8139 : case SetTypestateAttr::Unknown: return "unknown";
8140 0 : case SetTypestateAttr::Consumed: return "consumed";
8141 0 : case SetTypestateAttr::Unconsumed: return "unconsumed";
8142 : }
8143 0 : llvm_unreachable("No enumerator with that value");
8144 : }
8145 :
8146 :
8147 0 : static bool classof(const Attr *A) { return A->getKind() == attr::SetTypestate; }
8148 : };
8149 :
8150 : class SharedTrylockFunctionAttr : public InheritableAttr {
8151 : Expr * successValue;
8152 :
8153 : unsigned args_Size;
8154 : Expr * *args_;
8155 :
8156 : public:
8157 : static SharedTrylockFunctionAttr *CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
8158 : auto *A = new (Ctx) SharedTrylockFunctionAttr(Loc, Ctx, SuccessValue, Args, ArgsSize, 0);
8159 : A->setImplicit(true);
8160 : return A;
8161 : }
8162 :
8163 68 : SharedTrylockFunctionAttr(SourceRange R, ASTContext &Ctx
8164 : , Expr * SuccessValue
8165 : , Expr * *Args, unsigned ArgsSize
8166 : , unsigned SI
8167 : )
8168 68 : : InheritableAttr(attr::SharedTrylockFunction, R, SI, true, true)
8169 : , successValue(SuccessValue)
8170 68 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
8171 : {
8172 68 : std::copy(Args, Args + args_Size, args_);
8173 68 : }
8174 :
8175 : SharedTrylockFunctionAttr(SourceRange R, ASTContext &Ctx
8176 : , Expr * SuccessValue
8177 : , unsigned SI
8178 : )
8179 : : InheritableAttr(attr::SharedTrylockFunction, R, SI, true, true)
8180 : , successValue(SuccessValue)
8181 : , args_Size(0), args_(nullptr)
8182 : {
8183 : }
8184 :
8185 : SharedTrylockFunctionAttr *clone(ASTContext &C) const;
8186 : void printPretty(raw_ostream &OS,
8187 : const PrintingPolicy &Policy) const;
8188 : const char *getSpelling() const;
8189 0 : Expr * getSuccessValue() const {
8190 0 : return successValue;
8191 : }
8192 :
8193 : typedef Expr ** args_iterator;
8194 0 : args_iterator args_begin() const { return args_; }
8195 17 : args_iterator args_end() const { return args_ + args_Size; }
8196 0 : unsigned args_size() const { return args_Size; }
8197 17 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
8198 :
8199 :
8200 :
8201 :
8202 0 : static bool classof(const Attr *A) { return A->getKind() == attr::SharedTrylockFunction; }
8203 : };
8204 :
8205 : class StdCallAttr : public InheritableAttr {
8206 : public:
8207 : static StdCallAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8208 : auto *A = new (Ctx) StdCallAttr(Loc, Ctx, 0);
8209 : A->setImplicit(true);
8210 : return A;
8211 : }
8212 :
8213 : StdCallAttr(SourceRange R, ASTContext &Ctx
8214 : , unsigned SI
8215 : )
8216 : : InheritableAttr(attr::StdCall, R, SI, false, false)
8217 : {
8218 : }
8219 :
8220 : StdCallAttr *clone(ASTContext &C) const;
8221 : void printPretty(raw_ostream &OS,
8222 : const PrintingPolicy &Policy) const;
8223 : const char *getSpelling() const;
8224 :
8225 :
8226 0 : static bool classof(const Attr *A) { return A->getKind() == attr::StdCall; }
8227 : };
8228 :
8229 : class SuppressAttr : public StmtAttr {
8230 : unsigned diagnosticIdentifiers_Size;
8231 : StringRef *diagnosticIdentifiers_;
8232 :
8233 : public:
8234 : static SuppressAttr *CreateImplicit(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, SourceRange Loc = SourceRange()) {
8235 : auto *A = new (Ctx) SuppressAttr(Loc, Ctx, DiagnosticIdentifiers, DiagnosticIdentifiersSize, 0);
8236 : A->setImplicit(true);
8237 : return A;
8238 : }
8239 :
8240 8 : SuppressAttr(SourceRange R, ASTContext &Ctx
8241 : , StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize
8242 : , unsigned SI
8243 : )
8244 8 : : StmtAttr(attr::Suppress, R, SI, false)
8245 17 : , diagnosticIdentifiers_Size(DiagnosticIdentifiersSize), diagnosticIdentifiers_(new (Ctx, 16) StringRef[diagnosticIdentifiers_Size])
8246 : {
8247 17 : for (size_t I = 0, E = diagnosticIdentifiers_Size; I != E;
8248 : ++I) {
8249 9 : StringRef Ref = DiagnosticIdentifiers[I];
8250 9 : if (!Ref.empty()) {
8251 : char *Mem = new (Ctx, 1) char[Ref.size()];
8252 9 : std::memcpy(Mem, Ref.data(), Ref.size());
8253 9 : diagnosticIdentifiers_[I] = StringRef(Mem, Ref.size());
8254 : }
8255 : }
8256 8 : }
8257 :
8258 : SuppressAttr(SourceRange R, ASTContext &Ctx
8259 : , unsigned SI
8260 : )
8261 : : StmtAttr(attr::Suppress, R, SI, false)
8262 : , diagnosticIdentifiers_Size(0), diagnosticIdentifiers_(nullptr)
8263 : {
8264 : }
8265 :
8266 : SuppressAttr *clone(ASTContext &C) const;
8267 : void printPretty(raw_ostream &OS,
8268 : const PrintingPolicy &Policy) const;
8269 : const char *getSpelling() const;
8270 : typedef StringRef* diagnosticIdentifiers_iterator;
8271 0 : diagnosticIdentifiers_iterator diagnosticIdentifiers_begin() const { return diagnosticIdentifiers_; }
8272 0 : diagnosticIdentifiers_iterator diagnosticIdentifiers_end() const { return diagnosticIdentifiers_ + diagnosticIdentifiers_Size; }
8273 0 : unsigned diagnosticIdentifiers_size() const { return diagnosticIdentifiers_Size; }
8274 0 : llvm::iterator_range<diagnosticIdentifiers_iterator> diagnosticIdentifiers() const { return llvm::make_range(diagnosticIdentifiers_begin(), diagnosticIdentifiers_end()); }
8275 :
8276 :
8277 :
8278 :
8279 : static bool classof(const Attr *A) { return A->getKind() == attr::Suppress; }
8280 : };
8281 :
8282 : class SwiftCallAttr : public InheritableAttr {
8283 : public:
8284 : static SwiftCallAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8285 : auto *A = new (Ctx) SwiftCallAttr(Loc, Ctx, 0);
8286 : A->setImplicit(true);
8287 : return A;
8288 : }
8289 :
8290 : SwiftCallAttr(SourceRange R, ASTContext &Ctx
8291 : , unsigned SI
8292 : )
8293 : : InheritableAttr(attr::SwiftCall, R, SI, false, false)
8294 : {
8295 : }
8296 :
8297 : SwiftCallAttr *clone(ASTContext &C) const;
8298 : void printPretty(raw_ostream &OS,
8299 : const PrintingPolicy &Policy) const;
8300 : const char *getSpelling() const;
8301 :
8302 :
8303 : static bool classof(const Attr *A) { return A->getKind() == attr::SwiftCall; }
8304 : };
8305 :
8306 : class SwiftContextAttr : public ParameterABIAttr {
8307 : public:
8308 : static SwiftContextAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8309 : auto *A = new (Ctx) SwiftContextAttr(Loc, Ctx, 0);
8310 : A->setImplicit(true);
8311 : return A;
8312 : }
8313 :
8314 : SwiftContextAttr(SourceRange R, ASTContext &Ctx
8315 : , unsigned SI
8316 : )
8317 : : ParameterABIAttr(attr::SwiftContext, R, SI, false, false)
8318 : {
8319 : }
8320 :
8321 : SwiftContextAttr *clone(ASTContext &C) const;
8322 : void printPretty(raw_ostream &OS,
8323 : const PrintingPolicy &Policy) const;
8324 : const char *getSpelling() const;
8325 :
8326 :
8327 : static bool classof(const Attr *A) { return A->getKind() == attr::SwiftContext; }
8328 : };
8329 :
8330 : class SwiftErrorResultAttr : public ParameterABIAttr {
8331 : public:
8332 : static SwiftErrorResultAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8333 : auto *A = new (Ctx) SwiftErrorResultAttr(Loc, Ctx, 0);
8334 : A->setImplicit(true);
8335 : return A;
8336 : }
8337 :
8338 : SwiftErrorResultAttr(SourceRange R, ASTContext &Ctx
8339 : , unsigned SI
8340 : )
8341 : : ParameterABIAttr(attr::SwiftErrorResult, R, SI, false, false)
8342 : {
8343 : }
8344 :
8345 : SwiftErrorResultAttr *clone(ASTContext &C) const;
8346 : void printPretty(raw_ostream &OS,
8347 : const PrintingPolicy &Policy) const;
8348 : const char *getSpelling() const;
8349 :
8350 :
8351 : static bool classof(const Attr *A) { return A->getKind() == attr::SwiftErrorResult; }
8352 : };
8353 :
8354 : class SwiftIndirectResultAttr : public ParameterABIAttr {
8355 : public:
8356 : static SwiftIndirectResultAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8357 : auto *A = new (Ctx) SwiftIndirectResultAttr(Loc, Ctx, 0);
8358 : A->setImplicit(true);
8359 : return A;
8360 : }
8361 :
8362 : SwiftIndirectResultAttr(SourceRange R, ASTContext &Ctx
8363 : , unsigned SI
8364 : )
8365 : : ParameterABIAttr(attr::SwiftIndirectResult, R, SI, false, false)
8366 : {
8367 : }
8368 :
8369 : SwiftIndirectResultAttr *clone(ASTContext &C) const;
8370 : void printPretty(raw_ostream &OS,
8371 : const PrintingPolicy &Policy) const;
8372 : const char *getSpelling() const;
8373 :
8374 :
8375 : static bool classof(const Attr *A) { return A->getKind() == attr::SwiftIndirectResult; }
8376 : };
8377 :
8378 : class SysVABIAttr : public InheritableAttr {
8379 : public:
8380 : static SysVABIAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8381 : auto *A = new (Ctx) SysVABIAttr(Loc, Ctx, 0);
8382 : A->setImplicit(true);
8383 : return A;
8384 : }
8385 :
8386 : SysVABIAttr(SourceRange R, ASTContext &Ctx
8387 : , unsigned SI
8388 : )
8389 : : InheritableAttr(attr::SysVABI, R, SI, false, false)
8390 : {
8391 : }
8392 :
8393 : SysVABIAttr *clone(ASTContext &C) const;
8394 : void printPretty(raw_ostream &OS,
8395 : const PrintingPolicy &Policy) const;
8396 : const char *getSpelling() const;
8397 :
8398 :
8399 0 : static bool classof(const Attr *A) { return A->getKind() == attr::SysVABI; }
8400 : };
8401 :
8402 : class TLSModelAttr : public InheritableAttr {
8403 : unsigned modelLength;
8404 : char *model;
8405 :
8406 : public:
8407 : static TLSModelAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Model, SourceRange Loc = SourceRange()) {
8408 : auto *A = new (Ctx) TLSModelAttr(Loc, Ctx, Model, 0);
8409 : A->setImplicit(true);
8410 : return A;
8411 : }
8412 :
8413 17 : TLSModelAttr(SourceRange R, ASTContext &Ctx
8414 : , llvm::StringRef Model
8415 : , unsigned SI
8416 : )
8417 17 : : InheritableAttr(attr::TLSModel, R, SI, false, false)
8418 17 : , modelLength(Model.size()),model(new (Ctx, 1) char[modelLength])
8419 : {
8420 17 : if (!Model.empty())
8421 34 : std::memcpy(model, Model.data(), modelLength);
8422 17 : }
8423 :
8424 : TLSModelAttr *clone(ASTContext &C) const;
8425 : void printPretty(raw_ostream &OS,
8426 : const PrintingPolicy &Policy) const;
8427 : const char *getSpelling() const;
8428 0 : llvm::StringRef getModel() const {
8429 15 : return llvm::StringRef(model, modelLength);
8430 : }
8431 : unsigned getModelLength() const {
8432 : return modelLength;
8433 : }
8434 : void setModel(ASTContext &C, llvm::StringRef S) {
8435 : modelLength = S.size();
8436 : this->model = new (C, 1) char [modelLength];
8437 : if (!S.empty())
8438 : std::memcpy(this->model, S.data(), modelLength);
8439 : }
8440 :
8441 :
8442 :
8443 0 : static bool classof(const Attr *A) { return A->getKind() == attr::TLSModel; }
8444 : };
8445 :
8446 : class TargetAttr : public InheritableAttr {
8447 : unsigned featuresStrLength;
8448 : char *featuresStr;
8449 :
8450 : public:
8451 : static TargetAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef FeaturesStr, SourceRange Loc = SourceRange()) {
8452 : auto *A = new (Ctx) TargetAttr(Loc, Ctx, FeaturesStr, 0);
8453 : A->setImplicit(true);
8454 : return A;
8455 : }
8456 :
8457 518733 : TargetAttr(SourceRange R, ASTContext &Ctx
8458 : , llvm::StringRef FeaturesStr
8459 : , unsigned SI
8460 : )
8461 518733 : : InheritableAttr(attr::Target, R, SI, false, false)
8462 518733 : , featuresStrLength(FeaturesStr.size()),featuresStr(new (Ctx, 1) char[featuresStrLength])
8463 : {
8464 518733 : if (!FeaturesStr.empty())
8465 1037466 : std::memcpy(featuresStr, FeaturesStr.data(), featuresStrLength);
8466 518733 : }
8467 :
8468 : TargetAttr *clone(ASTContext &C) const;
8469 : void printPretty(raw_ostream &OS,
8470 : const PrintingPolicy &Policy) const;
8471 : const char *getSpelling() const;
8472 0 : llvm::StringRef getFeaturesStr() const {
8473 66841 : return llvm::StringRef(featuresStr, featuresStrLength);
8474 : }
8475 : unsigned getFeaturesStrLength() const {
8476 : return featuresStrLength;
8477 : }
8478 : void setFeaturesStr(ASTContext &C, llvm::StringRef S) {
8479 : featuresStrLength = S.size();
8480 : this->featuresStr = new (C, 1) char [featuresStrLength];
8481 : if (!S.empty())
8482 : std::memcpy(this->featuresStr, S.data(), featuresStrLength);
8483 : }
8484 :
8485 :
8486 1139863 : struct ParsedTargetAttr {
8487 : std::vector<std::string> Features;
8488 : StringRef Architecture;
8489 : bool DuplicateArchitecture = false;
8490 179 : bool operator ==(const ParsedTargetAttr &Other) const {
8491 179 : return DuplicateArchitecture == Other.DuplicateArchitecture &&
8492 218 : Architecture == Other.Architecture && Features == Other.Features;
8493 : }
8494 : };
8495 : ParsedTargetAttr parse() const {
8496 50908 : return parse(getFeaturesStr());
8497 : }
8498 :
8499 72 : StringRef getArchitecture() const {
8500 72 : StringRef Features = getFeaturesStr();
8501 20 : if (Features == "default") return {};
8502 :
8503 : SmallVector<StringRef, 1> AttrFeatures;
8504 52 : Features.split(AttrFeatures, ",");
8505 :
8506 73 : for (auto &Feature : AttrFeatures) {
8507 54 : Feature = Feature.trim();
8508 : if (Feature.startswith("arch="))
8509 : return Feature.drop_front(sizeof("arch=") - 1);
8510 : }
8511 19 : return "";
8512 : }
8513 :
8514 : // Gets the list of features as simple string-refs with no +/- or 'no-'.
8515 : // Only adds the items to 'Out' that are additions.
8516 72 : void getAddedFeatures(llvm::SmallVectorImpl<StringRef> &Out) const {
8517 72 : StringRef Features = getFeaturesStr();
8518 20 : if (Features == "default") return;
8519 :
8520 : SmallVector<StringRef, 1> AttrFeatures;
8521 52 : Features.split(AttrFeatures, ",");
8522 :
8523 108 : for (auto &Feature : AttrFeatures) {
8524 56 : Feature = Feature.trim();
8525 :
8526 : if (!Feature.startswith("no-") && !Feature.startswith("arch=") &&
8527 : !Feature.startswith("fpmath=") && !Feature.startswith("tune="))
8528 23 : Out.push_back(Feature);
8529 : }
8530 : }
8531 :
8532 : template<class Compare>
8533 52 : ParsedTargetAttr parse(Compare cmp) const {
8534 : ParsedTargetAttr Attrs = parse();
8535 : llvm::sort(std::begin(Attrs.Features), std::end(Attrs.Features), cmp);
8536 52 : return Attrs;
8537 : }
8538 :
8539 326 : bool isDefaultVersion() const { return getFeaturesStr() == "default"; }
8540 :
8541 569854 : static ParsedTargetAttr parse(StringRef Features) {
8542 : ParsedTargetAttr Ret;
8543 : if (Features == "default") return Ret;
8544 : SmallVector<StringRef, 1> AttrFeatures;
8545 569624 : Features.split(AttrFeatures, ",");
8546 :
8547 : // Grab the various features and prepend a "+" to turn on the feature to
8548 : // the backend and add them to our existing set of features.
8549 1240201 : for (auto &Feature : AttrFeatures) {
8550 : // Go ahead and trim whitespace rather than either erroring or
8551 : // accepting it weirdly.
8552 670577 : Feature = Feature.trim();
8553 :
8554 : // We don't support cpu tuning this way currently.
8555 : // TODO: Support the fpmath option. It will require checking
8556 : // overall feature validity for the function with the rest of the
8557 : // attributes on the function.
8558 : if (Feature.startswith("fpmath=") || Feature.startswith("tune="))
8559 : continue;
8560 :
8561 : // While we're here iterating check for a different target cpu.
8562 : if (Feature.startswith("arch=")) {
8563 503 : if (!Ret.Architecture.empty())
8564 3 : Ret.DuplicateArchitecture = true;
8565 : else
8566 1000 : Ret.Architecture = Feature.split("=").second.trim();
8567 : } else if (Feature.startswith("no-"))
8568 252 : Ret.Features.push_back("-" + Feature.split("-").second.str());
8569 : else
8570 2010033 : Ret.Features.push_back("+" + Feature.str());
8571 : }
8572 : return Ret;
8573 : }
8574 :
8575 :
8576 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Target; }
8577 : };
8578 :
8579 : class TestTypestateAttr : public InheritableAttr {
8580 : public:
8581 : enum ConsumedState {
8582 : Consumed,
8583 : Unconsumed
8584 : };
8585 : private:
8586 : ConsumedState testState;
8587 :
8588 : public:
8589 : static TestTypestateAttr *CreateImplicit(ASTContext &Ctx, ConsumedState TestState, SourceRange Loc = SourceRange()) {
8590 : auto *A = new (Ctx) TestTypestateAttr(Loc, Ctx, TestState, 0);
8591 : A->setImplicit(true);
8592 : return A;
8593 : }
8594 :
8595 : TestTypestateAttr(SourceRange R, ASTContext &Ctx
8596 : , ConsumedState TestState
8597 : , unsigned SI
8598 : )
8599 13 : : InheritableAttr(attr::TestTypestate, R, SI, false, false)
8600 13 : , testState(TestState)
8601 : {
8602 : }
8603 :
8604 : TestTypestateAttr *clone(ASTContext &C) const;
8605 : void printPretty(raw_ostream &OS,
8606 : const PrintingPolicy &Policy) const;
8607 : const char *getSpelling() const;
8608 0 : ConsumedState getTestState() const {
8609 0 : return testState;
8610 : }
8611 :
8612 5 : static bool ConvertStrToConsumedState(StringRef Val, ConsumedState &Out) {
8613 5 : Optional<ConsumedState> R = llvm::StringSwitch<Optional<ConsumedState>>(Val)
8614 5 : .Case("consumed", TestTypestateAttr::Consumed)
8615 5 : .Case("unconsumed", TestTypestateAttr::Unconsumed)
8616 : .Default(Optional<ConsumedState>());
8617 5 : if (R) {
8618 5 : Out = *R;
8619 5 : return true;
8620 : }
8621 : return false;
8622 : }
8623 :
8624 : static const char *ConvertConsumedStateToStr(ConsumedState Val) {
8625 0 : switch(Val) {
8626 : case TestTypestateAttr::Consumed: return "consumed";
8627 0 : case TestTypestateAttr::Unconsumed: return "unconsumed";
8628 : }
8629 0 : llvm_unreachable("No enumerator with that value");
8630 : }
8631 :
8632 :
8633 0 : static bool classof(const Attr *A) { return A->getKind() == attr::TestTypestate; }
8634 : };
8635 :
8636 : class ThisCallAttr : public InheritableAttr {
8637 : public:
8638 : static ThisCallAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8639 : auto *A = new (Ctx) ThisCallAttr(Loc, Ctx, 0);
8640 : A->setImplicit(true);
8641 : return A;
8642 : }
8643 :
8644 : ThisCallAttr(SourceRange R, ASTContext &Ctx
8645 : , unsigned SI
8646 : )
8647 : : InheritableAttr(attr::ThisCall, R, SI, false, false)
8648 : {
8649 : }
8650 :
8651 : ThisCallAttr *clone(ASTContext &C) const;
8652 : void printPretty(raw_ostream &OS,
8653 : const PrintingPolicy &Policy) const;
8654 : const char *getSpelling() const;
8655 :
8656 :
8657 0 : static bool classof(const Attr *A) { return A->getKind() == attr::ThisCall; }
8658 : };
8659 :
8660 : class ThreadAttr : public Attr {
8661 : public:
8662 : static ThreadAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8663 : auto *A = new (Ctx) ThreadAttr(Loc, Ctx, 0);
8664 : A->setImplicit(true);
8665 : return A;
8666 : }
8667 :
8668 : ThreadAttr(SourceRange R, ASTContext &Ctx
8669 : , unsigned SI
8670 : )
8671 : : Attr(attr::Thread, R, SI, false)
8672 : {
8673 : }
8674 :
8675 : ThreadAttr *clone(ASTContext &C) const;
8676 : void printPretty(raw_ostream &OS,
8677 : const PrintingPolicy &Policy) const;
8678 : const char *getSpelling() const;
8679 :
8680 :
8681 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Thread; }
8682 : };
8683 :
8684 : class TransparentUnionAttr : public InheritableAttr {
8685 : public:
8686 : static TransparentUnionAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8687 : auto *A = new (Ctx) TransparentUnionAttr(Loc, Ctx, 0);
8688 : A->setImplicit(true);
8689 : return A;
8690 : }
8691 :
8692 : TransparentUnionAttr(SourceRange R, ASTContext &Ctx
8693 : , unsigned SI
8694 : )
8695 : : InheritableAttr(attr::TransparentUnion, R, SI, false, false)
8696 : {
8697 : }
8698 :
8699 : TransparentUnionAttr *clone(ASTContext &C) const;
8700 : void printPretty(raw_ostream &OS,
8701 : const PrintingPolicy &Policy) const;
8702 : const char *getSpelling() const;
8703 :
8704 :
8705 0 : static bool classof(const Attr *A) { return A->getKind() == attr::TransparentUnion; }
8706 : };
8707 :
8708 : class TrivialABIAttr : public InheritableAttr {
8709 : public:
8710 : static TrivialABIAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8711 : auto *A = new (Ctx) TrivialABIAttr(Loc, Ctx, 0);
8712 : A->setImplicit(true);
8713 : return A;
8714 : }
8715 :
8716 : TrivialABIAttr(SourceRange R, ASTContext &Ctx
8717 : , unsigned SI
8718 : )
8719 : : InheritableAttr(attr::TrivialABI, R, SI, false, false)
8720 : {
8721 : }
8722 :
8723 : TrivialABIAttr *clone(ASTContext &C) const;
8724 : void printPretty(raw_ostream &OS,
8725 : const PrintingPolicy &Policy) const;
8726 : const char *getSpelling() const;
8727 :
8728 :
8729 21 : static bool classof(const Attr *A) { return A->getKind() == attr::TrivialABI; }
8730 : };
8731 :
8732 : class TryAcquireCapabilityAttr : public InheritableAttr {
8733 : Expr * successValue;
8734 :
8735 : unsigned args_Size;
8736 : Expr * *args_;
8737 :
8738 : public:
8739 : enum Spelling {
8740 : GNU_try_acquire_capability = 0,
8741 : CXX11_clang_try_acquire_capability = 1,
8742 : GNU_try_acquire_shared_capability = 2,
8743 : CXX11_clang_try_acquire_shared_capability = 3
8744 : };
8745 :
8746 : static TryAcquireCapabilityAttr *CreateImplicit(ASTContext &Ctx, Spelling S, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Loc = SourceRange()) {
8747 : auto *A = new (Ctx) TryAcquireCapabilityAttr(Loc, Ctx, SuccessValue, Args, ArgsSize, S);
8748 : A->setImplicit(true);
8749 : return A;
8750 : }
8751 :
8752 42 : TryAcquireCapabilityAttr(SourceRange R, ASTContext &Ctx
8753 : , Expr * SuccessValue
8754 : , Expr * *Args, unsigned ArgsSize
8755 : , unsigned SI
8756 : )
8757 42 : : InheritableAttr(attr::TryAcquireCapability, R, SI, true, true)
8758 : , successValue(SuccessValue)
8759 42 : , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size])
8760 : {
8761 42 : std::copy(Args, Args + args_Size, args_);
8762 42 : }
8763 :
8764 : TryAcquireCapabilityAttr(SourceRange R, ASTContext &Ctx
8765 : , Expr * SuccessValue
8766 : , unsigned SI
8767 : )
8768 : : InheritableAttr(attr::TryAcquireCapability, R, SI, true, true)
8769 : , successValue(SuccessValue)
8770 : , args_Size(0), args_(nullptr)
8771 : {
8772 : }
8773 :
8774 : TryAcquireCapabilityAttr *clone(ASTContext &C) const;
8775 : void printPretty(raw_ostream &OS,
8776 : const PrintingPolicy &Policy) const;
8777 : const char *getSpelling() const;
8778 : Spelling getSemanticSpelling() const {
8779 : switch (SpellingListIndex) {
8780 : default: llvm_unreachable("Unknown spelling list index");
8781 : case 0: return GNU_try_acquire_capability;
8782 : case 1: return CXX11_clang_try_acquire_capability;
8783 : case 2: return GNU_try_acquire_shared_capability;
8784 : case 3: return CXX11_clang_try_acquire_shared_capability;
8785 : }
8786 : }
8787 168 : bool isShared() const { return SpellingListIndex == 2 ||
8788 : SpellingListIndex == 3; }
8789 0 : Expr * getSuccessValue() const {
8790 0 : return successValue;
8791 : }
8792 :
8793 : typedef Expr ** args_iterator;
8794 0 : args_iterator args_begin() const { return args_; }
8795 194 : args_iterator args_end() const { return args_ + args_Size; }
8796 0 : unsigned args_size() const { return args_Size; }
8797 194 : llvm::iterator_range<args_iterator> args() const { return llvm::make_range(args_begin(), args_end()); }
8798 :
8799 :
8800 :
8801 :
8802 0 : static bool classof(const Attr *A) { return A->getKind() == attr::TryAcquireCapability; }
8803 : };
8804 :
8805 : class TypeNonNullAttr : public TypeAttr {
8806 : public:
8807 : static TypeNonNullAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8808 : auto *A = new (Ctx) TypeNonNullAttr(Loc, Ctx, 0);
8809 : A->setImplicit(true);
8810 : return A;
8811 : }
8812 :
8813 : TypeNonNullAttr(SourceRange R, ASTContext &Ctx
8814 : , unsigned SI
8815 : )
8816 : : TypeAttr(attr::TypeNonNull, R, SI, false)
8817 : {
8818 : }
8819 :
8820 : TypeNonNullAttr *clone(ASTContext &C) const;
8821 : void printPretty(raw_ostream &OS,
8822 : const PrintingPolicy &Policy) const;
8823 : const char *getSpelling() const;
8824 :
8825 :
8826 0 : static bool classof(const Attr *A) { return A->getKind() == attr::TypeNonNull; }
8827 : };
8828 :
8829 : class TypeNullUnspecifiedAttr : public TypeAttr {
8830 : public:
8831 : static TypeNullUnspecifiedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8832 : auto *A = new (Ctx) TypeNullUnspecifiedAttr(Loc, Ctx, 0);
8833 : A->setImplicit(true);
8834 : return A;
8835 : }
8836 :
8837 : TypeNullUnspecifiedAttr(SourceRange R, ASTContext &Ctx
8838 : , unsigned SI
8839 : )
8840 : : TypeAttr(attr::TypeNullUnspecified, R, SI, false)
8841 : {
8842 : }
8843 :
8844 : TypeNullUnspecifiedAttr *clone(ASTContext &C) const;
8845 : void printPretty(raw_ostream &OS,
8846 : const PrintingPolicy &Policy) const;
8847 : const char *getSpelling() const;
8848 :
8849 :
8850 0 : static bool classof(const Attr *A) { return A->getKind() == attr::TypeNullUnspecified; }
8851 : };
8852 :
8853 : class TypeNullableAttr : public TypeAttr {
8854 : public:
8855 : static TypeNullableAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8856 : auto *A = new (Ctx) TypeNullableAttr(Loc, Ctx, 0);
8857 : A->setImplicit(true);
8858 : return A;
8859 : }
8860 :
8861 : TypeNullableAttr(SourceRange R, ASTContext &Ctx
8862 : , unsigned SI
8863 : )
8864 : : TypeAttr(attr::TypeNullable, R, SI, false)
8865 : {
8866 : }
8867 :
8868 : TypeNullableAttr *clone(ASTContext &C) const;
8869 : void printPretty(raw_ostream &OS,
8870 : const PrintingPolicy &Policy) const;
8871 : const char *getSpelling() const;
8872 :
8873 :
8874 0 : static bool classof(const Attr *A) { return A->getKind() == attr::TypeNullable; }
8875 : };
8876 :
8877 : class TypeTagForDatatypeAttr : public InheritableAttr {
8878 : IdentifierInfo * argumentKind;
8879 :
8880 : TypeSourceInfo * matchingCType;
8881 :
8882 : bool layoutCompatible;
8883 :
8884 : bool mustBeNull;
8885 :
8886 : public:
8887 : static TypeTagForDatatypeAttr *CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, SourceRange Loc = SourceRange()) {
8888 : auto *A = new (Ctx) TypeTagForDatatypeAttr(Loc, Ctx, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull, 0);
8889 : A->setImplicit(true);
8890 : return A;
8891 : }
8892 :
8893 : TypeTagForDatatypeAttr(SourceRange R, ASTContext &Ctx
8894 : , IdentifierInfo * ArgumentKind
8895 : , TypeSourceInfo * MatchingCType
8896 : , bool LayoutCompatible
8897 : , bool MustBeNull
8898 : , unsigned SI
8899 : )
8900 164 : : InheritableAttr(attr::TypeTagForDatatype, R, SI, false, false)
8901 : , argumentKind(ArgumentKind)
8902 : , matchingCType(MatchingCType)
8903 : , layoutCompatible(LayoutCompatible)
8904 164 : , mustBeNull(MustBeNull)
8905 : {
8906 : }
8907 :
8908 : TypeTagForDatatypeAttr *clone(ASTContext &C) const;
8909 : void printPretty(raw_ostream &OS,
8910 : const PrintingPolicy &Policy) const;
8911 : const char *getSpelling() const;
8912 0 : IdentifierInfo * getArgumentKind() const {
8913 0 : return argumentKind;
8914 : }
8915 :
8916 0 : QualType getMatchingCType() const {
8917 0 : return matchingCType->getType();
8918 0 : } TypeSourceInfo * getMatchingCTypeLoc() const {
8919 0 : return matchingCType;
8920 : }
8921 :
8922 0 : bool getLayoutCompatible() const {
8923 0 : return layoutCompatible;
8924 : }
8925 :
8926 0 : bool getMustBeNull() const {
8927 0 : return mustBeNull;
8928 : }
8929 :
8930 :
8931 :
8932 0 : static bool classof(const Attr *A) { return A->getKind() == attr::TypeTagForDatatype; }
8933 : };
8934 :
8935 : class TypeVisibilityAttr : public InheritableAttr {
8936 : public:
8937 : enum VisibilityType {
8938 : Default,
8939 : Hidden,
8940 : Protected
8941 : };
8942 : private:
8943 : VisibilityType visibility;
8944 :
8945 : public:
8946 74210 : static TypeVisibilityAttr *CreateImplicit(ASTContext &Ctx, VisibilityType Visibility, SourceRange Loc = SourceRange()) {
8947 74210 : auto *A = new (Ctx) TypeVisibilityAttr(Loc, Ctx, Visibility, 0);
8948 : A->setImplicit(true);
8949 74210 : return A;
8950 : }
8951 :
8952 : TypeVisibilityAttr(SourceRange R, ASTContext &Ctx
8953 : , VisibilityType Visibility
8954 : , unsigned SI
8955 : )
8956 1998300 : : InheritableAttr(attr::TypeVisibility, R, SI, false, false)
8957 1998300 : , visibility(Visibility)
8958 : {
8959 : }
8960 :
8961 : TypeVisibilityAttr *clone(ASTContext &C) const;
8962 : void printPretty(raw_ostream &OS,
8963 : const PrintingPolicy &Policy) const;
8964 : const char *getSpelling() const;
8965 0 : VisibilityType getVisibility() const {
8966 0 : return visibility;
8967 : }
8968 :
8969 : static bool ConvertStrToVisibilityType(StringRef Val, VisibilityType &Out) {
8970 : Optional<VisibilityType> R = llvm::StringSwitch<Optional<VisibilityType>>(Val)
8971 : .Case("default", TypeVisibilityAttr::Default)
8972 : .Case("hidden", TypeVisibilityAttr::Hidden)
8973 : .Case("internal", TypeVisibilityAttr::Hidden)
8974 : .Case("protected", TypeVisibilityAttr::Protected)
8975 : .Default(Optional<VisibilityType>());
8976 : if (R) {
8977 : Out = *R;
8978 : return true;
8979 : }
8980 : return false;
8981 : }
8982 :
8983 : static const char *ConvertVisibilityTypeToStr(VisibilityType Val) {
8984 0 : switch(Val) {
8985 : case TypeVisibilityAttr::Default: return "default";
8986 0 : case TypeVisibilityAttr::Hidden: return "hidden";
8987 0 : case TypeVisibilityAttr::Protected: return "protected";
8988 : }
8989 0 : llvm_unreachable("No enumerator with that value");
8990 : }
8991 :
8992 :
8993 0 : static bool classof(const Attr *A) { return A->getKind() == attr::TypeVisibility; }
8994 : };
8995 :
8996 : class UPtrAttr : public TypeAttr {
8997 : public:
8998 : static UPtrAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
8999 : auto *A = new (Ctx) UPtrAttr(Loc, Ctx, 0);
9000 : A->setImplicit(true);
9001 : return A;
9002 : }
9003 :
9004 : UPtrAttr(SourceRange R, ASTContext &Ctx
9005 : , unsigned SI
9006 : )
9007 : : TypeAttr(attr::UPtr, R, SI, false)
9008 : {
9009 : }
9010 :
9011 : UPtrAttr *clone(ASTContext &C) const;
9012 : void printPretty(raw_ostream &OS,
9013 : const PrintingPolicy &Policy) const;
9014 : const char *getSpelling() const;
9015 :
9016 :
9017 : static bool classof(const Attr *A) { return A->getKind() == attr::UPtr; }
9018 : };
9019 :
9020 : class UnavailableAttr : public InheritableAttr {
9021 : unsigned messageLength;
9022 : char *message;
9023 :
9024 : public:
9025 : enum ImplicitReason {
9026 : IR_None,
9027 : IR_ARCForbiddenType,
9028 : IR_ForbiddenWeak,
9029 : IR_ARCForbiddenConversion,
9030 : IR_ARCInitReturnsUnrelated,
9031 : IR_ARCFieldWithOwnership
9032 : };
9033 : private:
9034 : ImplicitReason implicitReason;
9035 :
9036 : public:
9037 54 : static UnavailableAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, ImplicitReason ImplicitReason, SourceRange Loc = SourceRange()) {
9038 54 : auto *A = new (Ctx) UnavailableAttr(Loc, Ctx, Message, ImplicitReason, 0);
9039 : A->setImplicit(true);
9040 54 : return A;
9041 : }
9042 :
9043 : static UnavailableAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, SourceRange Loc = SourceRange()) {
9044 : auto *A = new (Ctx) UnavailableAttr(Loc, Ctx, Message, 0);
9045 : A->setImplicit(true);
9046 : return A;
9047 : }
9048 :
9049 120 : UnavailableAttr(SourceRange R, ASTContext &Ctx
9050 : , llvm::StringRef Message
9051 : , ImplicitReason ImplicitReason
9052 : , unsigned SI
9053 : )
9054 120 : : InheritableAttr(attr::Unavailable, R, SI, false, false)
9055 120 : , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
9056 120 : , implicitReason(ImplicitReason)
9057 : {
9058 120 : if (!Message.empty())
9059 12 : std::memcpy(message, Message.data(), messageLength);
9060 120 : }
9061 :
9062 903 : UnavailableAttr(SourceRange R, ASTContext &Ctx
9063 : , llvm::StringRef Message
9064 : , unsigned SI
9065 : )
9066 903 : : InheritableAttr(attr::Unavailable, R, SI, false, false)
9067 903 : , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength])
9068 903 : , implicitReason(ImplicitReason(0))
9069 : {
9070 903 : if (!Message.empty())
9071 1404 : std::memcpy(message, Message.data(), messageLength);
9072 903 : }
9073 :
9074 : UnavailableAttr(SourceRange R, ASTContext &Ctx
9075 : , unsigned SI
9076 : )
9077 : : InheritableAttr(attr::Unavailable, R, SI, false, false)
9078 : , messageLength(0),message(nullptr)
9079 : , implicitReason(ImplicitReason(0))
9080 : {
9081 : }
9082 :
9083 : UnavailableAttr *clone(ASTContext &C) const;
9084 : void printPretty(raw_ostream &OS,
9085 : const PrintingPolicy &Policy) const;
9086 : const char *getSpelling() const;
9087 0 : llvm::StringRef getMessage() const {
9088 640 : return llvm::StringRef(message, messageLength);
9089 : }
9090 : unsigned getMessageLength() const {
9091 : return messageLength;
9092 : }
9093 : void setMessage(ASTContext &C, llvm::StringRef S) {
9094 : messageLength = S.size();
9095 : this->message = new (C, 1) char [messageLength];
9096 : if (!S.empty())
9097 : std::memcpy(this->message, S.data(), messageLength);
9098 : }
9099 :
9100 0 : ImplicitReason getImplicitReason() const {
9101 0 : return implicitReason;
9102 : }
9103 :
9104 :
9105 :
9106 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Unavailable; }
9107 : };
9108 :
9109 : class UnusedAttr : public InheritableAttr {
9110 : public:
9111 : enum Spelling {
9112 : CXX11_maybe_unused = 0,
9113 : GNU_unused = 1,
9114 : CXX11_gnu_unused = 2,
9115 : C2x_maybe_unused = 3
9116 : };
9117 :
9118 19 : static UnusedAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
9119 19 : auto *A = new (Ctx) UnusedAttr(Loc, Ctx, S);
9120 : A->setImplicit(true);
9121 19 : return A;
9122 : }
9123 :
9124 : UnusedAttr(SourceRange R, ASTContext &Ctx
9125 : , unsigned SI
9126 : )
9127 : : InheritableAttr(attr::Unused, R, SI, false, false)
9128 : {
9129 : }
9130 :
9131 : UnusedAttr *clone(ASTContext &C) const;
9132 : void printPretty(raw_ostream &OS,
9133 : const PrintingPolicy &Policy) const;
9134 : const char *getSpelling() const;
9135 : Spelling getSemanticSpelling() const {
9136 911 : switch (SpellingListIndex) {
9137 0 : default: llvm_unreachable("Unknown spelling list index");
9138 : case 0: return CXX11_maybe_unused;
9139 : case 1: return GNU_unused;
9140 : case 2: return CXX11_gnu_unused;
9141 : case 3: return C2x_maybe_unused;
9142 : }
9143 : }
9144 :
9145 :
9146 0 : static bool classof(const Attr *A) { return A->getKind() == attr::Unused; }
9147 : };
9148 :
9149 : class UsedAttr : public InheritableAttr {
9150 : public:
9151 56 : static UsedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
9152 56 : auto *A = new (Ctx) UsedAttr(Loc, Ctx, 0);
9153 : A->setImplicit(true);
9154 56 : return A;
9155 : }
9156 :
9157 : UsedAttr(SourceRange R, ASTContext &Ctx
9158 : , unsigned SI
9159 : )
9160 : : InheritableAttr(attr::Used, R, SI, false, false)
9161 : {
9162 : }
9163 :
9164 : UsedAttr *clone(ASTContext &C) const;
9165 : void printPretty(raw_ostream &OS,
9166 : const PrintingPolicy &Policy) const;
9167 : const char *getSpelling() const;
9168 :
9169 :
9170 4 : static bool classof(const Attr *A) { return A->getKind() == attr::Used; }
9171 : };
9172 :
9173 : class UuidAttr : public InheritableAttr {
9174 : unsigned guidLength;
9175 : char *guid;
9176 :
9177 : public:
9178 : static UuidAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, SourceRange Loc = SourceRange()) {
9179 : auto *A = new (Ctx) UuidAttr(Loc, Ctx, Guid, 0);
9180 : A->setImplicit(true);
9181 : return A;
9182 : }
9183 :
9184 136 : UuidAttr(SourceRange R, ASTContext &Ctx
9185 : , llvm::StringRef Guid
9186 : , unsigned SI
9187 : )
9188 136 : : InheritableAttr(attr::Uuid, R, SI, false, false)
9189 136 : , guidLength(Guid.size()),guid(new (Ctx, 1) char[guidLength])
9190 : {
9191 136 : if (!Guid.empty())
9192 272 : std::memcpy(guid, Guid.data(), guidLength);
9193 136 : }
9194 :
9195 : UuidAttr *clone(ASTContext &C) const;
9196 : void printPretty(raw_ostream &OS,
9197 : const PrintingPolicy &Policy) const;
9198 : const char *getSpelling() const;
9199 0 : llvm::StringRef getGuid() const {
9200 178 : return llvm::StringRef(guid, guidLength);
9201 : }
9202 : unsigned getGuidLength() const {
9203 : return guidLength;
9204 : }
9205 : void setGuid(ASTContext &C, llvm::StringRef S) {
9206 : guidLength = S.size();
9207 : this->guid = new (C, 1) char [guidLength];
9208 : if (!S.empty())
9209 : std::memcpy(this->guid, S.data(), guidLength);
9210 : }
9211 :
9212 :
9213 :
9214 16 : static bool classof(const Attr *A) { return A->getKind() == attr::Uuid; }
9215 : };
9216 :
9217 : class VecReturnAttr : public InheritableAttr {
9218 : public:
9219 : static VecReturnAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
9220 : auto *A = new (Ctx) VecReturnAttr(Loc, Ctx, 0);
9221 : A->setImplicit(true);
9222 : return A;
9223 : }
9224 :
9225 : VecReturnAttr(SourceRange R, ASTContext &Ctx
9226 : , unsigned SI
9227 : )
9228 : : InheritableAttr(attr::VecReturn, R, SI, false, false)
9229 : {
9230 : }
9231 :
9232 : VecReturnAttr *clone(ASTContext &C) const;
9233 : void printPretty(raw_ostream &OS,
9234 : const PrintingPolicy &Policy) const;
9235 : const char *getSpelling() const;
9236 :
9237 :
9238 0 : static bool classof(const Attr *A) { return A->getKind() == attr::VecReturn; }
9239 : };
9240 :
9241 : class VecTypeHintAttr : public InheritableAttr {
9242 : TypeSourceInfo * typeHint;
9243 :
9244 : public:
9245 : static VecTypeHintAttr *CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypeHint, SourceRange Loc = SourceRange()) {
9246 : auto *A = new (Ctx) VecTypeHintAttr(Loc, Ctx, TypeHint, 0);
9247 : A->setImplicit(true);
9248 : return A;
9249 : }
9250 :
9251 : VecTypeHintAttr(SourceRange R, ASTContext &Ctx
9252 : , TypeSourceInfo * TypeHint
9253 : , unsigned SI
9254 : )
9255 5 : : InheritableAttr(attr::VecTypeHint, R, SI, false, false)
9256 5 : , typeHint(TypeHint)
9257 : {
9258 : }
9259 :
9260 : VecTypeHintAttr *clone(ASTContext &C) const;
9261 : void printPretty(raw_ostream &OS,
9262 : const PrintingPolicy &Policy) const;
9263 : const char *getSpelling() const;
9264 0 : QualType getTypeHint() const {
9265 0 : return typeHint->getType();
9266 0 : } TypeSourceInfo * getTypeHintLoc() const {
9267 0 : return typeHint;
9268 : }
9269 :
9270 :
9271 :
9272 0 : static bool classof(const Attr *A) { return A->getKind() == attr::VecTypeHint; }
9273 : };
9274 :
9275 : class VectorCallAttr : public InheritableAttr {
9276 : public:
9277 : static VectorCallAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
9278 : auto *A = new (Ctx) VectorCallAttr(Loc, Ctx, 0);
9279 : A->setImplicit(true);
9280 : return A;
9281 : }
9282 :
9283 : VectorCallAttr(SourceRange R, ASTContext &Ctx
9284 : , unsigned SI
9285 : )
9286 : : InheritableAttr(attr::VectorCall, R, SI, false, false)
9287 : {
9288 : }
9289 :
9290 : VectorCallAttr *clone(ASTContext &C) const;
9291 : void printPretty(raw_ostream &OS,
9292 : const PrintingPolicy &Policy) const;
9293 : const char *getSpelling() const;
9294 :
9295 :
9296 0 : static bool classof(const Attr *A) { return A->getKind() == attr::VectorCall; }
9297 : };
9298 :
9299 : class VisibilityAttr : public InheritableAttr {
9300 : public:
9301 : enum VisibilityType {
9302 : Default,
9303 : Hidden,
9304 : Protected
9305 : };
9306 : private:
9307 : VisibilityType visibility;
9308 :
9309 : public:
9310 71508 : static VisibilityAttr *CreateImplicit(ASTContext &Ctx, VisibilityType Visibility, SourceRange Loc = SourceRange()) {
9311 71508 : auto *A = new (Ctx) VisibilityAttr(Loc, Ctx, Visibility, 0);
9312 : A->setImplicit(true);
9313 71508 : return A;
9314 : }
9315 :
9316 : VisibilityAttr(SourceRange R, ASTContext &Ctx
9317 : , VisibilityType Visibility
9318 : , unsigned SI
9319 : )
9320 11247532 : : InheritableAttr(attr::Visibility, R, SI, false, false)
9321 11247532 : , visibility(Visibility)
9322 : {
9323 : }
9324 :
9325 : VisibilityAttr *clone(ASTContext &C) const;
9326 : void printPretty(raw_ostream &OS,
9327 : const PrintingPolicy &Policy) const;
9328 : const char *getSpelling() const;
9329 0 : VisibilityType getVisibility() const {
9330 0 : return visibility;
9331 : }
9332 :
9333 12554260 : static bool ConvertStrToVisibilityType(StringRef Val, VisibilityType &Out) {
9334 12554260 : Optional<VisibilityType> R = llvm::StringSwitch<Optional<VisibilityType>>(Val)
9335 12554260 : .Case("default", VisibilityAttr::Default)
9336 12554260 : .Case("hidden", VisibilityAttr::Hidden)
9337 12554260 : .Case("internal", VisibilityAttr::Hidden)
9338 12554260 : .Case("protected", VisibilityAttr::Protected)
9339 : .Default(Optional<VisibilityType>());
9340 12554260 : if (R) {
9341 12554260 : Out = *R;
9342 12554260 : return true;
9343 : }
9344 : return false;
9345 : }
9346 :
9347 : static const char *ConvertVisibilityTypeToStr(VisibilityType Val) {
9348 3 : switch(Val) {
9349 : case VisibilityAttr::Default: return "default";
9350 2 : case VisibilityAttr::Hidden: return "hidden";
9351 0 : case VisibilityAttr::Protected: return "protected";
9352 : }
9353 0 : llvm_unreachable("No enumerator with that value");
9354 : }
9355 :
9356 :
9357 6 : static bool classof(const Attr *A) { return A->getKind() == attr::Visibility; }
9358 : };
9359 :
9360 : class WarnUnusedAttr : public InheritableAttr {
9361 : public:
9362 : static WarnUnusedAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
9363 : auto *A = new (Ctx) WarnUnusedAttr(Loc, Ctx, 0);
9364 : A->setImplicit(true);
9365 : return A;
9366 : }
9367 :
9368 : WarnUnusedAttr(SourceRange R, ASTContext &Ctx
9369 : , unsigned SI
9370 : )
9371 : : InheritableAttr(attr::WarnUnused, R, SI, false, false)
9372 : {
9373 : }
9374 :
9375 : WarnUnusedAttr *clone(ASTContext &C) const;
9376 : void printPretty(raw_ostream &OS,
9377 : const PrintingPolicy &Policy) const;
9378 : const char *getSpelling() const;
9379 :
9380 :
9381 0 : static bool classof(const Attr *A) { return A->getKind() == attr::WarnUnused; }
9382 : };
9383 :
9384 : class WarnUnusedResultAttr : public InheritableAttr {
9385 : public:
9386 : enum Spelling {
9387 : CXX11_nodiscard = 0,
9388 : C2x_nodiscard = 1,
9389 : CXX11_clang_warn_unused_result = 2,
9390 : GNU_warn_unused_result = 3,
9391 : CXX11_gnu_warn_unused_result = 4
9392 : };
9393 :
9394 : static WarnUnusedResultAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
9395 : auto *A = new (Ctx) WarnUnusedResultAttr(Loc, Ctx, S);
9396 : A->setImplicit(true);
9397 : return A;
9398 : }
9399 :
9400 : WarnUnusedResultAttr(SourceRange R, ASTContext &Ctx
9401 : , unsigned SI
9402 : )
9403 : : InheritableAttr(attr::WarnUnusedResult, R, SI, false, false)
9404 : {
9405 : }
9406 :
9407 : WarnUnusedResultAttr *clone(ASTContext &C) const;
9408 : void printPretty(raw_ostream &OS,
9409 : const PrintingPolicy &Policy) const;
9410 : const char *getSpelling() const;
9411 : Spelling getSemanticSpelling() const {
9412 : switch (SpellingListIndex) {
9413 : default: llvm_unreachable("Unknown spelling list index");
9414 : case 0: return CXX11_nodiscard;
9415 : case 1: return C2x_nodiscard;
9416 : case 2: return CXX11_clang_warn_unused_result;
9417 : case 3: return GNU_warn_unused_result;
9418 : case 4: return CXX11_gnu_warn_unused_result;
9419 : }
9420 : }
9421 :
9422 :
9423 0 : static bool classof(const Attr *A) { return A->getKind() == attr::WarnUnusedResult; }
9424 : };
9425 :
9426 : class WeakAttr : public InheritableAttr {
9427 : public:
9428 82 : static WeakAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
9429 82 : auto *A = new (Ctx) WeakAttr(Loc, Ctx, 0);
9430 : A->setImplicit(true);
9431 82 : return A;
9432 : }
9433 :
9434 : WeakAttr(SourceRange R, ASTContext &Ctx
9435 : , unsigned SI
9436 : )
9437 : : InheritableAttr(attr::Weak, R, SI, false, false)
9438 : {
9439 : }
9440 :
9441 : WeakAttr *clone(ASTContext &C) const;
9442 : void printPretty(raw_ostream &OS,
9443 : const PrintingPolicy &Policy) const;
9444 : const char *getSpelling() const;
9445 :
9446 :
9447 10 : static bool classof(const Attr *A) { return A->getKind() == attr::Weak; }
9448 : };
9449 :
9450 : class WeakImportAttr : public InheritableAttr {
9451 : public:
9452 : static WeakImportAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
9453 : auto *A = new (Ctx) WeakImportAttr(Loc, Ctx, 0);
9454 : A->setImplicit(true);
9455 : return A;
9456 : }
9457 :
9458 : WeakImportAttr(SourceRange R, ASTContext &Ctx
9459 : , unsigned SI
9460 : )
9461 : : InheritableAttr(attr::WeakImport, R, SI, false, false)
9462 : {
9463 : }
9464 :
9465 : WeakImportAttr *clone(ASTContext &C) const;
9466 : void printPretty(raw_ostream &OS,
9467 : const PrintingPolicy &Policy) const;
9468 : const char *getSpelling() const;
9469 :
9470 :
9471 2 : static bool classof(const Attr *A) { return A->getKind() == attr::WeakImport; }
9472 : };
9473 :
9474 : class WeakRefAttr : public InheritableAttr {
9475 : unsigned aliaseeLength;
9476 : char *aliasee;
9477 :
9478 : public:
9479 : static WeakRefAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Loc = SourceRange()) {
9480 : auto *A = new (Ctx) WeakRefAttr(Loc, Ctx, Aliasee, 0);
9481 : A->setImplicit(true);
9482 : return A;
9483 : }
9484 :
9485 2 : WeakRefAttr(SourceRange R, ASTContext &Ctx
9486 : , llvm::StringRef Aliasee
9487 : , unsigned SI
9488 : )
9489 2 : : InheritableAttr(attr::WeakRef, R, SI, false, false)
9490 2 : , aliaseeLength(Aliasee.size()),aliasee(new (Ctx, 1) char[aliaseeLength])
9491 : {
9492 2 : if (!Aliasee.empty())
9493 0 : std::memcpy(aliasee, Aliasee.data(), aliaseeLength);
9494 2 : }
9495 :
9496 : WeakRefAttr(SourceRange R, ASTContext &Ctx
9497 : , unsigned SI
9498 : )
9499 2389 : : InheritableAttr(attr::WeakRef, R, SI, false, false)
9500 2389 : , aliaseeLength(0),aliasee(nullptr)
9501 : {
9502 : }
9503 :
9504 : WeakRefAttr *clone(ASTContext &C) const;
9505 : void printPretty(raw_ostream &OS,
9506 : const PrintingPolicy &Policy) const;
9507 : const char *getSpelling() const;
9508 0 : llvm::StringRef getAliasee() const {
9509 2 : return llvm::StringRef(aliasee, aliaseeLength);
9510 : }
9511 : unsigned getAliaseeLength() const {
9512 : return aliaseeLength;
9513 : }
9514 : void setAliasee(ASTContext &C, llvm::StringRef S) {
9515 : aliaseeLength = S.size();
9516 : this->aliasee = new (C, 1) char [aliaseeLength];
9517 : if (!S.empty())
9518 : std::memcpy(this->aliasee, S.data(), aliaseeLength);
9519 : }
9520 :
9521 :
9522 :
9523 8 : static bool classof(const Attr *A) { return A->getKind() == attr::WeakRef; }
9524 : };
9525 :
9526 : class WorkGroupSizeHintAttr : public InheritableAttr {
9527 : unsigned xDim;
9528 :
9529 : unsigned yDim;
9530 :
9531 : unsigned zDim;
9532 :
9533 : public:
9534 : static WorkGroupSizeHintAttr *CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Loc = SourceRange()) {
9535 : auto *A = new (Ctx) WorkGroupSizeHintAttr(Loc, Ctx, XDim, YDim, ZDim, 0);
9536 : A->setImplicit(true);
9537 : return A;
9538 : }
9539 :
9540 : WorkGroupSizeHintAttr(SourceRange R, ASTContext &Ctx
9541 : , unsigned XDim
9542 : , unsigned YDim
9543 : , unsigned ZDim
9544 : , unsigned SI
9545 : )
9546 5 : : InheritableAttr(attr::WorkGroupSizeHint, R, SI, false, false)
9547 : , xDim(XDim)
9548 : , yDim(YDim)
9549 5 : , zDim(ZDim)
9550 : {
9551 : }
9552 :
9553 : WorkGroupSizeHintAttr *clone(ASTContext &C) const;
9554 : void printPretty(raw_ostream &OS,
9555 : const PrintingPolicy &Policy) const;
9556 : const char *getSpelling() const;
9557 0 : unsigned getXDim() const {
9558 0 : return xDim;
9559 : }
9560 :
9561 0 : unsigned getYDim() const {
9562 0 : return yDim;
9563 : }
9564 :
9565 0 : unsigned getZDim() const {
9566 0 : return zDim;
9567 : }
9568 :
9569 :
9570 :
9571 0 : static bool classof(const Attr *A) { return A->getKind() == attr::WorkGroupSizeHint; }
9572 : };
9573 :
9574 : class X86ForceAlignArgPointerAttr : public InheritableAttr {
9575 : public:
9576 : static X86ForceAlignArgPointerAttr *CreateImplicit(ASTContext &Ctx, SourceRange Loc = SourceRange()) {
9577 : auto *A = new (Ctx) X86ForceAlignArgPointerAttr(Loc, Ctx, 0);
9578 : A->setImplicit(true);
9579 : return A;
9580 : }
9581 :
9582 : X86ForceAlignArgPointerAttr(SourceRange R, ASTContext &Ctx
9583 : , unsigned SI
9584 : )
9585 : : InheritableAttr(attr::X86ForceAlignArgPointer, R, SI, false, false)
9586 : {
9587 : }
9588 :
9589 : X86ForceAlignArgPointerAttr *clone(ASTContext &C) const;
9590 : void printPretty(raw_ostream &OS,
9591 : const PrintingPolicy &Policy) const;
9592 : const char *getSpelling() const;
9593 :
9594 :
9595 0 : static bool classof(const Attr *A) { return A->getKind() == attr::X86ForceAlignArgPointer; }
9596 : };
9597 :
9598 : class XRayInstrumentAttr : public InheritableAttr {
9599 : public:
9600 : enum Spelling {
9601 : GNU_xray_always_instrument = 0,
9602 : CXX11_clang_xray_always_instrument = 1,
9603 : C2x_clang_xray_always_instrument = 2,
9604 : GNU_xray_never_instrument = 3,
9605 : CXX11_clang_xray_never_instrument = 4,
9606 : C2x_clang_xray_never_instrument = 5
9607 : };
9608 :
9609 : static XRayInstrumentAttr *CreateImplicit(ASTContext &Ctx, Spelling S, SourceRange Loc = SourceRange()) {
9610 : auto *A = new (Ctx) XRayInstrumentAttr(Loc, Ctx, S);
9611 : A->setImplicit(true);
9612 : return A;
9613 : }
9614 :
9615 : XRayInstrumentAttr(SourceRange R, ASTContext &Ctx
9616 : , unsigned SI
9617 : )
9618 : : InheritableAttr(attr::XRayInstrument, R, SI, false, false)
9619 : {
9620 : }
9621 :
9622 : XRayInstrumentAttr *clone(ASTContext &C) const;
9623 : void printPretty(raw_ostream &OS,
9624 : const PrintingPolicy &Policy) const;
9625 : const char *getSpelling() const;
9626 : Spelling getSemanticSpelling() const {
9627 : switch (SpellingListIndex) {
9628 : default: llvm_unreachable("Unknown spelling list index");
9629 : case 0: return GNU_xray_always_instrument;
9630 : case 1: return CXX11_clang_xray_always_instrument;
9631 : case 2: return C2x_clang_xray_always_instrument;
9632 : case 3: return GNU_xray_never_instrument;
9633 : case 4: return CXX11_clang_xray_never_instrument;
9634 : case 5: return C2x_clang_xray_never_instrument;
9635 : }
9636 : }
9637 73 : bool alwaysXRayInstrument() const { return SpellingListIndex == 0 ||
9638 73 : SpellingListIndex == 1 ||
9639 34 : SpellingListIndex == 2; }
9640 93 : bool neverXRayInstrument() const { return SpellingListIndex == 3 ||
9641 93 : SpellingListIndex == 4 ||
9642 : SpellingListIndex == 5; }
9643 :
9644 :
9645 0 : static bool classof(const Attr *A) { return A->getKind() == attr::XRayInstrument; }
9646 : };
9647 :
9648 : class XRayLogArgsAttr : public InheritableAttr {
9649 : unsigned argumentCount;
9650 :
9651 : public:
9652 : static XRayLogArgsAttr *CreateImplicit(ASTContext &Ctx, unsigned ArgumentCount, SourceRange Loc = SourceRange()) {
9653 : auto *A = new (Ctx) XRayLogArgsAttr(Loc, Ctx, ArgumentCount, 0);
9654 : A->setImplicit(true);
9655 : return A;
9656 : }
9657 :
9658 : XRayLogArgsAttr(SourceRange R, ASTContext &Ctx
9659 : , unsigned ArgumentCount
9660 : , unsigned SI
9661 : )
9662 11 : : InheritableAttr(attr::XRayLogArgs, R, SI, false, false)
9663 11 : , argumentCount(ArgumentCount)
9664 : {
9665 : }
9666 :
9667 : XRayLogArgsAttr *clone(ASTContext &C) const;
9668 : void printPretty(raw_ostream &OS,
9669 : const PrintingPolicy &Policy) const;
9670 : const char *getSpelling() const;
9671 0 : unsigned getArgumentCount() const {
9672 0 : return argumentCount;
9673 : }
9674 :
9675 :
9676 :
9677 0 : static bool classof(const Attr *A) { return A->getKind() == attr::XRayLogArgs; }
9678 : };
9679 :
9680 : #endif // LLVM_CLANG_ATTR_CLASSES_INC
|