Bug Summary

File:build-llvm/tools/clang/include/clang/AST/Attrs.inc
Warning:line 6878, column 5
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name SemaAttr.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -resource-dir /usr/lib/llvm-8/lib/clang/8.0.0 -D CLANG_VENDOR="Debian " -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I /build/llvm-toolchain-snapshot-8~svn350071/build-llvm/tools/clang/lib/Sema -I /build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Sema -I /build/llvm-toolchain-snapshot-8~svn350071/tools/clang/include -I /build/llvm-toolchain-snapshot-8~svn350071/build-llvm/tools/clang/include -I /build/llvm-toolchain-snapshot-8~svn350071/build-llvm/include -I /build/llvm-toolchain-snapshot-8~svn350071/include -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward -internal-isystem /usr/include/clang/8.0.0/include/ -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-8/lib/clang/8.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /build/llvm-toolchain-snapshot-8~svn350071/build-llvm/tools/clang/lib/Sema -fdebug-prefix-map=/build/llvm-toolchain-snapshot-8~svn350071=. -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -stack-protector 2 -fobjc-runtime=gcc -fno-common -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config stable-report-filename=true -o /tmp/scan-build-2018-12-27-042839-1215-1 -x c++ /build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Sema/SemaAttr.cpp -faddrsig

/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Sema/SemaAttr.cpp

