Bug Summary

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

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name SemaStmtAttr.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-eagerly-assume -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -resource-dir /usr/lib/llvm-7/lib/clang/7.0.0 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I /build/llvm-toolchain-snapshot-7~svn329677/build-llvm/tools/clang/lib/Sema -I /build/llvm-toolchain-snapshot-7~svn329677/tools/clang/lib/Sema -I /build/llvm-toolchain-snapshot-7~svn329677/tools/clang/include -I /build/llvm-toolchain-snapshot-7~svn329677/build-llvm/tools/clang/include -I /build/llvm-toolchain-snapshot-7~svn329677/build-llvm/include -I /build/llvm-toolchain-snapshot-7~svn329677/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~svn329677/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-04-11-031539-24776-1 -x c++ /build/llvm-toolchain-snapshot-7~svn329677/tools/clang/lib/Sema/SemaStmtAttr.cpp

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