Bug Summary

File:build-llvm/tools/clang/include/clang/AST/Attrs.inc
Warning:line 6131, 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 SemaStmtAttr.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-eagerly-assume -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 -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-7/lib/clang/7.0.0 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I /build/llvm-toolchain-snapshot-7~svn337204/build-llvm/tools/clang/lib/Sema -I /build/llvm-toolchain-snapshot-7~svn337204/tools/clang/lib/Sema -I /build/llvm-toolchain-snapshot-7~svn337204/tools/clang/include -I /build/llvm-toolchain-snapshot-7~svn337204/build-llvm/tools/clang/include -I /build/llvm-toolchain-snapshot-7~svn337204/build-llvm/include -I /build/llvm-toolchain-snapshot-7~svn337204/include -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/backward -internal-isystem /usr/include/clang/7.0.0/include/ -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-7/lib/clang/7.0.0/include -internal-externc-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.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-7~svn337204/build-llvm/tools/clang/lib/Sema -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -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-07-17-043059-5239-1 -x c++ /build/llvm-toolchain-snapshot-7~svn337204/tools/clang/lib/Sema/SemaStmtAttr.cpp

/build/llvm-toolchain-snapshot-7~svn337204/tools/clang/lib/Sema/SemaStmtAttr.cpp

1//===--- SemaStmtAttr.cpp - Statement Attribute Handling ------------------===//
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 stmt-related attribute processing.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/Sema/SemaInternal.h"
15#include "clang/AST/ASTContext.h"
16#include "clang/Basic/SourceManager.h"
17#include "clang/Sema/DelayedDiagnostic.h"
18#include "clang/Sema/Lookup.h"
19#include "clang/Sema/LoopHint.h"
20#include "clang/Sema/ScopeInfo.h"
21#include "llvm/ADT/StringExtras.h"
22
23using namespace clang;
24using namespace sema;
25
26static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const ParsedAttr &A,
27 SourceRange Range) {
28 FallThroughAttr Attr(A.getRange(), S.Context,
29 A.getAttributeSpellingListIndex());
30 if (!isa<NullStmt>(St)) {
31 S.Diag(A.getRange().getBegin(), diag::err_fallthrough_attr_wrong_target)
32 << Attr.getSpelling() << St->getLocStart();
33 if (isa<SwitchCase>(St)) {
34 SourceLocation L = S.getLocForEndOfToken(Range.getEnd());
35 S.Diag(L, diag::note_fallthrough_insert_semi_fixit)
36 << FixItHint::CreateInsertion(L, ";");
37 }
38 return nullptr;
39 }
40 auto *FnScope = S.getCurFunction();
41 if (FnScope->SwitchStack.empty()) {
42 S.Diag(A.getRange().getBegin(), diag::err_fallthrough_attr_outside_switch);
43 return nullptr;
44 }
45
46 // If this is spelled as the standard C++17 attribute, but not in C++17, warn
47 // about using it as an extension.
48 if (!S.getLangOpts().CPlusPlus17 && A.isCXX11Attribute() &&
49 !A.getScopeName())
50 S.Diag(A.getLoc(), diag::ext_cxx17_attr) << A.getName();
51
52 FnScope->setHasFallthroughStmt();
53 return ::new (S.Context) auto(Attr);
54}
55
56static Attr *handleSuppressAttr(Sema &S, Stmt *St, const ParsedAttr &A,
57 SourceRange Range) {
58 if (A.getNumArgs() < 1) {
59 S.Diag(A.getLoc(), diag::err_attribute_too_few_arguments)
60 << A.getName() << 1;
61 return nullptr;
62 }
63
64 std::vector<StringRef> DiagnosticIdentifiers;
65 for (unsigned I = 0, E = A.getNumArgs(); I != E; ++I) {
66 StringRef RuleName;
67
68 if (!S.checkStringLiteralArgumentAttr(A, I, RuleName, nullptr))
69 return nullptr;
70
71 // FIXME: Warn if the rule name is unknown. This is tricky because only
72 // clang-tidy knows about available rules.
73 DiagnosticIdentifiers.push_back(RuleName);
74 }
75
76 return ::new (S.Context) SuppressAttr(
77 A.getRange(), S.Context, DiagnosticIdentifiers.data(),
78 DiagnosticIdentifiers.size(), A.getAttributeSpellingListIndex());
79}
80
81static Attr *handleLoopHintAttr(Sema &S, Stmt *St, const ParsedAttr &A,
82 SourceRange) {
83 IdentifierLoc *PragmaNameLoc = A.getArgAsIdent(0);
84 IdentifierLoc *OptionLoc = A.getArgAsIdent(1);
85 IdentifierLoc *StateLoc = A.getArgAsIdent(2);
86 Expr *ValueExpr = A.getArgAsExpr(3);
87
88 bool PragmaUnroll = PragmaNameLoc->Ident->getName() == "unroll";
89 bool PragmaNoUnroll = PragmaNameLoc->Ident->getName() == "nounroll";
90 if (St->getStmtClass() != Stmt::DoStmtClass &&
91 St->getStmtClass() != Stmt::ForStmtClass &&
92 St->getStmtClass() != Stmt::CXXForRangeStmtClass &&
93 St->getStmtClass() != Stmt::WhileStmtClass) {
94 const char *Pragma =
95 llvm::StringSwitch<const char *>(PragmaNameLoc->Ident->getName())
96 .Case("unroll", "#pragma unroll")
97 .Case("nounroll", "#pragma nounroll")
98 .Default("#pragma clang loop");
99 S.Diag(St->getLocStart(), diag::err_pragma_loop_precedes_nonloop) << Pragma;
100 return nullptr;
101 }
102
103 LoopHintAttr::Spelling Spelling =
104 LoopHintAttr::Spelling(A.getAttributeSpellingListIndex());
105 LoopHintAttr::OptionType Option;
106 LoopHintAttr::LoopHintState State;
107 if (PragmaNoUnroll) {
108 // #pragma nounroll
109 Option = LoopHintAttr::Unroll;
110 State = LoopHintAttr::Disable;
111 } else if (PragmaUnroll) {
112 if (ValueExpr) {
113 // #pragma unroll N
114 Option = LoopHintAttr::UnrollCount;
115 State = LoopHintAttr::Numeric;
116 } else {
117 // #pragma unroll
118 Option = LoopHintAttr::Unroll;
119 State = LoopHintAttr::Enable;
120 }
121 } else {
122 // #pragma clang loop ...
123 assert(OptionLoc && OptionLoc->Ident &&(static_cast <bool> (OptionLoc && OptionLoc->
Ident && "Attribute must have valid option info.") ? void
(0) : __assert_fail ("OptionLoc && OptionLoc->Ident && \"Attribute must have valid option info.\""
, "/build/llvm-toolchain-snapshot-7~svn337204/tools/clang/lib/Sema/SemaStmtAttr.cpp"
, 124, __extension__ __PRETTY_FUNCTION__))
124 "Attribute must have valid option info.")(static_cast <bool> (OptionLoc && OptionLoc->
Ident && "Attribute must have valid option info.") ? void
(0) : __assert_fail ("OptionLoc && OptionLoc->Ident && \"Attribute must have valid option info.\""
, "/build/llvm-toolchain-snapshot-7~svn337204/tools/clang/lib/Sema/SemaStmtAttr.cpp"
, 124, __extension__ __PRETTY_FUNCTION__))
;
125 Option = llvm::StringSwitch<LoopHintAttr::OptionType>(
126 OptionLoc->Ident->getName())
127 .Case("vectorize", LoopHintAttr::Vectorize)
128 .Case("vectorize_width", LoopHintAttr::VectorizeWidth)
129 .Case("interleave", LoopHintAttr::Interleave)
130 .Case("interleave_count", LoopHintAttr::InterleaveCount)
131 .Case("unroll", LoopHintAttr::Unroll)
132 .Case("unroll_count", LoopHintAttr::UnrollCount)
133 .Case("distribute", LoopHintAttr::Distribute)
134 .Default(LoopHintAttr::Vectorize);
135 if (Option == LoopHintAttr::VectorizeWidth ||
136 Option == LoopHintAttr::InterleaveCount ||
137 Option == LoopHintAttr::UnrollCount) {
138 assert(ValueExpr && "Attribute must have a valid value expression.")(static_cast <bool> (ValueExpr && "Attribute must have a valid value expression."
) ? void (0) : __assert_fail ("ValueExpr && \"Attribute must have a valid value expression.\""
, "/build/llvm-toolchain-snapshot-7~svn337204/tools/clang/lib/Sema/SemaStmtAttr.cpp"
, 138, __extension__ __PRETTY_FUNCTION__))
;
139 if (S.CheckLoopHintExpr(ValueExpr, St->getLocStart()))
140 return nullptr;
141 State = LoopHintAttr::Numeric;
142 } else if (Option == LoopHintAttr::Vectorize ||
143 Option == LoopHintAttr::Interleave ||
144 Option == LoopHintAttr::Unroll ||
145 Option == LoopHintAttr::Distribute) {
146 assert(StateLoc && StateLoc->Ident && "Loop hint must have an argument")(static_cast <bool> (StateLoc && StateLoc->Ident
&& "Loop hint must have an argument") ? void (0) : __assert_fail
("StateLoc && StateLoc->Ident && \"Loop hint must have an argument\""
, "/build/llvm-toolchain-snapshot-7~svn337204/tools/clang/lib/Sema/SemaStmtAttr.cpp"
, 146, __extension__ __PRETTY_FUNCTION__))
;
147 if (StateLoc->Ident->isStr("disable"))
148 State = LoopHintAttr::Disable;
149 else if (StateLoc->Ident->isStr("assume_safety"))
150 State = LoopHintAttr::AssumeSafety;
151 else if (StateLoc->Ident->isStr("full"))
152 State = LoopHintAttr::Full;
153 else if (StateLoc->Ident->isStr("enable"))
154 State = LoopHintAttr::Enable;
155 else
156 llvm_unreachable("bad loop hint argument")::llvm::llvm_unreachable_internal("bad loop hint argument", "/build/llvm-toolchain-snapshot-7~svn337204/tools/clang/lib/Sema/SemaStmtAttr.cpp"
, 156)
;
157 } else
158 llvm_unreachable("bad loop hint")::llvm::llvm_unreachable_internal("bad loop hint", "/build/llvm-toolchain-snapshot-7~svn337204/tools/clang/lib/Sema/SemaStmtAttr.cpp"
, 158)
;
159 }
160
161 return LoopHintAttr::CreateImplicit(S.Context, Spelling, Option, State,
162 ValueExpr, A.getRange());
163}
164
165static void
166CheckForIncompatibleAttributes(Sema &S,
167 const SmallVectorImpl<const Attr *> &Attrs) {
168 // There are 4 categories of loop hints attributes: vectorize, interleave,
169 // unroll and distribute. Except for distribute they come in two variants: a
170 // state form and a numeric form. The state form selectively
171 // defaults/enables/disables the transformation for the loop (for unroll,
172 // default indicates full unrolling rather than enabling the transformation).
173 // The numeric form form provides an integer hint (for example, unroll count)
174 // to the transformer. The following array accumulates the hints encountered
175 // while iterating through the attributes to check for compatibility.
176 struct {
177 const LoopHintAttr *StateAttr;
178 const LoopHintAttr *NumericAttr;
179 } HintAttrs[] = {{nullptr, nullptr},
180 {nullptr, nullptr},
181 {nullptr, nullptr},
182 {nullptr, nullptr}};
183
184 for (const auto *I : Attrs) {
185 const LoopHintAttr *LH = dyn_cast<LoopHintAttr>(I);
186
187 // Skip non loop hint attributes
188 if (!LH)
189 continue;
190
191 LoopHintAttr::OptionType Option = LH->getOption();
192 enum { Vectorize, Interleave, Unroll, Distribute } Category;
193 switch (Option) {
194 case LoopHintAttr::Vectorize:
195 case LoopHintAttr::VectorizeWidth:
196 Category = Vectorize;
197 break;
198 case LoopHintAttr::Interleave:
199 case LoopHintAttr::InterleaveCount:
200 Category = Interleave;
201 break;
202 case LoopHintAttr::Unroll:
203 case LoopHintAttr::UnrollCount:
204 Category = Unroll;
205 break;
206 case LoopHintAttr::Distribute:
207 // Perform the check for duplicated 'distribute' hints.
208 Category = Distribute;
209 break;
210 };
211
212 auto &CategoryState = HintAttrs[Category];
213 const LoopHintAttr *PrevAttr;
214 if (Option == LoopHintAttr::Vectorize ||
215 Option == LoopHintAttr::Interleave || Option == LoopHintAttr::Unroll ||
216 Option == LoopHintAttr::Distribute) {
217 // Enable|Disable|AssumeSafety hint. For example, vectorize(enable).
218 PrevAttr = CategoryState.StateAttr;
219 CategoryState.StateAttr = LH;
220 } else {
221 // Numeric hint. For example, vectorize_width(8).
222 PrevAttr = CategoryState.NumericAttr;
223 CategoryState.NumericAttr = LH;
224 }
225
226 PrintingPolicy Policy(S.Context.getLangOpts());
227 SourceLocation OptionLoc = LH->getRange().getBegin();
228 if (PrevAttr)
229 // Cannot specify same type of attribute twice.
230 S.Diag(OptionLoc, diag::err_pragma_loop_compatibility)
231 << /*Duplicate=*/true << PrevAttr->getDiagnosticName(Policy)
232 << LH->getDiagnosticName(Policy);
233
234 if (CategoryState.StateAttr && CategoryState.NumericAttr &&
235 (Category == Unroll ||
236 CategoryState.StateAttr->getState() == LoopHintAttr::Disable)) {
237 // Disable hints are not compatible with numeric hints of the same
238 // category. As a special case, numeric unroll hints are also not
239 // compatible with enable or full form of the unroll pragma because these
240 // directives indicate full unrolling.
241 S.Diag(OptionLoc, diag::err_pragma_loop_compatibility)
242 << /*Duplicate=*/false
243 << CategoryState.StateAttr->getDiagnosticName(Policy)
244 << CategoryState.NumericAttr->getDiagnosticName(Policy);
245 }
246 }
247}
248
249static Attr *handleOpenCLUnrollHint(Sema &S, Stmt *St, const ParsedAttr &A,
250 SourceRange Range) {
251 // Although the feature was introduced only in OpenCL C v2.0 s6.11.5, it's
252 // useful for OpenCL 1.x too and doesn't require HW support.
253 // opencl_unroll_hint can have 0 arguments (compiler
254 // determines unrolling factor) or 1 argument (the unroll factor provided
255 // by the user).
256
257 unsigned NumArgs = A.getNumArgs();
258
259 if (NumArgs > 1) {
4
Assuming 'NumArgs' is <= 1
5
Taking false branch
260 S.Diag(A.getLoc(), diag::err_attribute_too_many_arguments) << A.getName()
261 << 1;
262 return nullptr;
263 }
264
265 unsigned UnrollFactor = 0;
266
267 if (NumArgs == 1) {
6
Assuming 'NumArgs' is not equal to 1
7
Taking false branch
268 Expr *E = A.getArgAsExpr(0);
269 llvm::APSInt ArgVal(32);
270
271 if (!E->isIntegerConstantExpr(ArgVal, S.Context)) {
272 S.Diag(A.getLoc(), diag::err_attribute_argument_type)
273 << A.getName() << AANT_ArgumentIntegerConstant << E->getSourceRange();
274 return nullptr;
275 }
276
277 int Val = ArgVal.getSExtValue();
278
279 if (Val <= 0) {
280 S.Diag(A.getRange().getBegin(),
281 diag::err_attribute_requires_positive_integer)
282 << A.getName();
283 return nullptr;
284 }
285 UnrollFactor = Val;
286 }
287
288 return OpenCLUnrollHintAttr::CreateImplicit(S.Context, UnrollFactor);
8
Calling 'OpenCLUnrollHintAttr::CreateImplicit'
289}
290
291static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const ParsedAttr &A,
292 SourceRange Range) {
293 switch (A.getKind()) {
2
Control jumps to 'case AT_OpenCLUnrollHint:' at line 303
294 case ParsedAttr::UnknownAttribute:
295 S.Diag(A.getLoc(), A.isDeclspecAttribute() ?
296 diag::warn_unhandled_ms_attribute_ignored :
297 diag::warn_unknown_attribute_ignored) << A.getName();
298 return nullptr;
299 case ParsedAttr::AT_FallThrough:
300 return handleFallThroughAttr(S, St, A, Range);
301 case ParsedAttr::AT_LoopHint:
302 return handleLoopHintAttr(S, St, A, Range);
303 case ParsedAttr::AT_OpenCLUnrollHint:
304 return handleOpenCLUnrollHint(S, St, A, Range);
3
Calling 'handleOpenCLUnrollHint'
305 case ParsedAttr::AT_Suppress:
306 return handleSuppressAttr(S, St, A, Range);
307 default:
308 // if we're here, then we parsed a known attribute, but didn't recognize
309 // it as a statement attribute => it is declaration attribute
310 S.Diag(A.getRange().getBegin(), diag::err_decl_attribute_invalid_on_stmt)
311 << A.getName() << St->getLocStart();
312 return nullptr;
313 }
314}
315
316StmtResult Sema::ProcessStmtAttributes(Stmt *S,
317 const ParsedAttributesView &AttrList,
318 SourceRange Range) {
319 SmallVector<const Attr*, 8> Attrs;
320 for (const ParsedAttr &AL : AttrList) {
321 if (Attr *a = ProcessStmtAttribute(*this, S, AL, Range))
1
Calling 'ProcessStmtAttribute'
322 Attrs.push_back(a);
323 }
324
325 CheckForIncompatibleAttributes(*this, Attrs);
326
327 if (Attrs.empty())
328 return S;
329
330 return ActOnAttributedStmt(Range.getBegin(), Attrs, S);
331}

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