1//===--- SemaAttr.cpp - Semantic Analysis for Attributes ------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements semantic analysis for non-trivial attributes and
11// pragmas.
12//
13//===----------------------------------------------------------------------===//
14
15#include "clang/AST/ASTConsumer.h"
16#include "clang/AST/Attr.h"
17#include "clang/AST/Expr.h"
18#include "clang/Basic/TargetInfo.h"
19#include "clang/Lex/Preprocessor.h"
20#include "clang/Sema/Lookup.h"
21#include "clang/Sema/SemaInternal.h"
22using namespace clang;
23
24//===----------------------------------------------------------------------===//
25// Pragma 'pack' and 'options align'
26//===----------------------------------------------------------------------===//
27
28Sema::PragmaStackSentinelRAII::PragmaStackSentinelRAII(Sema &S,
29 StringRef SlotLabel,
30 bool ShouldAct)
31 : S(S), SlotLabel(SlotLabel), ShouldAct(ShouldAct) {
32 if (ShouldAct) {
33 S.VtorDispStack.SentinelAction(PSK_Push, SlotLabel);
34 S.DataSegStack.SentinelAction(PSK_Push, SlotLabel);
35 S.BSSSegStack.SentinelAction(PSK_Push, SlotLabel);
36 S.ConstSegStack.SentinelAction(PSK_Push, SlotLabel);
37 S.CodeSegStack.SentinelAction(PSK_Push, SlotLabel);
38 }
39}
40
41Sema::PragmaStackSentinelRAII::~PragmaStackSentinelRAII() {
42 if (ShouldAct) {
43 S.VtorDispStack.SentinelAction(PSK_Pop, SlotLabel);
44 S.DataSegStack.SentinelAction(PSK_Pop, SlotLabel);
45 S.BSSSegStack.SentinelAction(PSK_Pop, SlotLabel);
46 S.ConstSegStack.SentinelAction(PSK_Pop, SlotLabel);
47 S.CodeSegStack.SentinelAction(PSK_Pop, SlotLabel);
48 }
49}
50
51void Sema::AddAlignmentAttributesForRecord(RecordDecl *RD) {
52 // If there is no pack value, we don't need any attributes.
53 if (!PackStack.CurrentValue)
54 return;
55
56 // Otherwise, check to see if we need a max field alignment attribute.
57 if (unsigned Alignment = PackStack.CurrentValue) {
58 if (Alignment == Sema::kMac68kAlignmentSentinel)
59 RD->addAttr(AlignMac68kAttr::CreateImplicit(Context));
60 else
61 RD->addAttr(MaxFieldAlignmentAttr::CreateImplicit(Context,
62 Alignment * 8));
63 }
64 if (PackIncludeStack.empty())
65 return;
66 // The #pragma pack affected a record in an included file, so Clang should
67 // warn when that pragma was written in a file that included the included
68 // file.
69 for (auto &PackedInclude : llvm::reverse(PackIncludeStack)) {
70 if (PackedInclude.CurrentPragmaLocation != PackStack.CurrentPragmaLocation)
71 break;
72 if (PackedInclude.HasNonDefaultValue)
73 PackedInclude.ShouldWarnOnInclude = true;
74 }
75}
76
77void Sema::AddMsStructLayoutForRecord(RecordDecl *RD) {
78 if (MSStructPragmaOn)
79 RD->addAttr(MSStructAttr::CreateImplicit(Context));
80
81 // FIXME: We should merge AddAlignmentAttributesForRecord with
82 // AddMsStructLayoutForRecord into AddPragmaAttributesForRecord, which takes
83 // all active pragmas and applies them as attributes to class definitions.
84 if (VtorDispStack.CurrentValue != getLangOpts().VtorDispMode)
85 RD->addAttr(
86 MSVtorDispAttr::CreateImplicit(Context, VtorDispStack.CurrentValue));
87}
88
89void Sema::ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind,
90 SourceLocation PragmaLoc) {
91 PragmaMsStackAction Action = Sema::PSK_Reset;
92 unsigned Alignment = 0;
93 switch (Kind) {
94 // For all targets we support native and natural are the same.
95 //
96 // FIXME: This is not true on Darwin/PPC.
97 case POAK_Native:
98 case POAK_Power:
99 case POAK_Natural:
100 Action = Sema::PSK_Push_Set;
101 Alignment = 0;
102 break;
103
104 // Note that '#pragma options align=packed' is not equivalent to attribute
105 // packed, it has a different precedence relative to attribute aligned.
106 case POAK_Packed:
107 Action = Sema::PSK_Push_Set;
108 Alignment = 1;
109 break;
110
111 case POAK_Mac68k:
112 // Check if the target supports this.
113 if (!this->Context.getTargetInfo().hasAlignMac68kSupport()) {
114 Diag(PragmaLoc, diag::err_pragma_options_align_mac68k_target_unsupported);
115 return;
116 }
117 Action = Sema::PSK_Push_Set;
118 Alignment = Sema::kMac68kAlignmentSentinel;
119 break;
120
121 case POAK_Reset:
122 // Reset just pops the top of the stack, or resets the current alignment to
123 // default.
124 Action = Sema::PSK_Pop;
125 if (PackStack.Stack.empty()) {
126 if (PackStack.CurrentValue) {
127 Action = Sema::PSK_Reset;
128 } else {
129 Diag(PragmaLoc, diag::warn_pragma_options_align_reset_failed)
130 << "stack empty";
131 return;
132 }
133 }
134 break;
135 }
136
137 PackStack.Act(PragmaLoc, Action, StringRef(), Alignment);
138}
139
140void Sema::ActOnPragmaClangSection(SourceLocation PragmaLoc, PragmaClangSectionAction Action,
141 PragmaClangSectionKind SecKind, StringRef SecName) {
142 PragmaClangSection *CSec;
143 switch (SecKind) {
144 case PragmaClangSectionKind::PCSK_BSS:
145 CSec = &PragmaClangBSSSection;
146 break;
147 case PragmaClangSectionKind::PCSK_Data:
148 CSec = &PragmaClangDataSection;
149 break;
150 case PragmaClangSectionKind::PCSK_Rodata:
151 CSec = &PragmaClangRodataSection;
152 break;
153 case PragmaClangSectionKind::PCSK_Text:
154 CSec = &PragmaClangTextSection;
155 break;
156 default:
157 llvm_unreachable("invalid clang section kind")::llvm::llvm_unreachable_internal("invalid clang section kind"
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Sema/SemaAttr.cpp"
, 157)
;
158 }
159
160 if (Action == PragmaClangSectionAction::PCSA_Clear) {
161 CSec->Valid = false;
162 return;
163 }
164
165 CSec->Valid = true;
166 CSec->SectionName = SecName;
167 CSec->PragmaLocation = PragmaLoc;
168}
169
170void Sema::ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action,
171 StringRef SlotLabel, Expr *alignment) {
172 Expr *Alignment = static_cast<Expr *>(alignment);
173
174 // If specified then alignment must be a "small" power of two.
175 unsigned AlignmentVal = 0;
176 if (Alignment) {
177 llvm::APSInt Val;
178
179 // pack(0) is like pack(), which just works out since that is what
180 // we use 0 for in PackAttr.
181 if (Alignment->isTypeDependent() ||
182 Alignment->isValueDependent() ||
183 !Alignment->isIntegerConstantExpr(Val, Context) ||
184 !(Val == 0 || Val.isPowerOf2()) ||
185 Val.getZExtValue() > 16) {
186 Diag(PragmaLoc, diag::warn_pragma_pack_invalid_alignment);
187 return; // Ignore
188 }
189
190 AlignmentVal = (unsigned) Val.getZExtValue();
191 }
192 if (Action == Sema::PSK_Show) {
193 // Show the current alignment, making sure to show the right value
194 // for the default.
195 // FIXME: This should come from the target.
196 AlignmentVal = PackStack.CurrentValue;
197 if (AlignmentVal == 0)
198 AlignmentVal = 8;
199 if (AlignmentVal == Sema::kMac68kAlignmentSentinel)
200 Diag(PragmaLoc, diag::warn_pragma_pack_show) << "mac68k";
201 else
202 Diag(PragmaLoc, diag::warn_pragma_pack_show) << AlignmentVal;
203 }
204 // MSDN, C/C++ Preprocessor Reference > Pragma Directives > pack:
205 // "#pragma pack(pop, identifier, n) is undefined"
206 if (Action & Sema::PSK_Pop) {
207 if (Alignment && !SlotLabel.empty())
208 Diag(PragmaLoc, diag::warn_pragma_pack_pop_identifier_and_alignment);
209 if (PackStack.Stack.empty())
210 Diag(PragmaLoc, diag::warn_pragma_pop_failed) << "pack" << "stack empty";
211 }
212
213 PackStack.Act(PragmaLoc, Action, SlotLabel, AlignmentVal);
214}
215
216void Sema::DiagnoseNonDefaultPragmaPack(PragmaPackDiagnoseKind Kind,
217 SourceLocation IncludeLoc) {
218 if (Kind == PragmaPackDiagnoseKind::NonDefaultStateAtInclude) {
219 SourceLocation PrevLocation = PackStack.CurrentPragmaLocation;
220 // Warn about non-default alignment at #includes (without redundant
221 // warnings for the same directive in nested includes).
222 // The warning is delayed until the end of the file to avoid warnings
223 // for files that don't have any records that are affected by the modified
224 // alignment.
225 bool HasNonDefaultValue =
226 PackStack.hasValue() &&
227 (PackIncludeStack.empty() ||
228 PackIncludeStack.back().CurrentPragmaLocation != PrevLocation);
229 PackIncludeStack.push_back(
230 {PackStack.CurrentValue,
231 PackStack.hasValue() ? PrevLocation : SourceLocation(),
232 HasNonDefaultValue, /*ShouldWarnOnInclude*/ false});
233 return;
234 }
235
236 assert(Kind == PragmaPackDiagnoseKind::ChangedStateAtExit && "invalid kind")((Kind == PragmaPackDiagnoseKind::ChangedStateAtExit &&
"invalid kind") ? static_cast<void> (0) : __assert_fail
("Kind == PragmaPackDiagnoseKind::ChangedStateAtExit && \"invalid kind\""
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Sema/SemaAttr.cpp"
, 236, __PRETTY_FUNCTION__))
;
237 PackIncludeState PrevPackState = PackIncludeStack.pop_back_val();
238 if (PrevPackState.ShouldWarnOnInclude) {
239 // Emit the delayed non-default alignment at #include warning.
240 Diag(IncludeLoc, diag::warn_pragma_pack_non_default_at_include);
241 Diag(PrevPackState.CurrentPragmaLocation, diag::note_pragma_pack_here);
242 }
243 // Warn about modified alignment after #includes.
244 if (PrevPackState.CurrentValue != PackStack.CurrentValue) {
245 Diag(IncludeLoc, diag::warn_pragma_pack_modified_after_include);
246 Diag(PackStack.CurrentPragmaLocation, diag::note_pragma_pack_here);
247 }
248}
249
250void Sema::DiagnoseUnterminatedPragmaPack() {
251 if (PackStack.Stack.empty())
252 return;
253 bool IsInnermost = true;
254 for (const auto &StackSlot : llvm::reverse(PackStack.Stack)) {
255 Diag(StackSlot.PragmaPushLocation, diag::warn_pragma_pack_no_pop_eof);
256 // The user might have already reset the alignment, so suggest replacing
257 // the reset with a pop.
258 if (IsInnermost && PackStack.CurrentValue == PackStack.DefaultValue) {
259 DiagnosticBuilder DB = Diag(PackStack.CurrentPragmaLocation,
260 diag::note_pragma_pack_pop_instead_reset);
261 SourceLocation FixItLoc = Lexer::findLocationAfterToken(
262 PackStack.CurrentPragmaLocation, tok::l_paren, SourceMgr, LangOpts,
263 /*SkipTrailing=*/false);
264 if (FixItLoc.isValid())
265 DB << FixItHint::CreateInsertion(FixItLoc, "pop");
266 }
267 IsInnermost = false;
268 }
269}
270
271void Sema::ActOnPragmaMSStruct(PragmaMSStructKind Kind) {
272 MSStructPragmaOn = (Kind == PMSST_ON);
273}
274
275void Sema::ActOnPragmaMSComment(SourceLocation CommentLoc,
276 PragmaMSCommentKind Kind, StringRef Arg) {
277 auto *PCD = PragmaCommentDecl::Create(
278 Context, Context.getTranslationUnitDecl(), CommentLoc, Kind, Arg);
279 Context.getTranslationUnitDecl()->addDecl(PCD);
280 Consumer.HandleTopLevelDecl(DeclGroupRef(PCD));
281}
282
283void Sema::ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name,
284 StringRef Value) {
285 auto *PDMD = PragmaDetectMismatchDecl::Create(
286 Context, Context.getTranslationUnitDecl(), Loc, Name, Value);
287 Context.getTranslationUnitDecl()->addDecl(PDMD);
288 Consumer.HandleTopLevelDecl(DeclGroupRef(PDMD));
289}
290
291void Sema::ActOnPragmaMSPointersToMembers(
292 LangOptions::PragmaMSPointersToMembersKind RepresentationMethod,
293 SourceLocation PragmaLoc) {
294 MSPointerToMemberRepresentationMethod = RepresentationMethod;
295 ImplicitMSInheritanceAttrLoc = PragmaLoc;
296}
297
298void Sema::ActOnPragmaMSVtorDisp(PragmaMsStackAction Action,
299 SourceLocation PragmaLoc,
300 MSVtorDispAttr::Mode Mode) {
301 if (Action & PSK_Pop && VtorDispStack.Stack.empty())
302 Diag(PragmaLoc, diag::warn_pragma_pop_failed) << "vtordisp"
303 << "stack empty";
304 VtorDispStack.Act(PragmaLoc, Action, StringRef(), Mode);
305}
306
307template<typename ValueType>
308void Sema::PragmaStack<ValueType>::Act(SourceLocation PragmaLocation,
309 PragmaMsStackAction Action,
310 llvm::StringRef StackSlotLabel,
311 ValueType Value) {
312 if (Action == PSK_Reset) {
313 CurrentValue = DefaultValue;
314 CurrentPragmaLocation = PragmaLocation;
315 return;
316 }
317 if (Action & PSK_Push)
318 Stack.emplace_back(StackSlotLabel, CurrentValue, CurrentPragmaLocation,
319 PragmaLocation);
320 else if (Action & PSK_Pop) {
321 if (!StackSlotLabel.empty()) {
322 // If we've got a label, try to find it and jump there.
323 auto I = llvm::find_if(llvm::reverse(Stack), [&](const Slot &x) {
324 return x.StackSlotLabel == StackSlotLabel;
325 });
326 // If we found the label so pop from there.
327 if (I != Stack.rend()) {
328 CurrentValue = I->Value;
329 CurrentPragmaLocation = I->PragmaLocation;
330 Stack.erase(std::prev(I.base()), Stack.end());
331 }
332 } else if (!Stack.empty()) {
333 // We do not have a label, just pop the last entry.
334 CurrentValue = Stack.back().Value;
335 CurrentPragmaLocation = Stack.back().PragmaLocation;
336 Stack.pop_back();
337 }
338 }
339 if (Action & PSK_Set) {
340 CurrentValue = Value;
341 CurrentPragmaLocation = PragmaLocation;
342 }
343}
344
345bool Sema::UnifySection(StringRef SectionName,
346 int SectionFlags,
347 DeclaratorDecl *Decl) {
348 auto Section = Context.SectionInfos.find(SectionName);
349 if (Section == Context.SectionInfos.end()) {
350 Context.SectionInfos[SectionName] =
351 ASTContext::SectionInfo(Decl, SourceLocation(), SectionFlags);
352 return false;
353 }
354 // A pre-declared section takes precedence w/o diagnostic.
355 if (Section->second.SectionFlags == SectionFlags ||
356 !(Section->second.SectionFlags & ASTContext::PSF_Implicit))
357 return false;
358 auto OtherDecl = Section->second.Decl;
359 Diag(Decl->getLocation(), diag::err_section_conflict)
360 << Decl << OtherDecl;
361 Diag(OtherDecl->getLocation(), diag::note_declared_at)
362 << OtherDecl->getName();
363 if (auto A = Decl->getAttr<SectionAttr>())
364 if (A->isImplicit())
365 Diag(A->getLocation(), diag::note_pragma_entered_here);
366 if (auto A = OtherDecl->getAttr<SectionAttr>())
367 if (A->isImplicit())
368 Diag(A->getLocation(), diag::note_pragma_entered_here);
369 return true;
370}
371
372bool Sema::UnifySection(StringRef SectionName,
373 int SectionFlags,
374 SourceLocation PragmaSectionLocation) {
375 auto Section = Context.SectionInfos.find(SectionName);
376 if (Section != Context.SectionInfos.end()) {
377 if (Section->second.SectionFlags == SectionFlags)
378 return false;
379 if (!(Section->second.SectionFlags & ASTContext::PSF_Implicit)) {
380 Diag(PragmaSectionLocation, diag::err_section_conflict)
381 << "this" << "a prior #pragma section";
382 Diag(Section->second.PragmaSectionLocation,
383 diag::note_pragma_entered_here);
384 return true;
385 }
386 }
387 Context.SectionInfos[SectionName] =
388 ASTContext::SectionInfo(nullptr, PragmaSectionLocation, SectionFlags);
389 return false;
390}
391
392/// Called on well formed \#pragma bss_seg().
393void Sema::ActOnPragmaMSSeg(SourceLocation PragmaLocation,
394 PragmaMsStackAction Action,
395 llvm::StringRef StackSlotLabel,
396 StringLiteral *SegmentName,
397 llvm::StringRef PragmaName) {
398 PragmaStack<StringLiteral *> *Stack =
399 llvm::StringSwitch<PragmaStack<StringLiteral *> *>(PragmaName)
400 .Case("data_seg", &DataSegStack)
401 .Case("bss_seg", &BSSSegStack)
402 .Case("const_seg", &ConstSegStack)
403 .Case("code_seg", &CodeSegStack);
404 if (Action & PSK_Pop && Stack->Stack.empty())
405 Diag(PragmaLocation, diag::warn_pragma_pop_failed) << PragmaName
406 << "stack empty";
407 if (SegmentName &&
408 !checkSectionName(SegmentName->getBeginLoc(), SegmentName->getString()))
409 return;
410 Stack->Act(PragmaLocation, Action, StackSlotLabel, SegmentName);
411}
412
413/// Called on well formed \#pragma bss_seg().
414void Sema::ActOnPragmaMSSection(SourceLocation PragmaLocation,
415 int SectionFlags, StringLiteral *SegmentName) {
416 UnifySection(SegmentName->getString(), SectionFlags, PragmaLocation);
417}
418
419void Sema::ActOnPragmaMSInitSeg(SourceLocation PragmaLocation,
420 StringLiteral *SegmentName) {
421 // There's no stack to maintain, so we just have a current section. When we
422 // see the default section, reset our current section back to null so we stop
423 // tacking on unnecessary attributes.
424 CurInitSeg = SegmentName->getString() == ".CRT$XCU" ? nullptr : SegmentName;
425 CurInitSegLoc = PragmaLocation;
426}
427
428void Sema::ActOnPragmaUnused(const Token &IdTok, Scope *curScope,
429 SourceLocation PragmaLoc) {
430
431 IdentifierInfo *Name = IdTok.getIdentifierInfo();
432 LookupResult Lookup(*this, Name, IdTok.getLocation(), LookupOrdinaryName);
433 LookupParsedName(Lookup, curScope, nullptr, true);
434
435 if (Lookup.empty()) {
436 Diag(PragmaLoc, diag::warn_pragma_unused_undeclared_var)
437 << Name << SourceRange(IdTok.getLocation());
438 return;
439 }
440
441 VarDecl *VD = Lookup.getAsSingle<VarDecl>();
442 if (!VD) {
443 Diag(PragmaLoc, diag::warn_pragma_unused_expected_var_arg)
444 << Name << SourceRange(IdTok.getLocation());
445 return;
446 }
447
448 // Warn if this was used before being marked unused.
449 if (VD->isUsed())
450 Diag(PragmaLoc, diag::warn_used_but_marked_unused) << Name;
451
452 VD->addAttr(UnusedAttr::CreateImplicit(Context, UnusedAttr::GNU_unused,
453 IdTok.getLocation()));
454}
455
456void Sema::AddCFAuditedAttribute(Decl *D) {
457 SourceLocation Loc = PP.getPragmaARCCFCodeAuditedLoc();
458 if (!Loc.isValid()) return;
459
460 // Don't add a redundant or conflicting attribute.
461 if (D->hasAttr<CFAuditedTransferAttr>() ||
462 D->hasAttr<CFUnknownTransferAttr>())
463 return;
464
465 D->addAttr(CFAuditedTransferAttr::CreateImplicit(Context, Loc));
466}
467
468namespace {
469
470Optional<attr::SubjectMatchRule>
471getParentAttrMatcherRule(attr::SubjectMatchRule Rule) {
472 using namespace attr;
473 switch (Rule) {
474 default:
475 return None;
476#define ATTR_MATCH_RULE(Value, Spelling, IsAbstract)
477#define ATTR_MATCH_SUB_RULE(Value, Spelling, IsAbstract, Parent, IsNegated) \
478 case Value: \
479 return Parent;
480#include "clang/Basic/AttrSubMatchRulesList.inc"
481 }
482}
483
484bool isNegatedAttrMatcherSubRule(attr::SubjectMatchRule Rule) {
485 using namespace attr;
486 switch (Rule) {
487 default:
488 return false;
489#define ATTR_MATCH_RULE(Value, Spelling, IsAbstract)
490#define ATTR_MATCH_SUB_RULE(Value, Spelling, IsAbstract, Parent, IsNegated) \
491 case Value: \
492 return IsNegated;
493#include "clang/Basic/AttrSubMatchRulesList.inc"
494 }
495}
496
497CharSourceRange replacementRangeForListElement(const Sema &S,
498 SourceRange Range) {
499 // Make sure that the ',' is removed as well.
500 SourceLocation AfterCommaLoc = Lexer::findLocationAfterToken(
501 Range.getEnd(), tok::comma, S.getSourceManager(), S.getLangOpts(),
502 /*SkipTrailingWhitespaceAndNewLine=*/false);
503 if (AfterCommaLoc.isValid())
504 return CharSourceRange::getCharRange(Range.getBegin(), AfterCommaLoc);
505 else
506 return CharSourceRange::getTokenRange(Range);
507}
508
509std::string
510attrMatcherRuleListToString(ArrayRef<attr::SubjectMatchRule> Rules) {
511 std::string Result;
512 llvm::raw_string_ostream OS(Result);
513 for (const auto &I : llvm::enumerate(Rules)) {
514 if (I.index())
515 OS << (I.index() == Rules.size() - 1 ? ", and " : ", ");
516 OS << "'" << attr::getSubjectMatchRuleSpelling(I.value()) << "'";
517 }
518 return OS.str();
519}
520
521} // end anonymous namespace
522
523void Sema::ActOnPragmaAttributeAttribute(
524 ParsedAttr &Attribute, SourceLocation PragmaLoc,
525 attr::ParsedSubjectMatchRuleSet Rules) {
526 SmallVector<attr::SubjectMatchRule, 4> SubjectMatchRules;
527 // Gather the subject match rules that are supported by the attribute.
528 SmallVector<std::pair<attr::SubjectMatchRule, bool>, 4>
529 StrictSubjectMatchRuleSet;
530 Attribute.getMatchRules(LangOpts, StrictSubjectMatchRuleSet);
531
532 // Figure out which subject matching rules are valid.
533 if (StrictSubjectMatchRuleSet.empty()) {
534 // Check for contradicting match rules. Contradicting match rules are
535 // either:
536 // - a top-level rule and one of its sub-rules. E.g. variable and
537 // variable(is_parameter).
538 // - a sub-rule and a sibling that's negated. E.g.
539 // variable(is_thread_local) and variable(unless(is_parameter))
540 llvm::SmallDenseMap<int, std::pair<int, SourceRange>, 2>
541 RulesToFirstSpecifiedNegatedSubRule;
542 for (const auto &Rule : Rules) {
543 attr::SubjectMatchRule MatchRule = attr::SubjectMatchRule(Rule.first);
544 Optional<attr::SubjectMatchRule> ParentRule =
545 getParentAttrMatcherRule(MatchRule);
546 if (!ParentRule)
547 continue;
548 auto It = Rules.find(*ParentRule);
549 if (It != Rules.end()) {
550 // A sub-rule contradicts a parent rule.
551 Diag(Rule.second.getBegin(),
552 diag::err_pragma_attribute_matcher_subrule_contradicts_rule)
553 << attr::getSubjectMatchRuleSpelling(MatchRule)
554 << attr::getSubjectMatchRuleSpelling(*ParentRule) << It->second
555 << FixItHint::CreateRemoval(
556 replacementRangeForListElement(*this, Rule.second));
557 // Keep going without removing this rule as it won't change the set of
558 // declarations that receive the attribute.
559 continue;
560 }
561 if (isNegatedAttrMatcherSubRule(MatchRule))
562 RulesToFirstSpecifiedNegatedSubRule.insert(
563 std::make_pair(*ParentRule, Rule));
564 }
565 bool IgnoreNegatedSubRules = false;
566 for (const auto &Rule : Rules) {
567 attr::SubjectMatchRule MatchRule = attr::SubjectMatchRule(Rule.first);
568 Optional<attr::SubjectMatchRule> ParentRule =
569 getParentAttrMatcherRule(MatchRule);
570 if (!ParentRule)
571 continue;
572 auto It = RulesToFirstSpecifiedNegatedSubRule.find(*ParentRule);
573 if (It != RulesToFirstSpecifiedNegatedSubRule.end() &&
574 It->second != Rule) {
575 // Negated sub-rule contradicts another sub-rule.
576 Diag(
577 It->second.second.getBegin(),
578 diag::
579 err_pragma_attribute_matcher_negated_subrule_contradicts_subrule)
580 << attr::getSubjectMatchRuleSpelling(
581 attr::SubjectMatchRule(It->second.first))
582 << attr::getSubjectMatchRuleSpelling(MatchRule) << Rule.second
583 << FixItHint::CreateRemoval(
584 replacementRangeForListElement(*this, It->second.second));
585 // Keep going but ignore all of the negated sub-rules.
586 IgnoreNegatedSubRules = true;
587 RulesToFirstSpecifiedNegatedSubRule.erase(It);
588 }
589 }
590
591 if (!IgnoreNegatedSubRules) {
592 for (const auto &Rule : Rules)
593 SubjectMatchRules.push_back(attr::SubjectMatchRule(Rule.first));
594 } else {
595 for (const auto &Rule : Rules) {
596 if (!isNegatedAttrMatcherSubRule(attr::SubjectMatchRule(Rule.first)))
597 SubjectMatchRules.push_back(attr::SubjectMatchRule(Rule.first));
598 }
599 }
600 Rules.clear();
601 } else {
602 for (const auto &Rule : StrictSubjectMatchRuleSet) {
603 if (Rules.erase(Rule.first)) {
604 // Add the rule to the set of attribute receivers only if it's supported
605 // in the current language mode.
606 if (Rule.second)
607 SubjectMatchRules.push_back(Rule.first);
608 }
609 }
610 }
611
612 if (!Rules.empty()) {
613 auto Diagnostic =
614 Diag(PragmaLoc, diag::err_pragma_attribute_invalid_matchers)
615 << Attribute.getName();
616 SmallVector<attr::SubjectMatchRule, 2> ExtraRules;
617 for (const auto &Rule : Rules) {
618 ExtraRules.push_back(attr::SubjectMatchRule(Rule.first));
619 Diagnostic << FixItHint::CreateRemoval(
620 replacementRangeForListElement(*this, Rule.second));
621 }
622 Diagnostic << attrMatcherRuleListToString(ExtraRules);
623 }
624
625 if (PragmaAttributeStack.empty()) {
626 Diag(PragmaLoc, diag::err_pragma_attr_attr_no_push);
627 return;
628 }
629
630 PragmaAttributeStack.back().Entries.push_back(
631 {PragmaLoc, &Attribute, std::move(SubjectMatchRules), /*IsUsed=*/false});
632}
633
634void Sema::ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc,
635 const IdentifierInfo *Namespace) {
636 PragmaAttributeStack.emplace_back();
637 PragmaAttributeStack.back().Loc = PragmaLoc;
638 PragmaAttributeStack.back().Namespace = Namespace;
639}
640
641void Sema::ActOnPragmaAttributePop(SourceLocation PragmaLoc,
642 const IdentifierInfo *Namespace) {
643 if (PragmaAttributeStack.empty()) {
644 Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch) << 1;
645 return;
646 }
647
648 // Dig back through the stack trying to find the most recently pushed group
649 // that in Namespace. Note that this works fine if no namespace is present,
650 // think of push/pops without namespaces as having an implicit "nullptr"
651 // namespace.
652 for (size_t Index = PragmaAttributeStack.size(); Index;) {
653 --Index;
654 if (PragmaAttributeStack[Index].Namespace == Namespace) {
655 for (const PragmaAttributeEntry &Entry :
656 PragmaAttributeStack[Index].Entries) {
657 if (!Entry.IsUsed) {
658 assert(Entry.Attribute && "Expected an attribute")((Entry.Attribute && "Expected an attribute") ? static_cast
<void> (0) : __assert_fail ("Entry.Attribute && \"Expected an attribute\""
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Sema/SemaAttr.cpp"
, 658, __PRETTY_FUNCTION__))
;
659 Diag(Entry.Attribute->getLoc(), diag::warn_pragma_attribute_unused)
660 << *Entry.Attribute;
661 Diag(PragmaLoc, diag::note_pragma_attribute_region_ends_here);
662 }
663 }
664 PragmaAttributeStack.erase(PragmaAttributeStack.begin() + Index);
665 return;
666 }
667 }
668
669 if (Namespace)
670 Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch)
671 << 0 << Namespace->getName();
672 else
673 Diag(PragmaLoc, diag::err_pragma_attribute_stack_mismatch) << 1;
674}
675
676void Sema::AddPragmaAttributes(Scope *S, Decl *D) {
677 if (PragmaAttributeStack.empty())
678 return;
679 for (auto &Group : PragmaAttributeStack) {
680 for (auto &Entry : Group.Entries) {
681 ParsedAttr *Attribute = Entry.Attribute;
682 assert(Attribute && "Expected an attribute")((Attribute && "Expected an attribute") ? static_cast
<void> (0) : __assert_fail ("Attribute && \"Expected an attribute\""
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Sema/SemaAttr.cpp"
, 682, __PRETTY_FUNCTION__))
;
683
684 // Ensure that the attribute can be applied to the given declaration.
685 bool Applies = false;
686 for (const auto &Rule : Entry.MatchRules) {
687 if (Attribute->appliesToDecl(D, Rule)) {
688 Applies = true;
689 break;
690 }
691 }
692 if (!Applies)
693 continue;
694 Entry.IsUsed = true;
695 PragmaAttributeCurrentTargetDecl = D;
696 ParsedAttributesView Attrs;
697 Attrs.addAtEnd(Attribute);
698 ProcessDeclAttributeList(S, D, Attrs);
699 PragmaAttributeCurrentTargetDecl = nullptr;
700 }
701 }
702}
703
704void Sema::PrintPragmaAttributeInstantiationPoint() {
705 assert(PragmaAttributeCurrentTargetDecl && "Expected an active declaration")((PragmaAttributeCurrentTargetDecl && "Expected an active declaration"
) ? static_cast<void> (0) : __assert_fail ("PragmaAttributeCurrentTargetDecl && \"Expected an active declaration\""
, "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/Sema/SemaAttr.cpp"
, 705, __PRETTY_FUNCTION__))
;
706 Diags.Report(PragmaAttributeCurrentTargetDecl->getBeginLoc(),
707 diag::note_pragma_attribute_applied_decl_here);
708}
709
710void Sema::DiagnoseUnterminatedPragmaAttribute() {
711 if (PragmaAttributeStack.empty())
712 return;
713 Diag(PragmaAttributeStack.back().Loc, diag::err_pragma_attribute_no_pop_eof);
714}
715
716void Sema::ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc) {
717 if(On)
718 OptimizeOffPragmaLocation = SourceLocation();
719 else
720 OptimizeOffPragmaLocation = PragmaLoc;
721}
722
723void Sema::AddRangeBasedOptnone(FunctionDecl *FD) {
724 // In the future, check other pragmas if they're implemented (e.g. pragma
725 // optimize 0 will probably map to this functionality too).
726 if(OptimizeOffPragmaLocation.isValid())
1
Taking true branch
727 AddOptnoneAttributeIfNoConflicts(FD, OptimizeOffPragmaLocation);
2
Calling 'Sema::AddOptnoneAttributeIfNoConflicts'
728}
729
730void Sema::AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD,
731 SourceLocation Loc) {
732 // Don't add a conflicting attribute. No diagnostic is needed.
733 if (FD->hasAttr<MinSizeAttr>() || FD->hasAttr<AlwaysInlineAttr>())
3
Taking false branch
734 return;
735
736 // Add attributes only if required. Optnone requires noinline as well, but if
737 // either is already present then don't bother adding them.
738 if (!FD->hasAttr<OptimizeNoneAttr>())
4
Taking true branch
739 FD->addAttr(OptimizeNoneAttr::CreateImplicit(Context, Loc));
5
Calling 'OptimizeNoneAttr::CreateImplicit'
740 if (!FD->hasAttr<NoInlineAttr>())
741 FD->addAttr(NoInlineAttr::CreateImplicit(Context, Loc));
742}
743
744typedef std::vector<std::pair<unsigned, SourceLocation> > VisStack;
745enum : unsigned { NoVisibility = ~0U };
746
747void Sema::AddPushedVisibilityAttribute(Decl *D) {
748 if (!VisContext)
749 return;
750
751 NamedDecl *ND = dyn_cast<NamedDecl>(D);
752 if (ND && ND->getExplicitVisibility(NamedDecl::VisibilityForValue))
753 return;
754
755 VisStack *Stack = static_cast<VisStack*>(VisContext);
756 unsigned rawType = Stack->back().first;
757 if (rawType == NoVisibility) return;
758
759 VisibilityAttr::VisibilityType type
760 = (VisibilityAttr::VisibilityType) rawType;
761 SourceLocation loc = Stack->back().second;
762
763 D->addAttr(VisibilityAttr::CreateImplicit(Context, type, loc));
764}
765
766/// FreeVisContext - Deallocate and null out VisContext.
767void Sema::FreeVisContext() {
768 delete static_cast<VisStack*>(VisContext);
769 VisContext = nullptr;
770}
771
772static void PushPragmaVisibility(Sema &S, unsigned type, SourceLocation loc) {
773 // Put visibility on stack.
774 if (!S.VisContext)
775 S.VisContext = new VisStack;
776
777 VisStack *Stack = static_cast<VisStack*>(S.VisContext);
778 Stack->push_back(std::make_pair(type, loc));
779}
780
781void Sema::ActOnPragmaVisibility(const IdentifierInfo* VisType,
782 SourceLocation PragmaLoc) {
783 if (VisType) {
784 // Compute visibility to use.
785 VisibilityAttr::VisibilityType T;
786 if (!VisibilityAttr::ConvertStrToVisibilityType(VisType->getName(), T)) {
787 Diag(PragmaLoc, diag::warn_attribute_unknown_visibility) << VisType;
788 return;
789 }
790 PushPragmaVisibility(*this, T, PragmaLoc);
791 } else {
792 PopPragmaVisibility(false, PragmaLoc);
793 }
794}
795
796void Sema::ActOnPragmaFPContract(LangOptions::FPContractModeKind FPC) {
797 switch (FPC) {
798 case LangOptions::FPC_On:
799 FPFeatures.setAllowFPContractWithinStatement();
800 break;
801 case LangOptions::FPC_Fast:
802 FPFeatures.setAllowFPContractAcrossStatement();
803 break;
804 case LangOptions::FPC_Off:
805 FPFeatures.setDisallowFPContract();
806 break;
807 }
808}
809
810void Sema::ActOnPragmaFEnvAccess(LangOptions::FEnvAccessModeKind FPC) {
811 switch (FPC) {
812 case LangOptions::FEA_On:
813 FPFeatures.setAllowFEnvAccess();
814 break;
815 case LangOptions::FEA_Off:
816 FPFeatures.setDisallowFEnvAccess();
817 break;
818 }
819}
820
821
822void Sema::PushNamespaceVisibilityAttr(const VisibilityAttr *Attr,
823 SourceLocation Loc) {
824 // Visibility calculations will consider the namespace's visibility.
825 // Here we just want to note that we're in a visibility context
826 // which overrides any enclosing #pragma context, but doesn't itself
827 // contribute visibility.
828 PushPragmaVisibility(*this, NoVisibility, Loc);
829}
830
831void Sema::PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc) {
832 if (!VisContext) {
833 Diag(EndLoc, diag::err_pragma_pop_visibility_mismatch);
834 return;
835 }
836
837 // Pop visibility from stack
838 VisStack *Stack = static_cast<VisStack*>(VisContext);
839
840 const std::pair<unsigned, SourceLocation> *Back = &Stack->back();
841 bool StartsWithPragma = Back->first != NoVisibility;
842 if (StartsWithPragma && IsNamespaceEnd) {
843 Diag(Back->second, diag::err_pragma_push_visibility_mismatch);
844 Diag(EndLoc, diag::note_surrounding_namespace_ends_here);
845
846 // For better error recovery, eat all pushes inside the namespace.
847 do {
848 Stack->pop_back();
849 Back = &Stack->back();
850 StartsWithPragma = Back->first != NoVisibility;
851 } while (StartsWithPragma);
852 } else if (!StartsWithPragma && !IsNamespaceEnd) {
853 Diag(EndLoc, diag::err_pragma_pop_visibility_mismatch);
854 Diag(Back->second, diag::note_surrounding_namespace_starts_here);
855 return;
856 }
857
858 Stack->pop_back();
859 // To simplify the implementation, never keep around an empty stack.
860 if (Stack->empty())
861 FreeVisContext();
862}

/build/llvm-toolchain-snapshot-8~svn350071/build-llvm/tools/clang/include/clang/AST/Attrs.inc

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