Bug Summary

File:tools/clang/lib/Sema/SemaStmtAttr.cpp
Warning:line 7411, column 9
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

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

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

1//===--- SemaStmtAttr.cpp - Statement Attribute Handling ------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements stmt-related attribute processing.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/Sema/SemaInternal.h"
15#include "clang/AST/ASTContext.h"
16#include "clang/Basic/SourceManager.h"
17#include "clang/Sema/DelayedDiagnostic.h"
18#include "clang/Sema/Lookup.h"
19#include "clang/Sema/LoopHint.h"
20#include "clang/Sema/ScopeInfo.h"
21#include "llvm/ADT/StringExtras.h"
22
23using namespace clang;
24using namespace sema;
25
26static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const 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
56static Attr *handleSuppressAttr(Sema &S, Stmt *St, const AttributeList &A,
57 SourceRange Range) {
58 if (A.getNumArgs() < 1) {
3
Assuming the condition is false
4
Taking false branch
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) {
5
Loop condition is true. Entering loop body
8
Assuming 'I' is equal to 'E'
9
Loop condition is false. Execution jumps to the end of the function
66 StringRef RuleName;
67
68 if (!S.checkStringLiteralArgumentAttr(A, I, RuleName, nullptr))
6
Assuming the condition is false
7
Taking false branch
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(
10
Calling constructor for 'SuppressAttr'
77 A.getRange(), S.Context, DiagnosticIdentifiers.data(),
78 DiagnosticIdentifiers.size(), A.getAttributeSpellingListIndex());
79}
80
81static 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~svn325118/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~svn325118/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~svn325118/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~svn325118/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~svn325118/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~svn325118/tools/clang/lib/Sema/SemaStmtAttr.cpp"
, 158)
;
159 }
160
161 return LoopHintAttr::CreateImplicit(S.Context, Spelling, Option, State,
162 ValueExpr, A.getRange());
163}
164
165static void
166CheckForIncompatibleAttributes(Sema &S,
167 const SmallVectorImpl<const Attr *> &Attrs) {
168 // There are 4 categories of loop hints attributes: vectorize, interleave,
169 // unroll and distribute. Except for distribute they come in two variants: a
170 // state form and a numeric form. The state form selectively
171 // defaults/enables/disables the transformation for the loop (for unroll,
172 // default indicates full unrolling rather than enabling the transformation).
173 // The numeric form form provides an integer hint (for example, unroll count)
174 // to the transformer. The following array accumulates the hints encountered
175 // while iterating through the attributes to check for compatibility.
176 struct {
177 const LoopHintAttr *StateAttr;
178 const LoopHintAttr *NumericAttr;
179 } HintAttrs[] = {{nullptr, nullptr},
180 {nullptr, nullptr},
181 {nullptr, nullptr},
182 {nullptr, nullptr}};
183
184 for (const auto *I : Attrs) {
185 const LoopHintAttr *LH = dyn_cast<LoopHintAttr>(I);
186
187 // Skip non loop hint attributes
188 if (!LH)
189 continue;
190
191 LoopHintAttr::OptionType Option = LH->getOption();
192 enum { Vectorize, Interleave, Unroll, Distribute } Category;
193 switch (Option) {
194 case LoopHintAttr::Vectorize:
195 case LoopHintAttr::VectorizeWidth:
196 Category = Vectorize;
197 break;
198 case LoopHintAttr::Interleave:
199 case LoopHintAttr::InterleaveCount:
200 Category = Interleave;
201 break;
202 case LoopHintAttr::Unroll:
203 case LoopHintAttr::UnrollCount:
204 Category = Unroll;
205 break;
206 case LoopHintAttr::Distribute:
207 // Perform the check for duplicated 'distribute' hints.
208 Category = Distribute;
209 break;
210 };
211
212 auto &CategoryState = HintAttrs[Category];
213 const LoopHintAttr *PrevAttr;
214 if (Option == LoopHintAttr::Vectorize ||
215 Option == LoopHintAttr::Interleave || Option == LoopHintAttr::Unroll ||
216 Option == LoopHintAttr::Distribute) {
217 // Enable|Disable|AssumeSafety hint. For example, vectorize(enable).
218 PrevAttr = CategoryState.StateAttr;
219 CategoryState.StateAttr = LH;
220 } else {
221 // Numeric hint. For example, vectorize_width(8).
222 PrevAttr = CategoryState.NumericAttr;
223 CategoryState.NumericAttr = LH;
224 }
225
226 PrintingPolicy Policy(S.Context.getLangOpts());
227 SourceLocation OptionLoc = LH->getRange().getBegin();
228 if (PrevAttr)
229 // Cannot specify same type of attribute twice.
230 S.Diag(OptionLoc, diag::err_pragma_loop_compatibility)
231 << /*Duplicate=*/true << PrevAttr->getDiagnosticName(Policy)
232 << LH->getDiagnosticName(Policy);
233
234 if (CategoryState.StateAttr && CategoryState.NumericAttr &&
235 (Category == Unroll ||
236 CategoryState.StateAttr->getState() == LoopHintAttr::Disable)) {
237 // Disable hints are not compatible with numeric hints of the same
238 // category. As a special case, numeric unroll hints are also not
239 // compatible with enable or full form of the unroll pragma because these
240 // directives indicate full unrolling.
241 S.Diag(OptionLoc, diag::err_pragma_loop_compatibility)
242 << /*Duplicate=*/false
243 << CategoryState.StateAttr->getDiagnosticName(Policy)
244 << CategoryState.NumericAttr->getDiagnosticName(Policy);
245 }
246 }
247}
248
249static Attr *handleOpenCLUnrollHint(Sema &S, Stmt *St, const 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
291static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const AttributeList &A,
292 SourceRange Range) {
293 switch (A.getKind()) {
1
Control jumps to 'case AT_Suppress:' at line 305
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);
2
Calling 'handleSuppressAttr'
307 default:
308 // if we're here, then we parsed a known attribute, but didn't recognize
309 // it as a statement attribute => it is declaration attribute
310 S.Diag(A.getRange().getBegin(), diag::err_decl_attribute_invalid_on_stmt)
311 << A.getName() << St->getLocStart();
312 return nullptr;
313 }
314}
315
316StmtResult Sema::ProcessStmtAttributes(Stmt *S, 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}

/build/llvm-toolchain-snapshot-7~svn325118/build-llvm/tools/clang/include/clang/AST/Attrs.inc

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