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