/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/clang-build/tools/clang/include/clang/Sema/AttrParsedAttrImpl.inc
Line | Count | Source (jump to first uncovered line) |
1 | | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | | |* *| |
3 | | |* Parsed attribute helpers *| |
4 | | |* *| |
5 | | |* Automatically generated file, do not edit! *| |
6 | | |* *| |
7 | | \*===----------------------------------------------------------------------===*/ |
8 | | |
9 | 2.01M | static bool defaultAppertainsTo(Sema &, const ParsedAttr &,const Decl *) { |
10 | 2.01M | return true; |
11 | 2.01M | } |
12 | | |
13 | 8.14M | static bool defaultDiagnoseLangOpts(Sema &, const ParsedAttr &) { |
14 | 8.14M | return true; |
15 | 8.14M | } |
16 | | |
17 | 15.4M | static bool defaultTargetRequirements(const TargetInfo &) { |
18 | 15.4M | return true; |
19 | 15.4M | } |
20 | | |
21 | 0 | static unsigned defaultSpellingIndexToSemanticSpelling(const ParsedAttr &Attr) { |
22 | 0 | return UINT_MAX; |
23 | 0 | } |
24 | | |
25 | 106 | static bool checkAMDGPUFlatWorkGroupSizeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
26 | 106 | if (!D || (!isa<FunctionDecl>(D))) { |
27 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
28 | 1 | << Attr << "kernel functions"; |
29 | 1 | return false; |
30 | 1 | } |
31 | 105 | return true; |
32 | 105 | } |
33 | | |
34 | 0 | static void matchRulesForAMDGPUFlatWorkGroupSize(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
35 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
36 | 0 | } |
37 | | |
38 | 72 | static bool checkAMDGPUNumSGPRAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
39 | 72 | if (!D || (!isa<FunctionDecl>(D))) { |
40 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
41 | 1 | << Attr << "kernel functions"; |
42 | 1 | return false; |
43 | 1 | } |
44 | 71 | return true; |
45 | 71 | } |
46 | | |
47 | 0 | static void matchRulesForAMDGPUNumSGPR(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
48 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
49 | 0 | } |
50 | | |
51 | 72 | static bool checkAMDGPUNumVGPRAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
52 | 72 | if (!D || (!isa<FunctionDecl>(D))) { |
53 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
54 | 1 | << Attr << "kernel functions"; |
55 | 1 | return false; |
56 | 1 | } |
57 | 71 | return true; |
58 | 71 | } |
59 | | |
60 | 0 | static void matchRulesForAMDGPUNumVGPR(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
61 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
62 | 0 | } |
63 | | |
64 | 132 | static bool checkAMDGPUWavesPerEUAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
65 | 132 | if (!D || (!isa<FunctionDecl>(D))) { |
66 | 2 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
67 | 2 | << Attr << "kernel functions"; |
68 | 2 | return false; |
69 | 2 | } |
70 | 130 | return true; |
71 | 130 | } |
72 | | |
73 | 0 | static void matchRulesForAMDGPUWavesPerEU(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
74 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
75 | 0 | } |
76 | | |
77 | 317 | static bool isTargetarmthumbarmebthumbebavrx86x86_64msp430mipsmipselriscv32riscv64(const TargetInfo &Target) { |
78 | 317 | const llvm::Triple &T = Target.getTriple(); (void)T; |
79 | 317 | return true && (T.getArch() == llvm::Triple::arm || T.getArch() == llvm::Triple::thumb296 || T.getArch() == llvm::Triple::armeb276 || T.getArch() == llvm::Triple::thumbeb262 || T.getArch() == llvm::Triple::avr234 || T.getArch() == llvm::Triple::x86230 || T.getArch() == llvm::Triple::x86_64176 || T.getArch() == llvm::Triple::msp43095 || T.getArch() == llvm::Triple::mips85 || T.getArch() == llvm::Triple::mipsel67 || T.getArch() == llvm::Triple::riscv3258 || T.getArch() == llvm::Triple::riscv6429 ); |
80 | 317 | } |
81 | | |
82 | 4 | static bool checkAVRSignalAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
83 | 4 | if (!D || (!isa<FunctionDecl>(D))) { |
84 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
85 | 1 | << Attr << "functions"; |
86 | 1 | return false; |
87 | 1 | } |
88 | 3 | return true; |
89 | 3 | } |
90 | | |
91 | 6 | static bool isTargetavr(const TargetInfo &Target) { |
92 | 6 | const llvm::Triple &T = Target.getTriple(); (void)T; |
93 | 6 | return true && (T.getArch() == llvm::Triple::avr); |
94 | 6 | } |
95 | | |
96 | 0 | static void matchRulesForAVRSignal(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
97 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
98 | 0 | } |
99 | | |
100 | 197 | static bool isStruct(const Decl *D) { |
101 | 197 | if (const auto *S = dyn_cast<RecordDecl>(D)) |
102 | 63 | return !S->isUnion(); |
103 | 134 | return false; |
104 | 134 | } |
105 | | |
106 | 119 | static bool checkAbiTagAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
107 | 119 | if (!D || (!isStruct(D) && !isa<VarDecl>(D)73 && !isa<FunctionDecl>(D)40 && !isa<NamespaceDecl>(D)12 )) { |
108 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
109 | 0 | << Attr << "structs, variables, functions, and namespaces"; |
110 | 0 | return false; |
111 | 0 | } |
112 | 119 | return true; |
113 | 119 | } |
114 | | |
115 | 60 | static void matchRulesForAbiTag(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
116 | 60 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record_not_is_union, /*IsSupported=*/true)); |
117 | 60 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
118 | 60 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
119 | 60 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_namespace, /*IsSupported=*/LangOpts.CPlusPlus)); |
120 | 60 | } |
121 | | |
122 | 524 | static bool checkAcquireCapabilityAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
123 | 524 | if (!D || (!isa<FunctionDecl>(D))) { |
124 | 31 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
125 | 31 | << Attr << "functions"; |
126 | 31 | return false; |
127 | 31 | } |
128 | 493 | return true; |
129 | 493 | } |
130 | | |
131 | 0 | static unsigned AcquireCapabilityAttrSpellingMap(const ParsedAttr &Attr) { |
132 | 0 | enum Spelling { |
133 | 0 | GNU_acquire_capability = 0, |
134 | 0 | CXX11_clang_acquire_capability = 1, |
135 | 0 | GNU_acquire_shared_capability = 2, |
136 | 0 | CXX11_clang_acquire_shared_capability = 3, |
137 | 0 | GNU_exclusive_lock_function = 4, |
138 | 0 | GNU_shared_lock_function = 5 |
139 | 0 | }; |
140 | 0 |
|
141 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
142 | 0 | switch (Idx) { |
143 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
144 | 0 | case 0: return GNU_acquire_capability; |
145 | 0 | case 1: return CXX11_clang_acquire_capability; |
146 | 0 | case 2: return GNU_acquire_shared_capability; |
147 | 0 | case 3: return CXX11_clang_acquire_shared_capability; |
148 | 0 | case 4: return GNU_exclusive_lock_function; |
149 | 0 | case 5: return GNU_shared_lock_function; |
150 | 0 | } |
151 | 0 | } |
152 | | |
153 | 423 | static bool isSharedVar(const Decl *D) { |
154 | 423 | if (const auto *S = dyn_cast<VarDecl>(D)) |
155 | 377 | return S->hasGlobalStorage() && !S->getTLSKind()333 ; |
156 | 46 | return false; |
157 | 46 | } |
158 | | |
159 | 154 | static bool checkAcquiredAfterAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
160 | 154 | if (!D || (!isa<FieldDecl>(D) && !isSharedVar(D)73 )) { |
161 | 12 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
162 | 12 | << Attr << "non-static data members and global variables"; |
163 | 12 | return false; |
164 | 12 | } |
165 | 142 | return true; |
166 | 142 | } |
167 | | |
168 | 115 | static bool checkAcquiredBeforeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
169 | 115 | if (!D || (!isa<FieldDecl>(D) && !isSharedVar(D)61 )) { |
170 | 12 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
171 | 12 | << Attr << "non-static data members and global variables"; |
172 | 12 | return false; |
173 | 12 | } |
174 | 103 | return true; |
175 | 103 | } |
176 | | |
177 | 6.11k | static bool isGlobalVar(const Decl *D) { |
178 | 6.11k | if (const auto *S = dyn_cast<VarDecl>(D)) |
179 | 6.07k | return S->hasGlobalStorage(); |
180 | 43 | return false; |
181 | 43 | } |
182 | | |
183 | 99 | static bool checkAliasAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
184 | 99 | if (!D || (!isa<FunctionDecl>(D) && !isGlobalVar(D)24 )) { |
185 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
186 | 0 | << Attr << "functions and global variables"; |
187 | 0 | return false; |
188 | 0 | } |
189 | 99 | return true; |
190 | 99 | } |
191 | | |
192 | 0 | static void matchRulesForAlias(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
193 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
194 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/true)); |
195 | 0 | } |
196 | | |
197 | 217 | static bool checkAlignValueAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
198 | 217 | if (!D || (!isa<VarDecl>(D) && !isa<TypedefNameDecl>(D)19 )) { |
199 | 3 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
200 | 3 | << Attr << "variables and typedefs"; |
201 | 3 | return false; |
202 | 3 | } |
203 | 214 | return true; |
204 | 214 | } |
205 | | |
206 | 0 | static void matchRulesForAlignValue(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
207 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
208 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_type_alias, /*IsSupported=*/true)); |
209 | 0 | } |
210 | | |
211 | 0 | static unsigned AlignedAttrSpellingMap(const ParsedAttr &Attr) { |
212 | 0 | enum Spelling { |
213 | 0 | GNU_aligned = 0, |
214 | 0 | CXX11_gnu_aligned = 1, |
215 | 0 | Declspec_align = 2, |
216 | 0 | Keyword_alignas = 3, |
217 | 0 | Keyword_Alignas = 4 |
218 | 0 | }; |
219 | 0 |
|
220 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
221 | 0 | switch (Idx) { |
222 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
223 | 0 | case 0: return GNU_aligned; |
224 | 0 | case 1: return CXX11_gnu_aligned; |
225 | 0 | case 2: return Declspec_align; |
226 | 0 | case 3: return Keyword_alignas; |
227 | 0 | case 4: return Keyword_Alignas; |
228 | 0 | } |
229 | 0 | } |
230 | | |
231 | 57.7k | static bool isHasFunctionProto(const Decl *D) { |
232 | 57.7k | if (const auto *S = dyn_cast<Decl>(D)) |
233 | 57.7k | return (S->getFunctionType(true) != nullptr && |
234 | 57.7k | isa<FunctionProtoType>(S->getFunctionType())57.7k ) || |
235 | 57.7k | isa<ObjCMethodDecl>(S)38 || |
236 | 57.7k | isa<BlockDecl>(S)38 ; |
237 | 0 | return false; |
238 | 0 | } |
239 | | |
240 | 32 | static bool checkAllocAlignAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
241 | 32 | if (!D || (!isHasFunctionProto(D))) { |
242 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
243 | 1 | << Attr << "non-K&R-style functions"; |
244 | 1 | return false; |
245 | 1 | } |
246 | 31 | return true; |
247 | 31 | } |
248 | | |
249 | 10.6k | static bool checkAllocSizeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
250 | 10.6k | if (!D || (!isa<FunctionDecl>(D))) { |
251 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
252 | 2 | << Attr << "functions"; |
253 | 2 | return false; |
254 | 2 | } |
255 | 10.6k | return true; |
256 | 10.6k | } |
257 | | |
258 | 0 | static void matchRulesForAllocSize(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
259 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
260 | 0 | } |
261 | | |
262 | 40 | static bool checkAlwaysDestroyAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
263 | 40 | if (!D || (!isa<VarDecl>(D))) { |
264 | 4 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
265 | 4 | << Attr << "variables"; |
266 | 4 | return false; |
267 | 4 | } |
268 | 36 | return true; |
269 | 36 | } |
270 | | |
271 | 0 | static void matchRulesForAlwaysDestroy(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
272 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
273 | 0 | } |
274 | | |
275 | 1.15M | static bool checkAlwaysInlineAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
276 | 1.15M | if (!D || (!isa<FunctionDecl>(D))) { |
277 | 3 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
278 | 3 | << Attr << "functions"; |
279 | 3 | return false; |
280 | 3 | } |
281 | 1.15M | return true; |
282 | 1.15M | } |
283 | | |
284 | 0 | static unsigned AlwaysInlineAttrSpellingMap(const ParsedAttr &Attr) { |
285 | 0 | enum Spelling { |
286 | 0 | GNU_always_inline = 0, |
287 | 0 | CXX11_gnu_always_inline = 1, |
288 | 0 | Keyword_forceinline = 2 |
289 | 0 | }; |
290 | 0 |
|
291 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
292 | 0 | switch (Idx) { |
293 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
294 | 0 | case 0: return GNU_always_inline; |
295 | 0 | case 1: return CXX11_gnu_always_inline; |
296 | 0 | case 2: return Keyword_forceinline; |
297 | 0 | } |
298 | 0 | } |
299 | | |
300 | 0 | static void matchRulesForAlwaysInline(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
301 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
302 | 0 | } |
303 | | |
304 | 91 | static void matchRulesForAnnotate(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
305 | 91 | } |
306 | | |
307 | 138 | static bool isTargetx86x86_64(const TargetInfo &Target) { |
308 | 138 | const llvm::Triple &T = Target.getTriple(); (void)T; |
309 | 138 | return true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_6499 ); |
310 | 138 | } |
311 | | |
312 | 974k | static bool isFunctionLike(const Decl *D) { |
313 | 974k | if (const auto *S = dyn_cast<Decl>(D)) |
314 | 974k | return S->getFunctionType(false) != nullptr; |
315 | 0 | return false; |
316 | 0 | } |
317 | | |
318 | 13 | static bool checkAnyX86NoCfCheckAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
319 | 13 | if (!D || (!isFunctionLike(D))) { |
320 | 3 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
321 | 3 | << Attr << "functions and function pointers"; |
322 | 3 | return false; |
323 | 3 | } |
324 | 10 | return true; |
325 | 10 | } |
326 | | |
327 | 0 | static void matchRulesForAnyX86NoCfCheck(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
328 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/true)); |
329 | 0 | } |
330 | | |
331 | 67 | static bool checkArcWeakrefUnavailableAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
332 | 67 | if (!D || (!isa<ObjCInterfaceDecl>(D))) { |
333 | 2 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
334 | 2 | << Attr << "Objective-C interfaces"; |
335 | 2 | return false; |
336 | 2 | } |
337 | 65 | return true; |
338 | 65 | } |
339 | | |
340 | 0 | static void matchRulesForArcWeakrefUnavailable(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
341 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
342 | 0 | } |
343 | | |
344 | 107 | static bool checkArgumentWithTypeTagAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
345 | 107 | if (!D || (!isHasFunctionProto(D))) { |
346 | 3 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
347 | 3 | << Attr << "non-K&R-style functions"; |
348 | 3 | return false; |
349 | 3 | } |
350 | 104 | return true; |
351 | 104 | } |
352 | | |
353 | 0 | static unsigned ArgumentWithTypeTagAttrSpellingMap(const ParsedAttr &Attr) { |
354 | 0 | enum Spelling { |
355 | 0 | GNU_argument_with_type_tag = 0, |
356 | 0 | CXX11_clang_argument_with_type_tag = 1, |
357 | 0 | C2x_clang_argument_with_type_tag = 2, |
358 | 0 | GNU_pointer_with_type_tag = 3, |
359 | 0 | CXX11_clang_pointer_with_type_tag = 4, |
360 | 0 | C2x_clang_pointer_with_type_tag = 5 |
361 | 0 | }; |
362 | 0 |
|
363 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
364 | 0 | switch (Idx) { |
365 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
366 | 0 | case 0: return GNU_argument_with_type_tag; |
367 | 0 | case 1: return CXX11_clang_argument_with_type_tag; |
368 | 0 | case 2: return C2x_clang_argument_with_type_tag; |
369 | 0 | case 3: return GNU_pointer_with_type_tag; |
370 | 0 | case 4: return CXX11_clang_pointer_with_type_tag; |
371 | 0 | case 5: return C2x_clang_pointer_with_type_tag; |
372 | 0 | } |
373 | 0 | } |
374 | | |
375 | 4.51k | static bool isInlineFunction(const Decl *D) { |
376 | 4.51k | if (const auto *S = dyn_cast<FunctionDecl>(D)) |
377 | 4.51k | return S->isInlineSpecified(); |
378 | 0 | return false; |
379 | 0 | } |
380 | | |
381 | 4.51k | static bool checkArtificialAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
382 | 4.51k | if (!D || (!isInlineFunction(D))) { |
383 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
384 | 1 | << Attr << "inline functions"; |
385 | 1 | return false; |
386 | 1 | } |
387 | 4.50k | return true; |
388 | 4.50k | } |
389 | | |
390 | 30 | static bool checkAssertCapabilityAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
391 | 30 | if (!D || (!isa<FunctionDecl>(D))) { |
392 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
393 | 0 | << Attr << "functions"; |
394 | 0 | return false; |
395 | 0 | } |
396 | 30 | return true; |
397 | 30 | } |
398 | | |
399 | 0 | static unsigned AssertCapabilityAttrSpellingMap(const ParsedAttr &Attr) { |
400 | 0 | enum Spelling { |
401 | 0 | GNU_assert_capability = 0, |
402 | 0 | CXX11_clang_assert_capability = 1, |
403 | 0 | GNU_assert_shared_capability = 2, |
404 | 0 | CXX11_clang_assert_shared_capability = 3 |
405 | 0 | }; |
406 | 0 |
|
407 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
408 | 0 | switch (Idx) { |
409 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
410 | 0 | case 0: return GNU_assert_capability; |
411 | 0 | case 1: return CXX11_clang_assert_capability; |
412 | 0 | case 2: return GNU_assert_shared_capability; |
413 | 0 | case 3: return CXX11_clang_assert_shared_capability; |
414 | 0 | } |
415 | 0 | } |
416 | | |
417 | 15 | static bool checkAssertExclusiveLockAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
418 | 15 | if (!D || (!isa<FunctionDecl>(D))) { |
419 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
420 | 0 | << Attr << "functions"; |
421 | 0 | return false; |
422 | 0 | } |
423 | 15 | return true; |
424 | 15 | } |
425 | | |
426 | 13 | static bool checkAssertSharedLockAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
427 | 13 | if (!D || (!isa<FunctionDecl>(D))) { |
428 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
429 | 0 | << Attr << "functions"; |
430 | 0 | return false; |
431 | 0 | } |
432 | 13 | return true; |
433 | 13 | } |
434 | | |
435 | 30 | static bool checkAssumeAlignedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
436 | 30 | if (!D || (!isa<ObjCMethodDecl>(D) && !isa<FunctionDecl>(D))) { |
437 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
438 | 2 | << Attr << "Objective-C methods and functions"; |
439 | 2 | return false; |
440 | 2 | } |
441 | 28 | return true; |
442 | 28 | } |
443 | | |
444 | 0 | static void matchRulesForAssumeAligned(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
445 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
446 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
447 | 0 | } |
448 | | |
449 | 822k | static bool checkAvailabilityAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
450 | 822k | if (!D || (!isa<NamedDecl>(D))) { |
451 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
452 | 2 | << Attr << "named declarations"; |
453 | 2 | return false; |
454 | 2 | } |
455 | 822k | return true; |
456 | 822k | } |
457 | | |
458 | 507 | static void matchRulesForAvailability(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
459 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
460 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_enum, /*IsSupported=*/true)); |
461 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_enum_constant, /*IsSupported=*/true)); |
462 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_field, /*IsSupported=*/true)); |
463 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
464 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_namespace, /*IsSupported=*/LangOpts.CPlusPlus)); |
465 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_category, /*IsSupported=*/LangOpts.ObjC)); |
466 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_implementation, /*IsSupported=*/LangOpts.ObjC)); |
467 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
468 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
469 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_property, /*IsSupported=*/LangOpts.ObjC)); |
470 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_protocol, /*IsSupported=*/LangOpts.ObjC)); |
471 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
472 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_type_alias, /*IsSupported=*/true)); |
473 | 507 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
474 | 507 | } |
475 | | |
476 | 0 | static bool checkCFAuditedTransferAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
477 | 0 | if (!D || (!isa<FunctionDecl>(D))) { |
478 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
479 | 0 | << Attr << "functions"; |
480 | 0 | return false; |
481 | 0 | } |
482 | 0 | return true; |
483 | 0 | } |
484 | | |
485 | 0 | static void matchRulesForCFAuditedTransfer(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
486 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
487 | 0 | } |
488 | | |
489 | 419 | static bool checkCFConsumedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
490 | 419 | if (!D || (!isa<ParmVarDecl>(D))) { |
491 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
492 | 0 | << Attr << "parameters"; |
493 | 0 | return false; |
494 | 0 | } |
495 | 419 | return true; |
496 | 419 | } |
497 | | |
498 | 0 | static void matchRulesForCFConsumed(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
499 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
500 | 0 | } |
501 | | |
502 | 1 | static bool checkCFUnknownTransferAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
503 | 1 | if (!D || (!isa<FunctionDecl>(D))) { |
504 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
505 | 0 | << Attr << "functions"; |
506 | 0 | return false; |
507 | 0 | } |
508 | 1 | return true; |
509 | 1 | } |
510 | | |
511 | 0 | static void matchRulesForCFUnknownTransfer(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
512 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
513 | 0 | } |
514 | | |
515 | 37 | static bool checkCPUDispatchAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
516 | 37 | if (!D || (!isa<FunctionDecl>(D))) { |
517 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
518 | 0 | << Attr << "functions"; |
519 | 0 | return false; |
520 | 0 | } |
521 | 37 | return true; |
522 | 37 | } |
523 | | |
524 | 0 | static void matchRulesForCPUDispatch(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
525 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
526 | 0 | } |
527 | | |
528 | 72 | static bool checkCPUSpecificAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
529 | 72 | if (!D || (!isa<FunctionDecl>(D))) { |
530 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
531 | 0 | << Attr << "functions"; |
532 | 0 | return false; |
533 | 0 | } |
534 | 72 | return true; |
535 | 72 | } |
536 | | |
537 | 0 | static void matchRulesForCPUSpecific(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
538 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
539 | 0 | } |
540 | | |
541 | 157 | static bool checkCUDAConstantAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
542 | 157 | if (!D || (!isa<VarDecl>(D))) { |
543 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
544 | 2 | << Attr << "variables"; |
545 | 2 | return false; |
546 | 2 | } |
547 | 155 | return true; |
548 | 155 | } |
549 | | |
550 | 2.77k | static bool checkCUDALangOpts(Sema &S, const ParsedAttr &Attr) { |
551 | 2.77k | auto &LangOpts = S.LangOpts; |
552 | 2.77k | if (LangOpts.CUDA) |
553 | 2.76k | return true; |
554 | 10 | |
555 | 10 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
556 | 10 | return false; |
557 | 10 | } |
558 | | |
559 | 0 | static void matchRulesForCUDAConstant(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
560 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
561 | 0 | } |
562 | | |
563 | 1.48k | static bool checkCUDADeviceAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
564 | 1.48k | if (!D || (!isa<FunctionDecl>(D) && !isa<VarDecl>(D)194 )) { |
565 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
566 | 0 | << Attr << "functions and variables"; |
567 | 0 | return false; |
568 | 0 | } |
569 | 1.48k | return true; |
570 | 1.48k | } |
571 | | |
572 | 0 | static void matchRulesForCUDADevice(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
573 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
574 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
575 | 0 | } |
576 | | |
577 | 205 | static bool checkCUDAGlobalAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
578 | 205 | if (!D || (!isa<FunctionDecl>(D))) { |
579 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
580 | 2 | << Attr << "functions"; |
581 | 2 | return false; |
582 | 2 | } |
583 | 203 | return true; |
584 | 203 | } |
585 | | |
586 | 0 | static void matchRulesForCUDAGlobal(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
587 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
588 | 0 | } |
589 | | |
590 | 662 | static bool checkCUDAHostAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
591 | 662 | if (!D || (!isa<FunctionDecl>(D))) { |
592 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
593 | 2 | << Attr << "functions"; |
594 | 2 | return false; |
595 | 2 | } |
596 | 660 | return true; |
597 | 660 | } |
598 | | |
599 | 0 | static void matchRulesForCUDAHost(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
600 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
601 | 0 | } |
602 | | |
603 | 0 | static bool checkCUDAInvalidTargetAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
604 | 0 | if (!D || (!isa<FunctionDecl>(D))) { |
605 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
606 | 0 | << Attr << "functions"; |
607 | 0 | return false; |
608 | 0 | } |
609 | 0 | return true; |
610 | 0 | } |
611 | | |
612 | 30 | static bool checkCUDALaunchBoundsAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
613 | 30 | if (!D || (!isa<ObjCMethodDecl>(D) && !isFunctionLike(D))) { |
614 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
615 | 1 | << Attr << "Objective-C methods, functions, and function pointers"; |
616 | 1 | return false; |
617 | 1 | } |
618 | 29 | return true; |
619 | 29 | } |
620 | | |
621 | 0 | static void matchRulesForCUDALaunchBounds(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
622 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
623 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/true)); |
624 | 0 | } |
625 | | |
626 | 226 | static bool checkCUDASharedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
627 | 226 | if (!D || (!isa<VarDecl>(D))) { |
628 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
629 | 2 | << Attr << "variables"; |
630 | 2 | return false; |
631 | 2 | } |
632 | 224 | return true; |
633 | 224 | } |
634 | | |
635 | 0 | static void matchRulesForCUDAShared(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
636 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
637 | 0 | } |
638 | | |
639 | 7.80k | static bool checkCXX11NoReturnAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
640 | 7.80k | if (!D || (!isa<FunctionDecl>(D))) { |
641 | 6 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
642 | 6 | << Attr << "functions"; |
643 | 6 | return false; |
644 | 6 | } |
645 | 7.79k | return true; |
646 | 7.79k | } |
647 | | |
648 | 5 | static void matchRulesForCXX11NoReturn(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
649 | 5 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
650 | 5 | } |
651 | | |
652 | 18 | static bool checkCallableWhenAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
653 | 18 | if (!D || (!isa<CXXMethodDecl>(D))) { |
654 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
655 | 2 | << Attr << "functions"; |
656 | 2 | return false; |
657 | 2 | } |
658 | 16 | return true; |
659 | 16 | } |
660 | | |
661 | 0 | static void matchRulesForCallableWhen(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
662 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function_is_member, /*IsSupported=*/LangOpts.CPlusPlus)); |
663 | 0 | } |
664 | | |
665 | 154 | static bool checkCallbackAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
666 | 154 | if (!D || (!isa<FunctionDecl>(D))) { |
667 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
668 | 0 | << Attr << "functions"; |
669 | 0 | return false; |
670 | 0 | } |
671 | 154 | return true; |
672 | 154 | } |
673 | | |
674 | 0 | static void matchRulesForCallback(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
675 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
676 | 0 | } |
677 | | |
678 | 37 | static bool checkCapabilityAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
679 | 37 | if (!D || (!isa<RecordDecl>(D) && !isa<TypedefNameDecl>(D)7 )) { |
680 | 2 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
681 | 2 | << Attr << "structs, unions, classes, and typedefs"; |
682 | 2 | return false; |
683 | 2 | } |
684 | 35 | return true; |
685 | 35 | } |
686 | | |
687 | 0 | static unsigned CapabilityAttrSpellingMap(const ParsedAttr &Attr) { |
688 | 0 | enum Spelling { |
689 | 0 | GNU_capability = 0, |
690 | 0 | CXX11_clang_capability = 1, |
691 | 0 | GNU_shared_capability = 2, |
692 | 0 | CXX11_clang_shared_capability = 3 |
693 | 0 | }; |
694 | 0 |
|
695 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
696 | 0 | switch (Idx) { |
697 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
698 | 0 | case 0: return GNU_capability; |
699 | 0 | case 1: return CXX11_clang_capability; |
700 | 0 | case 2: return GNU_shared_capability; |
701 | 0 | case 3: return CXX11_clang_shared_capability; |
702 | 0 | } |
703 | 0 | } |
704 | | |
705 | 0 | static void matchRulesForCapability(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
706 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
707 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_type_alias, /*IsSupported=*/true)); |
708 | 0 | } |
709 | | |
710 | 30 | static bool checkCarriesDependencyAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
711 | 30 | if (!D || (!isa<ParmVarDecl>(D) && !isa<ObjCMethodDecl>(D)16 && !isa<FunctionDecl>(D)16 )) { |
712 | 4 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
713 | 4 | << Attr << "parameters, Objective-C methods, and functions"; |
714 | 4 | return false; |
715 | 4 | } |
716 | 26 | return true; |
717 | 26 | } |
718 | | |
719 | 0 | static void matchRulesForCarriesDependency(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
720 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
721 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
722 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
723 | 0 | } |
724 | | |
725 | 57 | static bool isLocalVar(const Decl *D) { |
726 | 57 | if (const auto *S = dyn_cast<VarDecl>(D)) |
727 | 54 | return S->hasLocalStorage() && !isa<ParmVarDecl>(S)46 ; |
728 | 3 | return false; |
729 | 3 | } |
730 | | |
731 | 44 | static bool checkCleanupAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
732 | 44 | if (!D || (!isLocalVar(D))) { |
733 | 5 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
734 | 5 | << Attr << "local variables"; |
735 | 5 | return false; |
736 | 5 | } |
737 | 39 | return true; |
738 | 39 | } |
739 | | |
740 | 82 | static bool checkCodeSegAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
741 | 82 | if (!D || (!isa<FunctionDecl>(D) && !isa<CXXRecordDecl>(D)49 )) { |
742 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
743 | 0 | << Attr << "functions and classes"; |
744 | 0 | return false; |
745 | 0 | } |
746 | 82 | return true; |
747 | 82 | } |
748 | | |
749 | 27 | static bool checkColdAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
750 | 27 | if (!D || (!isa<FunctionDecl>(D))) { |
751 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
752 | 1 | << Attr << "functions"; |
753 | 1 | return false; |
754 | 1 | } |
755 | 26 | return true; |
756 | 26 | } |
757 | | |
758 | 0 | static void matchRulesForCold(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
759 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
760 | 0 | } |
761 | | |
762 | 9 | static bool checkCommonAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
763 | 9 | if (!D || (!isa<VarDecl>(D))) { |
764 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
765 | 0 | << Attr << "variables"; |
766 | 0 | return false; |
767 | 0 | } |
768 | 9 | return true; |
769 | 9 | } |
770 | | |
771 | 0 | static void matchRulesForCommon(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
772 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
773 | 0 | } |
774 | | |
775 | 40 | static bool checkConstructorAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
776 | 40 | if (!D || (!isa<FunctionDecl>(D))) { |
777 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
778 | 1 | << Attr << "functions"; |
779 | 1 | return false; |
780 | 1 | } |
781 | 39 | return true; |
782 | 39 | } |
783 | | |
784 | 0 | static void matchRulesForConstructor(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
785 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
786 | 0 | } |
787 | | |
788 | 9 | static bool checkConsumableAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
789 | 9 | if (!D || (!isa<CXXRecordDecl>(D))) { |
790 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
791 | 2 | << Attr << "classes"; |
792 | 2 | return false; |
793 | 2 | } |
794 | 7 | return true; |
795 | 7 | } |
796 | | |
797 | 0 | static void matchRulesForConsumable(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
798 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
799 | 0 | } |
800 | | |
801 | 2 | static bool checkConsumableAutoCastAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
802 | 2 | if (!D || (!isa<CXXRecordDecl>(D))) { |
803 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
804 | 0 | << Attr << "classes"; |
805 | 0 | return false; |
806 | 0 | } |
807 | 2 | return true; |
808 | 2 | } |
809 | | |
810 | 0 | static void matchRulesForConsumableAutoCast(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
811 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
812 | 0 | } |
813 | | |
814 | 2 | static bool checkConsumableSetOnReadAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
815 | 2 | if (!D || (!isa<CXXRecordDecl>(D))) { |
816 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
817 | 0 | << Attr << "classes"; |
818 | 0 | return false; |
819 | 0 | } |
820 | 2 | return true; |
821 | 2 | } |
822 | | |
823 | 0 | static void matchRulesForConsumableSetOnRead(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
824 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
825 | 0 | } |
826 | | |
827 | 4.69k | static bool checkConvergentAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
828 | 4.69k | if (!D || (!isa<FunctionDecl>(D))) { |
829 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
830 | 2 | << Attr << "functions"; |
831 | 2 | return false; |
832 | 2 | } |
833 | 4.68k | return true; |
834 | 4.68k | } |
835 | | |
836 | 0 | static void matchRulesForConvergent(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
837 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
838 | 0 | } |
839 | | |
840 | 3.49k | static bool checkDLLExportAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
841 | 3.49k | if (!D || (!isa<FunctionDecl>(D) && !isa<VarDecl>(D)1.66k && !isa<CXXRecordDecl>(D)787 && !isa<ObjCInterfaceDecl>(D)82 )) { |
842 | 68 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
843 | 68 | << Attr << "functions, variables, classes, and Objective-C interfaces"; |
844 | 68 | return false; |
845 | 68 | } |
846 | 3.42k | return true; |
847 | 3.42k | } |
848 | | |
849 | 15.2k | static bool isTargetx86x86_64armthumbaarch64Win32(const TargetInfo &Target) { |
850 | 15.2k | const llvm::Triple &T = Target.getTriple(); (void)T; |
851 | 15.2k | return true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_646.60k || T.getArch() == llvm::Triple::arm192 || T.getArch() == llvm::Triple::thumb192 || T.getArch() == llvm::Triple::aarch64118 ) && (T.getOS() == llvm::Triple::Win32)15.2k ; |
852 | 15.2k | } |
853 | | |
854 | 1 | static void matchRulesForDLLExport(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
855 | 1 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
856 | 1 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
857 | 1 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
858 | 1 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
859 | 1 | } |
860 | | |
861 | 0 | static bool checkDLLExportStaticLocalAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
862 | 0 | if (!D || (!isa<FunctionDecl>(D))) { |
863 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
864 | 0 | << Attr << "functions"; |
865 | 0 | return false; |
866 | 0 | } |
867 | 0 | return true; |
868 | 0 | } |
869 | | |
870 | 4.16k | static bool checkDLLImportAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
871 | 4.16k | if (!D || (!isa<FunctionDecl>(D) && !isa<VarDecl>(D)1.91k && !isa<CXXRecordDecl>(D)787 && !isa<ObjCInterfaceDecl>(D)87 )) { |
872 | 74 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
873 | 74 | << Attr << "functions, variables, classes, and Objective-C interfaces"; |
874 | 74 | return false; |
875 | 74 | } |
876 | 4.09k | return true; |
877 | 4.09k | } |
878 | | |
879 | 0 | static void matchRulesForDLLImport(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
880 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
881 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
882 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
883 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
884 | 0 | } |
885 | | |
886 | 0 | static bool checkDLLImportStaticLocalAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
887 | 0 | if (!D || (!isa<FunctionDecl>(D))) { |
888 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
889 | 0 | << Attr << "functions"; |
890 | 0 | return false; |
891 | 0 | } |
892 | 0 | return true; |
893 | 0 | } |
894 | | |
895 | 26 | static bool checkDestructorAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
896 | 26 | if (!D || (!isa<FunctionDecl>(D))) { |
897 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
898 | 1 | << Attr << "functions"; |
899 | 1 | return false; |
900 | 1 | } |
901 | 25 | return true; |
902 | 25 | } |
903 | | |
904 | 0 | static void matchRulesForDestructor(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
905 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
906 | 0 | } |
907 | | |
908 | 5.15k | static bool checkDiagnoseIfAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
909 | 5.15k | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)2 && !isa<ObjCPropertyDecl>(D)1 )) { |
910 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
911 | 0 | << Attr << "functions, Objective-C methods, and Objective-C properties"; |
912 | 0 | return false; |
913 | 0 | } |
914 | 5.15k | return true; |
915 | 5.15k | } |
916 | | |
917 | 58 | static bool checkDisableTailCallsAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
918 | 58 | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)1 )) { |
919 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
920 | 1 | << Attr << "functions and Objective-C methods"; |
921 | 1 | return false; |
922 | 1 | } |
923 | 57 | return true; |
924 | 57 | } |
925 | | |
926 | 1 | static void matchRulesForDisableTailCalls(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
927 | 1 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
928 | 1 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
929 | 1 | } |
930 | | |
931 | 14 | static bool checkEmptyBasesAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
932 | 14 | if (!D || (!isa<CXXRecordDecl>(D))) { |
933 | 4 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
934 | 4 | << Attr << "classes"; |
935 | 4 | return false; |
936 | 4 | } |
937 | 10 | return true; |
938 | 10 | } |
939 | | |
940 | 52 | static bool isTargetx86x86_64armthumbaarch64(const TargetInfo &Target) { |
941 | 52 | const llvm::Triple &T = Target.getTriple(); (void)T; |
942 | 52 | return true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_6410 || T.getArch() == llvm::Triple::arm0 || T.getArch() == llvm::Triple::thumb0 || T.getArch() == llvm::Triple::aarch640 ) && ( Target.getCXXABI().isMicrosoft() ); |
943 | 52 | } |
944 | | |
945 | 14.0k | static bool checkEnableIfAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
946 | 14.0k | if (!D || (!isa<FunctionDecl>(D))) { |
947 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
948 | 1 | << Attr << "functions"; |
949 | 1 | return false; |
950 | 1 | } |
951 | 14.0k | return true; |
952 | 14.0k | } |
953 | | |
954 | 0 | static void matchRulesForEnableIf(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
955 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
956 | 0 | } |
957 | | |
958 | 2.76k | static bool checkEnumExtensibilityAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
959 | 2.76k | if (!D || (!isa<EnumDecl>(D))) { |
960 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
961 | 1 | << Attr << "enums"; |
962 | 1 | return false; |
963 | 1 | } |
964 | 2.75k | return true; |
965 | 2.75k | } |
966 | | |
967 | 0 | static void matchRulesForEnumExtensibility(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
968 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_enum, /*IsSupported=*/true)); |
969 | 0 | } |
970 | | |
971 | 1.04M | static bool checkExcludeFromExplicitInstantiationAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
972 | 1.04M | if (!D || (!isa<VarDecl>(D) && !isa<FunctionDecl>(D)1.04M && !isa<CXXRecordDecl>(D)5 )) { |
973 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
974 | 1 | << Attr << "variables, functions, and classes"; |
975 | 1 | return false; |
976 | 1 | } |
977 | 1.04M | return true; |
978 | 1.04M | } |
979 | | |
980 | 0 | static void matchRulesForExcludeFromExplicitInstantiation(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
981 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
982 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
983 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
984 | 0 | } |
985 | | |
986 | 96 | static bool checkExclusiveTrylockFunctionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
987 | 96 | if (!D || (!isa<FunctionDecl>(D))) { |
988 | 15 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
989 | 15 | << Attr << "functions"; |
990 | 15 | return false; |
991 | 15 | } |
992 | 81 | return true; |
993 | 81 | } |
994 | | |
995 | 2.00k | static bool checkExtVectorTypeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
996 | 2.00k | if (!D || (!isa<TypedefNameDecl>(D))) { |
997 | 4 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
998 | 4 | << Attr << "typedefs"; |
999 | 4 | return false; |
1000 | 4 | } |
1001 | 2.00k | return true; |
1002 | 2.00k | } |
1003 | | |
1004 | 64 | static bool checkExternalSourceSymbolAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1005 | 64 | if (!D || (!isa<NamedDecl>(D))) { |
1006 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1007 | 1 | << Attr << "named declarations"; |
1008 | 1 | return false; |
1009 | 1 | } |
1010 | 63 | return true; |
1011 | 63 | } |
1012 | | |
1013 | 2 | static void matchRulesForExternalSourceSymbol(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1014 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
1015 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_enum, /*IsSupported=*/true)); |
1016 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_enum_constant, /*IsSupported=*/true)); |
1017 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_field, /*IsSupported=*/true)); |
1018 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1019 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_namespace, /*IsSupported=*/LangOpts.CPlusPlus)); |
1020 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_category, /*IsSupported=*/LangOpts.ObjC)); |
1021 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_implementation, /*IsSupported=*/LangOpts.ObjC)); |
1022 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
1023 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
1024 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_property, /*IsSupported=*/LangOpts.ObjC)); |
1025 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_protocol, /*IsSupported=*/LangOpts.ObjC)); |
1026 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
1027 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_type_alias, /*IsSupported=*/true)); |
1028 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
1029 | 2 | } |
1030 | | |
1031 | 1.06k | static bool checkFlagEnumAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1032 | 1.06k | if (!D || (!isa<EnumDecl>(D))) { |
1033 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1034 | 0 | << Attr << "enums"; |
1035 | 0 | return false; |
1036 | 0 | } |
1037 | 1.06k | return true; |
1038 | 1.06k | } |
1039 | | |
1040 | 0 | static void matchRulesForFlagEnum(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1041 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_enum, /*IsSupported=*/true)); |
1042 | 0 | } |
1043 | | |
1044 | 18 | static bool checkFlattenAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1045 | 18 | if (!D || (!isa<FunctionDecl>(D))) { |
1046 | 6 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1047 | 6 | << Attr << "functions"; |
1048 | 6 | return false; |
1049 | 6 | } |
1050 | 12 | return true; |
1051 | 12 | } |
1052 | | |
1053 | 0 | static void matchRulesForFlatten(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1054 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1055 | 0 | } |
1056 | | |
1057 | 51.5k | static bool checkFormatAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1058 | 51.5k | if (!D || (!isa<ObjCMethodDecl>(D) && !isa<BlockDecl>(D)51.3k && !isHasFunctionProto(D)51.2k )) { |
1059 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1060 | 0 | << Attr << "Objective-C methods, blocks, and non-K&R-style functions"; |
1061 | 0 | return false; |
1062 | 0 | } |
1063 | 51.5k | return true; |
1064 | 51.5k | } |
1065 | | |
1066 | 345 | static bool checkFormatArgAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1067 | 345 | if (!D || (!isa<ObjCMethodDecl>(D) && !isHasFunctionProto(D)328 )) { |
1068 | 3 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1069 | 3 | << Attr << "Objective-C methods and non-K&R-style functions"; |
1070 | 3 | return false; |
1071 | 3 | } |
1072 | 342 | return true; |
1073 | 342 | } |
1074 | | |
1075 | 4.58k | static bool checkGNUInlineAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1076 | 4.58k | if (!D || (!isa<FunctionDecl>(D))) { |
1077 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1078 | 0 | << Attr << "functions"; |
1079 | 0 | return false; |
1080 | 0 | } |
1081 | 4.58k | return true; |
1082 | 4.58k | } |
1083 | | |
1084 | 0 | static void matchRulesForGNUInline(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1085 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1086 | 0 | } |
1087 | | |
1088 | 572 | static bool checkGuardedByAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1089 | 572 | if (!D || (!isa<FieldDecl>(D) && !isSharedVar(D)138 )) { |
1090 | 14 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1091 | 14 | << Attr << "non-static data members and global variables"; |
1092 | 14 | return false; |
1093 | 14 | } |
1094 | 558 | return true; |
1095 | 558 | } |
1096 | | |
1097 | 31 | static bool checkGuardedVarAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1098 | 31 | if (!D || (!isa<FieldDecl>(D) && !isSharedVar(D)25 )) { |
1099 | 12 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1100 | 12 | << Attr << "non-static data members and global variables"; |
1101 | 12 | return false; |
1102 | 12 | } |
1103 | 19 | return true; |
1104 | 19 | } |
1105 | | |
1106 | 10 | static bool checkHIPPinnedShadowAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1107 | 10 | if (!D || (!isa<VarDecl>(D))) { |
1108 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1109 | 0 | << Attr << "variables"; |
1110 | 0 | return false; |
1111 | 0 | } |
1112 | 10 | return true; |
1113 | 10 | } |
1114 | | |
1115 | 10 | static bool checkHIPLangOpts(Sema &S, const ParsedAttr &Attr) { |
1116 | 10 | auto &LangOpts = S.LangOpts; |
1117 | 10 | if (LangOpts.HIP) |
1118 | 10 | return true; |
1119 | 0 | |
1120 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
1121 | 0 | return false; |
1122 | 0 | } |
1123 | | |
1124 | 0 | static void matchRulesForHIPPinnedShadow(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1125 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
1126 | 0 | } |
1127 | | |
1128 | 4 | static bool checkHotAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1129 | 4 | if (!D || (!isa<FunctionDecl>(D))) { |
1130 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1131 | 1 | << Attr << "functions"; |
1132 | 1 | return false; |
1133 | 1 | } |
1134 | 3 | return true; |
1135 | 3 | } |
1136 | | |
1137 | 0 | static void matchRulesForHot(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1138 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1139 | 0 | } |
1140 | | |
1141 | 73 | static bool isObjCInstanceMethod(const Decl *D) { |
1142 | 73 | if (const auto *S = dyn_cast<ObjCMethodDecl>(D)) |
1143 | 61 | return S->isInstanceMethod(); |
1144 | 12 | return false; |
1145 | 12 | } |
1146 | | |
1147 | 57 | static bool checkIBActionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1148 | 57 | if (!D || (!isObjCInstanceMethod(D))) { |
1149 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1150 | 2 | << Attr << "Objective-C instance methods"; |
1151 | 2 | return false; |
1152 | 2 | } |
1153 | 55 | return true; |
1154 | 55 | } |
1155 | | |
1156 | 0 | static void matchRulesForIBAction(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1157 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method_is_instance, /*IsSupported=*/LangOpts.ObjC)); |
1158 | 0 | } |
1159 | | |
1160 | 12 | static bool checkIFuncAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1161 | 12 | if (!D || (!isa<FunctionDecl>(D))) { |
1162 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1163 | 0 | << Attr << "functions"; |
1164 | 0 | return false; |
1165 | 0 | } |
1166 | 12 | return true; |
1167 | 12 | } |
1168 | | |
1169 | 25 | static bool isTargetELF(const TargetInfo &Target) { |
1170 | 25 | const llvm::Triple &T = Target.getTriple(); (void)T; |
1171 | 25 | return true && (T.getObjectFormat() == llvm::Triple::ELF); |
1172 | 25 | } |
1173 | | |
1174 | 0 | static void matchRulesForIFunc(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1175 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1176 | 0 | } |
1177 | | |
1178 | 610 | static bool checkInitPriorityAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1179 | 610 | if (!D || (!isa<VarDecl>(D))) { |
1180 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1181 | 1 | << Attr << "variables"; |
1182 | 1 | return false; |
1183 | 1 | } |
1184 | 609 | return true; |
1185 | 609 | } |
1186 | | |
1187 | 0 | static void matchRulesForInitPriority(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1188 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
1189 | 0 | } |
1190 | | |
1191 | 165 | static bool checkInternalLinkageAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1192 | 165 | if (!D || (!isa<VarDecl>(D) && !isa<FunctionDecl>(D)30 && !isa<CXXRecordDecl>(D)8 )) { |
1193 | 5 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1194 | 5 | << Attr << "variables, functions, and classes"; |
1195 | 5 | return false; |
1196 | 5 | } |
1197 | 160 | return true; |
1198 | 160 | } |
1199 | | |
1200 | 0 | static void matchRulesForInternalLinkage(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1201 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
1202 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1203 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
1204 | 0 | } |
1205 | | |
1206 | 11 | static bool checkLTOVisibilityPublicAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1207 | 11 | if (!D || (!isa<RecordDecl>(D))) { |
1208 | 5 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1209 | 5 | << Attr << "structs, unions, and classes"; |
1210 | 5 | return false; |
1211 | 5 | } |
1212 | 6 | return true; |
1213 | 6 | } |
1214 | | |
1215 | 0 | static void matchRulesForLTOVisibilityPublic(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1216 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
1217 | 0 | } |
1218 | | |
1219 | 8 | static bool checkLayoutVersionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1220 | 8 | if (!D || (!isa<CXXRecordDecl>(D))) { |
1221 | 4 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1222 | 4 | << Attr << "classes"; |
1223 | 4 | return false; |
1224 | 4 | } |
1225 | 4 | return true; |
1226 | 4 | } |
1227 | | |
1228 | 1 | static bool isImplicitObjectParameter(const Decl *D) { |
1229 | 1 | if (const auto *S = dyn_cast<FunctionDecl>(D)) |
1230 | 0 | return static_cast<void>(S), false; |
1231 | 1 | return false; |
1232 | 1 | } |
1233 | | |
1234 | 13 | static bool checkLifetimeBoundAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1235 | 13 | if (!D || (!isa<ParmVarDecl>(D) && !isImplicitObjectParameter(D)1 )) { |
1236 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1237 | 1 | << Attr << "parameters and implicit object parameters"; |
1238 | 1 | return false; |
1239 | 1 | } |
1240 | 12 | return true; |
1241 | 12 | } |
1242 | | |
1243 | 217 | static bool checkCPlusPlusLangOpts(Sema &S, const ParsedAttr &Attr) { |
1244 | 217 | auto &LangOpts = S.LangOpts; |
1245 | 217 | if (LangOpts.CPlusPlus) |
1246 | 216 | return true; |
1247 | 1 | |
1248 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
1249 | 1 | return false; |
1250 | 1 | } |
1251 | | |
1252 | 101 | static bool checkLockReturnedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1253 | 101 | if (!D || (!isa<FunctionDecl>(D))) { |
1254 | 15 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1255 | 15 | << Attr << "functions"; |
1256 | 15 | return false; |
1257 | 15 | } |
1258 | 86 | return true; |
1259 | 86 | } |
1260 | | |
1261 | 62 | static bool checkLockableAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1262 | 62 | if (!D || (!isa<RecordDecl>(D))) { |
1263 | 18 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1264 | 18 | << Attr << "structs, unions, and classes"; |
1265 | 18 | return false; |
1266 | 18 | } |
1267 | 44 | return true; |
1268 | 44 | } |
1269 | | |
1270 | 0 | static void matchRulesForLockable(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1271 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
1272 | 0 | } |
1273 | | |
1274 | 151 | static bool checkLocksExcludedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1275 | 151 | if (!D || (!isa<FunctionDecl>(D))) { |
1276 | 15 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1277 | 15 | << Attr << "functions"; |
1278 | 15 | return false; |
1279 | 15 | } |
1280 | 136 | return true; |
1281 | 136 | } |
1282 | | |
1283 | 0 | static unsigned LoopHintAttrSpellingMap(const ParsedAttr &Attr) { |
1284 | 0 | enum Spelling { |
1285 | 0 | Pragma_clang_loop = 0, |
1286 | 0 | Pragma_unroll = 1, |
1287 | 0 | Pragma_nounroll = 2, |
1288 | 0 | Pragma_unroll_and_jam = 3, |
1289 | 0 | Pragma_nounroll_and_jam = 4 |
1290 | 0 | }; |
1291 | 0 |
|
1292 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
1293 | 0 | switch (Idx) { |
1294 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
1295 | 0 | case 0: return Pragma_clang_loop; |
1296 | 0 | case 1: return Pragma_unroll; |
1297 | 0 | case 2: return Pragma_nounroll; |
1298 | 0 | case 3: return Pragma_unroll_and_jam; |
1299 | 0 | case 4: return Pragma_nounroll_and_jam; |
1300 | 0 | } |
1301 | 0 | } |
1302 | | |
1303 | 36 | static bool checkMIGServerRoutineAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1304 | 36 | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)9 && !isa<BlockDecl>(D)5 )) { |
1305 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1306 | 1 | << Attr << "functions, Objective-C methods, and blocks"; |
1307 | 1 | return false; |
1308 | 1 | } |
1309 | 35 | return true; |
1310 | 35 | } |
1311 | | |
1312 | 0 | static void matchRulesForMIGServerRoutine(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1313 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1314 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
1315 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_block, /*IsSupported=*/LangOpts.Blocks)); |
1316 | 0 | } |
1317 | | |
1318 | 8 | static bool checkMSAllocatorAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1319 | 8 | if (!D || (!isa<FunctionDecl>(D))) { |
1320 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1321 | 2 | << Attr << "functions"; |
1322 | 2 | return false; |
1323 | 2 | } |
1324 | 6 | return true; |
1325 | 6 | } |
1326 | | |
1327 | 113 | static bool checkMicrosoftExtLangOpts(Sema &S, const ParsedAttr &Attr) { |
1328 | 113 | auto &LangOpts = S.LangOpts; |
1329 | 113 | if (LangOpts.MicrosoftExt) |
1330 | 113 | return true; |
1331 | 0 | |
1332 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
1333 | 0 | return false; |
1334 | 0 | } |
1335 | | |
1336 | 58 | static unsigned MSInheritanceAttrSpellingMap(const ParsedAttr &Attr) { |
1337 | 58 | enum Spelling { |
1338 | 58 | Keyword_single_inheritance = 0, |
1339 | 58 | Keyword_multiple_inheritance = 1, |
1340 | 58 | Keyword_virtual_inheritance = 2, |
1341 | 58 | Keyword_unspecified_inheritance = 3 |
1342 | 58 | }; |
1343 | 58 | |
1344 | 58 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
1345 | 58 | switch (Idx) { |
1346 | 58 | default: 0 llvm_unreachable0 ("Unknown spelling list index"); |
1347 | 58 | case 0: return Keyword_single_inheritance25 ; |
1348 | 58 | case 1: return Keyword_multiple_inheritance20 ; |
1349 | 58 | case 2: return Keyword_virtual_inheritance13 ; |
1350 | 58 | case 3: return Keyword_unspecified_inheritance0 ; |
1351 | 58 | } |
1352 | 58 | } |
1353 | | |
1354 | 10 | static bool checkMSNoVTableAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1355 | 10 | if (!D || (!isa<CXXRecordDecl>(D))) { |
1356 | 4 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1357 | 4 | << Attr << "classes"; |
1358 | 4 | return false; |
1359 | 4 | } |
1360 | 6 | return true; |
1361 | 6 | } |
1362 | | |
1363 | 75 | static bool checkMSStructAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1364 | 75 | if (!D || (!isa<RecordDecl>(D))) { |
1365 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1366 | 2 | << Attr << "structs, unions, and classes"; |
1367 | 2 | return false; |
1368 | 2 | } |
1369 | 73 | return true; |
1370 | 73 | } |
1371 | | |
1372 | 0 | static void matchRulesForMSStruct(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1373 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
1374 | 0 | } |
1375 | | |
1376 | 7 | static bool checkMicroMipsAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1377 | 7 | if (!D || (!isa<FunctionDecl>(D))) { |
1378 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1379 | 1 | << Attr << "functions"; |
1380 | 1 | return false; |
1381 | 1 | } |
1382 | 6 | return true; |
1383 | 6 | } |
1384 | | |
1385 | 56 | static bool isTargetmipsmipsel(const TargetInfo &Target) { |
1386 | 56 | const llvm::Triple &T = Target.getTriple(); (void)T; |
1387 | 56 | return true && (T.getArch() == llvm::Triple::mips || T.getArch() == llvm::Triple::mipsel24 ); |
1388 | 56 | } |
1389 | | |
1390 | 0 | static void matchRulesForMicroMips(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1391 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1392 | 0 | } |
1393 | | |
1394 | 25 | static bool checkMinSizeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1395 | 25 | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)2 )) { |
1396 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1397 | 1 | << Attr << "functions and Objective-C methods"; |
1398 | 1 | return false; |
1399 | 1 | } |
1400 | 24 | return true; |
1401 | 24 | } |
1402 | | |
1403 | 0 | static void matchRulesForMinSize(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1404 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1405 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
1406 | 0 | } |
1407 | | |
1408 | 701k | static bool checkMinVectorWidthAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1409 | 701k | if (!D || (!isa<FunctionDecl>(D))) { |
1410 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1411 | 1 | << Attr << "functions"; |
1412 | 1 | return false; |
1413 | 1 | } |
1414 | 701k | return true; |
1415 | 701k | } |
1416 | | |
1417 | 0 | static void matchRulesForMinVectorWidth(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1418 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1419 | 0 | } |
1420 | | |
1421 | 14 | static bool checkMips16AppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1422 | 14 | if (!D || (!isa<FunctionDecl>(D))) { |
1423 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1424 | 1 | << Attr << "functions"; |
1425 | 1 | return false; |
1426 | 1 | } |
1427 | 13 | return true; |
1428 | 13 | } |
1429 | | |
1430 | 0 | static void matchRulesForMips16(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1431 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1432 | 0 | } |
1433 | | |
1434 | 24 | static bool checkMipsLongCallAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1435 | 24 | if (!D || (!isa<FunctionDecl>(D))) { |
1436 | 4 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1437 | 4 | << Attr << "functions"; |
1438 | 4 | return false; |
1439 | 4 | } |
1440 | 20 | return true; |
1441 | 20 | } |
1442 | | |
1443 | 80 | static bool isTargetmipsmipselmips64mips64el(const TargetInfo &Target) { |
1444 | 80 | const llvm::Triple &T = Target.getTriple(); (void)T; |
1445 | 80 | return true && (T.getArch() == llvm::Triple::mips || T.getArch() == llvm::Triple::mipsel40 || T.getArch() == llvm::Triple::mips6440 || T.getArch() == llvm::Triple::mips64el0 ); |
1446 | 80 | } |
1447 | | |
1448 | 0 | static unsigned MipsLongCallAttrSpellingMap(const ParsedAttr &Attr) { |
1449 | 0 | enum Spelling { |
1450 | 0 | GNU_long_call = 0, |
1451 | 0 | CXX11_gnu_long_call = 1, |
1452 | 0 | GNU_far = 2, |
1453 | 0 | CXX11_gnu_far = 3 |
1454 | 0 | }; |
1455 | 0 |
|
1456 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
1457 | 0 | switch (Idx) { |
1458 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
1459 | 0 | case 0: return GNU_long_call; |
1460 | 0 | case 1: return CXX11_gnu_long_call; |
1461 | 0 | case 2: return GNU_far; |
1462 | 0 | case 3: return CXX11_gnu_far; |
1463 | 0 | } |
1464 | 0 | } |
1465 | | |
1466 | 0 | static void matchRulesForMipsLongCall(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1467 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1468 | 0 | } |
1469 | | |
1470 | 24 | static bool checkMipsShortCallAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1471 | 24 | if (!D || (!isa<FunctionDecl>(D))) { |
1472 | 4 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1473 | 4 | << Attr << "functions"; |
1474 | 4 | return false; |
1475 | 4 | } |
1476 | 20 | return true; |
1477 | 20 | } |
1478 | | |
1479 | 0 | static unsigned MipsShortCallAttrSpellingMap(const ParsedAttr &Attr) { |
1480 | 0 | enum Spelling { |
1481 | 0 | GNU_short_call = 0, |
1482 | 0 | CXX11_gnu_short_call = 1, |
1483 | 0 | GNU_near = 2, |
1484 | 0 | CXX11_gnu_near = 3 |
1485 | 0 | }; |
1486 | 0 |
|
1487 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
1488 | 0 | switch (Idx) { |
1489 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
1490 | 0 | case 0: return GNU_short_call; |
1491 | 0 | case 1: return CXX11_gnu_short_call; |
1492 | 0 | case 2: return GNU_near; |
1493 | 0 | case 3: return CXX11_gnu_near; |
1494 | 0 | } |
1495 | 0 | } |
1496 | | |
1497 | 0 | static void matchRulesForMipsShortCall(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1498 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1499 | 0 | } |
1500 | | |
1501 | 2.64k | static bool checkModeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1502 | 2.64k | if (!D || (!isa<VarDecl>(D) && !isa<EnumDecl>(D)2.62k && !isa<TypedefNameDecl>(D)2.60k && !isa<FieldDecl>(D)24 )) { |
1503 | 15 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1504 | 15 | << Attr << "variables, enums, typedefs, and non-static data members"; |
1505 | 15 | return false; |
1506 | 15 | } |
1507 | 2.62k | return true; |
1508 | 2.62k | } |
1509 | | |
1510 | 130 | static bool checkNSConsumedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1511 | 130 | if (!D || (!isa<ParmVarDecl>(D))) { |
1512 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1513 | 0 | << Attr << "parameters"; |
1514 | 0 | return false; |
1515 | 0 | } |
1516 | 130 | return true; |
1517 | 130 | } |
1518 | | |
1519 | 0 | static void matchRulesForNSConsumed(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1520 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
1521 | 0 | } |
1522 | | |
1523 | 44 | static bool checkNSConsumesSelfAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1524 | 44 | if (!D || (!isa<ObjCMethodDecl>(D))) { |
1525 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1526 | 0 | << Attr << "Objective-C methods"; |
1527 | 0 | return false; |
1528 | 0 | } |
1529 | 44 | return true; |
1530 | 44 | } |
1531 | | |
1532 | 0 | static void matchRulesForNSConsumesSelf(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1533 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
1534 | 0 | } |
1535 | | |
1536 | 34 | static bool checkNakedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1537 | 34 | if (!D || (!isa<FunctionDecl>(D))) { |
1538 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1539 | 1 | << Attr << "functions"; |
1540 | 1 | return false; |
1541 | 1 | } |
1542 | 33 | return true; |
1543 | 33 | } |
1544 | | |
1545 | 0 | static void matchRulesForNaked(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1546 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1547 | 0 | } |
1548 | | |
1549 | 2 | static bool checkNoAliasAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1550 | 2 | if (!D || (!isa<FunctionDecl>(D))) { |
1551 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1552 | 0 | << Attr << "functions"; |
1553 | 0 | return false; |
1554 | 0 | } |
1555 | 2 | return true; |
1556 | 2 | } |
1557 | | |
1558 | 4 | static bool checkNoCommonAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1559 | 4 | if (!D || (!isa<VarDecl>(D))) { |
1560 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1561 | 0 | << Attr << "variables"; |
1562 | 0 | return false; |
1563 | 0 | } |
1564 | 4 | return true; |
1565 | 4 | } |
1566 | | |
1567 | 0 | static void matchRulesForNoCommon(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1568 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
1569 | 0 | } |
1570 | | |
1571 | 100 | static bool isNonParmVar(const Decl *D) { |
1572 | 100 | if (const auto *S = dyn_cast<VarDecl>(D)) |
1573 | 40 | return S->getKind() != Decl::ParmVar; |
1574 | 60 | return false; |
1575 | 60 | } |
1576 | | |
1577 | 1.03M | static bool checkNoDebugAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1578 | 1.03M | if (!D || (!isa<TypedefNameDecl>(D) && !isFunctionLike(D)958k && !isa<ObjCMethodDecl>(D)12 && !isNonParmVar(D)11 )) { |
1579 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1580 | 1 | << Attr << "typedefs, functions, function pointers, Objective-C methods, and variables"; |
1581 | 1 | return false; |
1582 | 1 | } |
1583 | 1.03M | return true; |
1584 | 1.03M | } |
1585 | | |
1586 | 0 | static void matchRulesForNoDebug(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1587 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_type_alias, /*IsSupported=*/true)); |
1588 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/true)); |
1589 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
1590 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_not_is_parameter, /*IsSupported=*/true)); |
1591 | 0 | } |
1592 | | |
1593 | 54 | static bool checkNoDestroyAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1594 | 54 | if (!D || (!isa<VarDecl>(D))) { |
1595 | 4 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1596 | 4 | << Attr << "variables"; |
1597 | 4 | return false; |
1598 | 4 | } |
1599 | 50 | return true; |
1600 | 50 | } |
1601 | | |
1602 | 0 | static void matchRulesForNoDestroy(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1603 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
1604 | 0 | } |
1605 | | |
1606 | 8 | static bool checkNoDuplicateAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1607 | 8 | if (!D || (!isa<FunctionDecl>(D))) { |
1608 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1609 | 1 | << Attr << "functions"; |
1610 | 1 | return false; |
1611 | 1 | } |
1612 | 7 | return true; |
1613 | 7 | } |
1614 | | |
1615 | 0 | static void matchRulesForNoDuplicate(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1616 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1617 | 0 | } |
1618 | | |
1619 | 1.64k | static bool checkNoEscapeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1620 | 1.64k | if (!D || (!isa<ParmVarDecl>(D))) { |
1621 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1622 | 2 | << Attr << "parameters"; |
1623 | 2 | return false; |
1624 | 2 | } |
1625 | 1.63k | return true; |
1626 | 1.63k | } |
1627 | | |
1628 | 0 | static void matchRulesForNoEscape(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1629 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
1630 | 0 | } |
1631 | | |
1632 | 13.0k | static bool checkNoInlineAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1633 | 13.0k | if (!D || (!isa<FunctionDecl>(D))) { |
1634 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1635 | 1 | << Attr << "functions"; |
1636 | 1 | return false; |
1637 | 1 | } |
1638 | 13.0k | return true; |
1639 | 13.0k | } |
1640 | | |
1641 | 0 | static void matchRulesForNoInline(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1642 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1643 | 0 | } |
1644 | | |
1645 | 27 | static bool checkNoInstrumentFunctionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1646 | 27 | if (!D || (!isa<FunctionDecl>(D))) { |
1647 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1648 | 0 | << Attr << "functions"; |
1649 | 0 | return false; |
1650 | 0 | } |
1651 | 27 | return true; |
1652 | 27 | } |
1653 | | |
1654 | 0 | static void matchRulesForNoInstrumentFunction(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1655 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1656 | 0 | } |
1657 | | |
1658 | 4 | static bool checkNoMicroMipsAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1659 | 4 | if (!D || (!isa<FunctionDecl>(D))) { |
1660 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1661 | 1 | << Attr << "functions"; |
1662 | 1 | return false; |
1663 | 1 | } |
1664 | 3 | return true; |
1665 | 3 | } |
1666 | | |
1667 | 0 | static void matchRulesForNoMicroMips(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1668 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1669 | 0 | } |
1670 | | |
1671 | 7 | static bool checkNoMips16AppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1672 | 7 | if (!D || (!isa<FunctionDecl>(D))) { |
1673 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1674 | 1 | << Attr << "functions"; |
1675 | 1 | return false; |
1676 | 1 | } |
1677 | 6 | return true; |
1678 | 6 | } |
1679 | | |
1680 | 0 | static void matchRulesForNoMips16(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1681 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1682 | 0 | } |
1683 | | |
1684 | 5.20k | static bool checkNoSanitizeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1685 | 5.20k | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)3 && !isGlobalVar(D)2 )) { |
1686 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1687 | 0 | << Attr << "functions, Objective-C methods, and global variables"; |
1688 | 0 | return false; |
1689 | 0 | } |
1690 | 5.20k | return true; |
1691 | 5.20k | } |
1692 | | |
1693 | 0 | static void matchRulesForNoSanitize(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1694 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1695 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
1696 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/true)); |
1697 | 0 | } |
1698 | | |
1699 | 98 | static bool checkNoSanitizeSpecificAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1700 | 98 | if (!D || (!isa<FunctionDecl>(D) && !isGlobalVar(D)14 )) { |
1701 | 12 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1702 | 12 | << Attr << "functions and global variables"; |
1703 | 12 | return false; |
1704 | 12 | } |
1705 | 86 | return true; |
1706 | 86 | } |
1707 | | |
1708 | 0 | static void matchRulesForNoSanitizeSpecific(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1709 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1710 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/true)); |
1711 | 0 | } |
1712 | | |
1713 | 35 | static bool checkNoSpeculativeLoadHardeningAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1714 | 35 | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)6 )) { |
1715 | 6 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1716 | 6 | << Attr << "functions and Objective-C methods"; |
1717 | 6 | return false; |
1718 | 6 | } |
1719 | 29 | return true; |
1720 | 29 | } |
1721 | | |
1722 | 0 | static void matchRulesForNoSpeculativeLoadHardening(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1723 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1724 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
1725 | 0 | } |
1726 | | |
1727 | 22 | static bool checkNoSplitStackAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1728 | 22 | if (!D || (!isa<FunctionDecl>(D))) { |
1729 | 6 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1730 | 6 | << Attr << "functions"; |
1731 | 6 | return false; |
1732 | 6 | } |
1733 | 16 | return true; |
1734 | 16 | } |
1735 | | |
1736 | 0 | static void matchRulesForNoSplitStack(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1737 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1738 | 0 | } |
1739 | | |
1740 | 12 | static bool checkNoStackProtectorAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1741 | 12 | if (!D || (!isa<FunctionDecl>(D))) { |
1742 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1743 | 1 | << Attr << "functions"; |
1744 | 1 | return false; |
1745 | 1 | } |
1746 | 11 | return true; |
1747 | 11 | } |
1748 | | |
1749 | 0 | static void matchRulesForNoStackProtector(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1750 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1751 | 0 | } |
1752 | | |
1753 | 64 | static bool checkNoThreadSafetyAnalysisAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1754 | 64 | if (!D || (!isa<FunctionDecl>(D))) { |
1755 | 18 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1756 | 18 | << Attr << "functions"; |
1757 | 18 | return false; |
1758 | 18 | } |
1759 | 46 | return true; |
1760 | 46 | } |
1761 | | |
1762 | 0 | static void matchRulesForNoThreadSafetyAnalysis(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1763 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1764 | 0 | } |
1765 | | |
1766 | 5.52k | static bool checkNoThrowAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1767 | 5.52k | if (!D || (!isFunctionLike(D))) { |
1768 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1769 | 0 | << Attr << "functions and function pointers"; |
1770 | 0 | return false; |
1771 | 0 | } |
1772 | 5.52k | return true; |
1773 | 5.52k | } |
1774 | | |
1775 | 0 | static void matchRulesForNoThrow(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1776 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/true)); |
1777 | 0 | } |
1778 | | |
1779 | 68 | static bool isNonBitField(const Decl *D) { |
1780 | 68 | if (const auto *S = dyn_cast<FieldDecl>(D)) |
1781 | 62 | return !S->isBitField(); |
1782 | 6 | return false; |
1783 | 6 | } |
1784 | | |
1785 | 68 | static bool checkNoUniqueAddressAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1786 | 68 | if (!D || (!isNonBitField(D))) { |
1787 | 7 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1788 | 7 | << Attr << "non-bit-field non-static data members"; |
1789 | 7 | return false; |
1790 | 7 | } |
1791 | 61 | return true; |
1792 | 61 | } |
1793 | | |
1794 | 142 | static bool isTarget(const TargetInfo &Target) { |
1795 | 142 | const llvm::Triple &T = Target.getTriple(); (void)T; |
1796 | 142 | return true && ( Target.getCXXABI().isItaniumFamily() ); |
1797 | 142 | } |
1798 | | |
1799 | 5.96k | static bool checkNonNullAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1800 | 5.96k | if (!D || (!isa<ObjCMethodDecl>(D) && !isHasFunctionProto(D)5.96k && !isa<ParmVarDecl>(D)27 )) { |
1801 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1802 | 2 | << Attr << "functions, methods, and parameters"; |
1803 | 2 | return false; |
1804 | 2 | } |
1805 | 5.96k | return true; |
1806 | 5.96k | } |
1807 | | |
1808 | 208 | static bool checkNotTailCalledAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1809 | 208 | if (!D || (!isa<FunctionDecl>(D))) { |
1810 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1811 | 1 | << Attr << "functions"; |
1812 | 1 | return false; |
1813 | 1 | } |
1814 | 207 | return true; |
1815 | 207 | } |
1816 | | |
1817 | 0 | static void matchRulesForNotTailCalled(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1818 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1819 | 0 | } |
1820 | | |
1821 | 12 | static bool checkOSConsumedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1822 | 12 | if (!D || (!isa<ParmVarDecl>(D))) { |
1823 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1824 | 1 | << Attr << "parameters"; |
1825 | 1 | return false; |
1826 | 1 | } |
1827 | 11 | return true; |
1828 | 11 | } |
1829 | | |
1830 | 0 | static void matchRulesForOSConsumed(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1831 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
1832 | 0 | } |
1833 | | |
1834 | 5 | static bool isNonStaticCXXMethod(const Decl *D) { |
1835 | 5 | if (const auto *S = dyn_cast<CXXMethodDecl>(D)) |
1836 | 4 | return !S->isStatic(); |
1837 | 1 | return false; |
1838 | 1 | } |
1839 | | |
1840 | 5 | static bool checkOSConsumesThisAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1841 | 5 | if (!D || (!isNonStaticCXXMethod(D))) { |
1842 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1843 | 2 | << Attr << "non-static member functions"; |
1844 | 2 | return false; |
1845 | 2 | } |
1846 | 3 | return true; |
1847 | 3 | } |
1848 | | |
1849 | 16 | static bool checkOSReturnsNotRetainedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1850 | 16 | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)6 && !isa<ObjCPropertyDecl>(D)6 && !isa<ParmVarDecl>(D)6 )) { |
1851 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1852 | 1 | << Attr << "functions, Objective-C methods, Objective-C properties, and parameters"; |
1853 | 1 | return false; |
1854 | 1 | } |
1855 | 15 | return true; |
1856 | 15 | } |
1857 | | |
1858 | 0 | static void matchRulesForOSReturnsNotRetained(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1859 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1860 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
1861 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_property, /*IsSupported=*/LangOpts.ObjC)); |
1862 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
1863 | 0 | } |
1864 | | |
1865 | 24 | static bool checkOSReturnsRetainedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1866 | 24 | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)19 && !isa<ObjCPropertyDecl>(D)18 && !isa<ParmVarDecl>(D)17 )) { |
1867 | 3 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1868 | 3 | << Attr << "functions, Objective-C methods, Objective-C properties, and parameters"; |
1869 | 3 | return false; |
1870 | 3 | } |
1871 | 21 | return true; |
1872 | 21 | } |
1873 | | |
1874 | 0 | static void matchRulesForOSReturnsRetained(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1875 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
1876 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
1877 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_property, /*IsSupported=*/LangOpts.ObjC)); |
1878 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
1879 | 0 | } |
1880 | | |
1881 | 3 | static bool checkOSReturnsRetainedOnNonZeroAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1882 | 3 | if (!D || (!isa<ParmVarDecl>(D))) { |
1883 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1884 | 0 | << Attr << "parameters"; |
1885 | 0 | return false; |
1886 | 0 | } |
1887 | 3 | return true; |
1888 | 3 | } |
1889 | | |
1890 | 0 | static void matchRulesForOSReturnsRetainedOnNonZero(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1891 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
1892 | 0 | } |
1893 | | |
1894 | 4 | static bool checkOSReturnsRetainedOnZeroAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1895 | 4 | if (!D || (!isa<ParmVarDecl>(D))) { |
1896 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
1897 | 0 | << Attr << "parameters"; |
1898 | 0 | return false; |
1899 | 0 | } |
1900 | 4 | return true; |
1901 | 4 | } |
1902 | | |
1903 | 0 | static void matchRulesForOSReturnsRetainedOnZero(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1904 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
1905 | 0 | } |
1906 | | |
1907 | 57 | static bool checkObjCBoxableAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1908 | 57 | if (!D || (!isa<RecordDecl>(D))) { |
1909 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1910 | 0 | << Attr << "structs, unions, and classes"; |
1911 | 0 | return false; |
1912 | 0 | } |
1913 | 57 | return true; |
1914 | 57 | } |
1915 | | |
1916 | 0 | static void matchRulesForObjCBoxable(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1917 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
1918 | 0 | } |
1919 | | |
1920 | 788 | static bool checkObjCBridgeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1921 | 788 | if (!D || (!isa<RecordDecl>(D) && !isa<TypedefNameDecl>(D)108 )) { |
1922 | 2 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1923 | 2 | << Attr << "structs, unions, classes, and typedefs"; |
1924 | 2 | return false; |
1925 | 2 | } |
1926 | 786 | return true; |
1927 | 786 | } |
1928 | | |
1929 | 0 | static void matchRulesForObjCBridge(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1930 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
1931 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_type_alias, /*IsSupported=*/true)); |
1932 | 0 | } |
1933 | | |
1934 | 456 | static bool checkObjCBridgeMutableAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1935 | 456 | if (!D || (!isa<RecordDecl>(D))) { |
1936 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1937 | 0 | << Attr << "structs, unions, and classes"; |
1938 | 0 | return false; |
1939 | 0 | } |
1940 | 456 | return true; |
1941 | 456 | } |
1942 | | |
1943 | 0 | static void matchRulesForObjCBridgeMutable(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1944 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
1945 | 0 | } |
1946 | | |
1947 | 26 | static bool checkObjCBridgeRelatedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1948 | 26 | if (!D || (!isa<RecordDecl>(D))) { |
1949 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1950 | 0 | << Attr << "structs, unions, and classes"; |
1951 | 0 | return false; |
1952 | 0 | } |
1953 | 26 | return true; |
1954 | 26 | } |
1955 | | |
1956 | 1 | static void matchRulesForObjCBridgeRelated(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1957 | 1 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
1958 | 1 | } |
1959 | | |
1960 | 10 | static bool checkObjCClassStubAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1961 | 10 | if (!D || (!isa<ObjCInterfaceDecl>(D))) { |
1962 | 2 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1963 | 2 | << Attr << "Objective-C interfaces"; |
1964 | 2 | return false; |
1965 | 2 | } |
1966 | 8 | return true; |
1967 | 8 | } |
1968 | | |
1969 | 12 | static bool checkObjCNonFragileRuntimeLangOpts(Sema &S, const ParsedAttr &Attr) { |
1970 | 12 | auto &LangOpts = S.LangOpts; |
1971 | 12 | if ((LangOpts.ObjCRuntime.allowsClassStubs())) |
1972 | 10 | return true; |
1973 | 2 | |
1974 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
1975 | 2 | return false; |
1976 | 2 | } |
1977 | | |
1978 | 0 | static void matchRulesForObjCClassStub(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1979 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
1980 | 0 | } |
1981 | | |
1982 | 2.07k | static bool checkObjCDesignatedInitializerAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1983 | 2.07k | if (!D || (!isa<ObjCMethodDecl>(D))) { |
1984 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1985 | 1 | << Attr << "Objective-C methods"; |
1986 | 1 | return false; |
1987 | 1 | } |
1988 | 2.07k | return true; |
1989 | 2.07k | } |
1990 | | |
1991 | 0 | static void matchRulesForObjCDesignatedInitializer(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
1992 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
1993 | 0 | } |
1994 | | |
1995 | 46 | static bool checkObjCExceptionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
1996 | 46 | if (!D || (!isa<ObjCInterfaceDecl>(D))) { |
1997 | 2 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
1998 | 2 | << Attr << "Objective-C interfaces"; |
1999 | 2 | return false; |
2000 | 2 | } |
2001 | 44 | return true; |
2002 | 44 | } |
2003 | | |
2004 | 0 | static void matchRulesForObjCException(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2005 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
2006 | 0 | } |
2007 | | |
2008 | 14 | static bool checkObjCExplicitProtocolImplAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2009 | 14 | if (!D || (!isa<ObjCProtocolDecl>(D))) { |
2010 | 2 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2011 | 2 | << Attr << "Objective-C protocols"; |
2012 | 2 | return false; |
2013 | 2 | } |
2014 | 12 | return true; |
2015 | 12 | } |
2016 | | |
2017 | 0 | static void matchRulesForObjCExplicitProtocolImpl(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2018 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_protocol, /*IsSupported=*/LangOpts.ObjC)); |
2019 | 0 | } |
2020 | | |
2021 | 59 | static bool checkObjCExternallyRetainedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2022 | 59 | if (!D || (!isNonParmVar(D) && !isa<FunctionDecl>(D)39 && !isa<BlockDecl>(D)22 && !isa<ObjCMethodDecl>(D)14 )) { |
2023 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2024 | 2 | << Attr << "variables, functions, blocks, and Objective-C methods"; |
2025 | 2 | return false; |
2026 | 2 | } |
2027 | 57 | return true; |
2028 | 57 | } |
2029 | | |
2030 | 61 | static bool checkObjCAutoRefCountLangOpts(Sema &S, const ParsedAttr &Attr) { |
2031 | 61 | auto &LangOpts = S.LangOpts; |
2032 | 61 | if (LangOpts.ObjCAutoRefCount) |
2033 | 59 | return true; |
2034 | 2 | |
2035 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
2036 | 2 | return false; |
2037 | 2 | } |
2038 | | |
2039 | 2 | static void matchRulesForObjCExternallyRetained(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2040 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_not_is_parameter, /*IsSupported=*/true)); |
2041 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2042 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_block, /*IsSupported=*/LangOpts.Blocks)); |
2043 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
2044 | 2 | } |
2045 | | |
2046 | 18 | static bool checkObjCMethodFamilyAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2047 | 18 | if (!D || (!isa<ObjCMethodDecl>(D))) { |
2048 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2049 | 0 | << Attr << "Objective-C methods"; |
2050 | 0 | return false; |
2051 | 0 | } |
2052 | 18 | return true; |
2053 | 18 | } |
2054 | | |
2055 | 0 | static void matchRulesForObjCMethodFamily(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2056 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
2057 | 0 | } |
2058 | | |
2059 | 11 | static bool checkObjCNonLazyClassAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2060 | 11 | if (!D || (!isa<ObjCInterfaceDecl>(D) && !isa<ObjCImplDecl>(D)7 )) { |
2061 | 3 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2062 | 3 | << Attr << "Objective-C interfaces and Objective-C implementation declarations"; |
2063 | 3 | return false; |
2064 | 3 | } |
2065 | 8 | return true; |
2066 | 8 | } |
2067 | | |
2068 | 11 | static bool checkObjCLangOpts(Sema &S, const ParsedAttr &Attr) { |
2069 | 11 | auto &LangOpts = S.LangOpts; |
2070 | 11 | if (LangOpts.ObjC) |
2071 | 11 | return true; |
2072 | 0 | |
2073 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
2074 | 0 | return false; |
2075 | 0 | } |
2076 | | |
2077 | 0 | static void matchRulesForObjCNonLazyClass(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2078 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
2079 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_implementation, /*IsSupported=*/LangOpts.ObjC)); |
2080 | 0 | } |
2081 | | |
2082 | 10 | static bool checkObjCPreciseLifetimeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2083 | 10 | if (!D || (!isa<VarDecl>(D))) { |
2084 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2085 | 0 | << Attr << "variables"; |
2086 | 0 | return false; |
2087 | 0 | } |
2088 | 10 | return true; |
2089 | 10 | } |
2090 | | |
2091 | 0 | static void matchRulesForObjCPreciseLifetime(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2092 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
2093 | 0 | } |
2094 | | |
2095 | 10 | static bool checkObjCRequiresPropertyDefsAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2096 | 10 | if (!D || (!isa<ObjCInterfaceDecl>(D))) { |
2097 | 4 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2098 | 4 | << Attr << "Objective-C interfaces"; |
2099 | 4 | return false; |
2100 | 4 | } |
2101 | 6 | return true; |
2102 | 6 | } |
2103 | | |
2104 | 0 | static void matchRulesForObjCRequiresPropertyDefs(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2105 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
2106 | 0 | } |
2107 | | |
2108 | 53 | static bool checkObjCRequiresSuperAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2109 | 53 | if (!D || (!isa<ObjCMethodDecl>(D))) { |
2110 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2111 | 0 | << Attr << "Objective-C methods"; |
2112 | 0 | return false; |
2113 | 0 | } |
2114 | 53 | return true; |
2115 | 53 | } |
2116 | | |
2117 | 0 | static void matchRulesForObjCRequiresSuper(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2118 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
2119 | 0 | } |
2120 | | |
2121 | 283 | static bool checkObjCReturnsInnerPointerAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2122 | 283 | if (!D || (!isa<ObjCMethodDecl>(D) && !isa<ObjCPropertyDecl>(D)148 )) { |
2123 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2124 | 1 | << Attr << "Objective-C methods and Objective-C properties"; |
2125 | 1 | return false; |
2126 | 1 | } |
2127 | 282 | return true; |
2128 | 282 | } |
2129 | | |
2130 | 0 | static void matchRulesForObjCReturnsInnerPointer(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2131 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
2132 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_property, /*IsSupported=*/LangOpts.ObjC)); |
2133 | 0 | } |
2134 | | |
2135 | 211 | static bool checkObjCRootClassAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2136 | 211 | if (!D || (!isa<ObjCInterfaceDecl>(D))) { |
2137 | 2 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2138 | 2 | << Attr << "Objective-C interfaces"; |
2139 | 2 | return false; |
2140 | 2 | } |
2141 | 209 | return true; |
2142 | 209 | } |
2143 | | |
2144 | 0 | static void matchRulesForObjCRootClass(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2145 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
2146 | 0 | } |
2147 | | |
2148 | 32 | static bool checkObjCRuntimeNameAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2149 | 32 | if (!D || (!isa<ObjCInterfaceDecl>(D) && !isa<ObjCProtocolDecl>(D)13 )) { |
2150 | 5 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2151 | 5 | << Attr << "Objective-C interfaces and Objective-C protocols"; |
2152 | 5 | return false; |
2153 | 5 | } |
2154 | 27 | return true; |
2155 | 27 | } |
2156 | | |
2157 | 0 | static void matchRulesForObjCRuntimeName(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2158 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
2159 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_protocol, /*IsSupported=*/LangOpts.ObjC)); |
2160 | 0 | } |
2161 | | |
2162 | 4 | static bool checkObjCRuntimeVisibleAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2163 | 4 | if (!D || (!isa<ObjCInterfaceDecl>(D))) { |
2164 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2165 | 0 | << Attr << "Objective-C interfaces"; |
2166 | 0 | return false; |
2167 | 0 | } |
2168 | 4 | return true; |
2169 | 4 | } |
2170 | | |
2171 | 0 | static void matchRulesForObjCRuntimeVisible(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2172 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
2173 | 0 | } |
2174 | | |
2175 | 21 | static bool checkObjCSubclassingRestrictedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2176 | 21 | if (!D || (!isa<ObjCInterfaceDecl>(D))) { |
2177 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2178 | 0 | << Attr << "Objective-C interfaces"; |
2179 | 0 | return false; |
2180 | 0 | } |
2181 | 21 | return true; |
2182 | 21 | } |
2183 | | |
2184 | 8 | static void matchRulesForObjCSubclassingRestricted(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2185 | 8 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_interface, /*IsSupported=*/LangOpts.ObjC)); |
2186 | 8 | } |
2187 | | |
2188 | 7.82k | static bool checkOpenCLAccessAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2189 | 7.82k | if (!D || (!isa<ParmVarDecl>(D) && !isa<TypedefNameDecl>(D)35 )) { |
2190 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2191 | 0 | << Attr << "parameters and typedefs"; |
2192 | 0 | return false; |
2193 | 0 | } |
2194 | 7.82k | return true; |
2195 | 7.82k | } |
2196 | | |
2197 | 7.81k | static unsigned OpenCLAccessAttrSpellingMap(const ParsedAttr &Attr) { |
2198 | 7.81k | enum Spelling { |
2199 | 7.81k | Keyword_read_only = 0, |
2200 | 7.81k | Keyword_write_only = 2, |
2201 | 7.81k | Keyword_read_write = 4 |
2202 | 7.81k | }; |
2203 | 7.81k | |
2204 | 7.81k | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
2205 | 7.81k | switch (Idx) { |
2206 | 7.81k | default: 0 llvm_unreachable0 ("Unknown spelling list index"); |
2207 | 7.81k | case 0: return Keyword_read_only4 ; |
2208 | 7.81k | case 1: return Keyword_read_only3.49k ; |
2209 | 7.81k | case 2: return Keyword_write_only4 ; |
2210 | 7.81k | case 3: return Keyword_write_only2.00k ; |
2211 | 7.81k | case 4: return Keyword_read_write2 ; |
2212 | 7.81k | case 5: return Keyword_read_write2.30k ; |
2213 | 7.81k | } |
2214 | 7.81k | } |
2215 | | |
2216 | 6 | static bool checkOpenCLIntelReqdSubGroupSizeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2217 | 6 | if (!D || (!isa<FunctionDecl>(D))) { |
2218 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2219 | 0 | << Attr << "functions"; |
2220 | 0 | return false; |
2221 | 0 | } |
2222 | 6 | return true; |
2223 | 6 | } |
2224 | | |
2225 | 0 | static void matchRulesForOpenCLIntelReqdSubGroupSize(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2226 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2227 | 0 | } |
2228 | | |
2229 | 735 | static bool checkOpenCLKernelAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2230 | 735 | if (!D || (!isa<FunctionDecl>(D))) { |
2231 | 2 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2232 | 2 | << Attr << "functions"; |
2233 | 2 | return false; |
2234 | 2 | } |
2235 | 733 | return true; |
2236 | 733 | } |
2237 | | |
2238 | 4 | static bool checkOpenCLNoSVMAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2239 | 4 | if (!D || (!isa<VarDecl>(D))) { |
2240 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2241 | 2 | << Attr << "variables"; |
2242 | 2 | return false; |
2243 | 2 | } |
2244 | 2 | return true; |
2245 | 2 | } |
2246 | | |
2247 | 5 | static bool checkOpenCLLangOpts(Sema &S, const ParsedAttr &Attr) { |
2248 | 5 | auto &LangOpts = S.LangOpts; |
2249 | 5 | if (LangOpts.OpenCL) |
2250 | 4 | return true; |
2251 | 1 | |
2252 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
2253 | 1 | return false; |
2254 | 1 | } |
2255 | | |
2256 | 0 | static void matchRulesForOpenCLNoSVM(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2257 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
2258 | 0 | } |
2259 | | |
2260 | 87 | static bool checkOptimizeNoneAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2261 | 87 | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)8 )) { |
2262 | 7 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2263 | 7 | << Attr << "functions and Objective-C methods"; |
2264 | 7 | return false; |
2265 | 7 | } |
2266 | 80 | return true; |
2267 | 80 | } |
2268 | | |
2269 | 1 | static void matchRulesForOptimizeNone(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2270 | 1 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2271 | 1 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
2272 | 1 | } |
2273 | | |
2274 | 361k | static bool checkOverloadableAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2275 | 361k | if (!D || (!isa<FunctionDecl>(D))) { |
2276 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2277 | 1 | << Attr << "functions"; |
2278 | 1 | return false; |
2279 | 1 | } |
2280 | 361k | return true; |
2281 | 361k | } |
2282 | | |
2283 | 0 | static void matchRulesForOverloadable(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2284 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2285 | 0 | } |
2286 | | |
2287 | 50 | static bool checkOwnershipAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2288 | 50 | if (!D || (!isHasFunctionProto(D))) { |
2289 | 3 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2290 | 3 | << Attr << "non-K&R-style functions"; |
2291 | 3 | return false; |
2292 | 3 | } |
2293 | 47 | return true; |
2294 | 47 | } |
2295 | | |
2296 | 0 | static unsigned OwnershipAttrSpellingMap(const ParsedAttr &Attr) { |
2297 | 0 | enum Spelling { |
2298 | 0 | GNU_ownership_holds = 0, |
2299 | 0 | CXX11_clang_ownership_holds = 1, |
2300 | 0 | C2x_clang_ownership_holds = 2, |
2301 | 0 | GNU_ownership_returns = 3, |
2302 | 0 | CXX11_clang_ownership_returns = 4, |
2303 | 0 | C2x_clang_ownership_returns = 5, |
2304 | 0 | GNU_ownership_takes = 6, |
2305 | 0 | CXX11_clang_ownership_takes = 7, |
2306 | 0 | C2x_clang_ownership_takes = 8 |
2307 | 0 | }; |
2308 | 0 |
|
2309 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
2310 | 0 | switch (Idx) { |
2311 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
2312 | 0 | case 0: return GNU_ownership_holds; |
2313 | 0 | case 1: return CXX11_clang_ownership_holds; |
2314 | 0 | case 2: return C2x_clang_ownership_holds; |
2315 | 0 | case 3: return GNU_ownership_returns; |
2316 | 0 | case 4: return CXX11_clang_ownership_returns; |
2317 | 0 | case 5: return C2x_clang_ownership_returns; |
2318 | 0 | case 6: return GNU_ownership_takes; |
2319 | 0 | case 7: return CXX11_clang_ownership_takes; |
2320 | 0 | case 8: return C2x_clang_ownership_takes; |
2321 | 0 | } |
2322 | 0 | } |
2323 | | |
2324 | 7 | static bool checkParamTypestateAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2325 | 7 | if (!D || (!isa<ParmVarDecl>(D))) { |
2326 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2327 | 0 | << Attr << "parameters"; |
2328 | 0 | return false; |
2329 | 0 | } |
2330 | 7 | return true; |
2331 | 7 | } |
2332 | | |
2333 | 0 | static void matchRulesForParamTypestate(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2334 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
2335 | 0 | } |
2336 | | |
2337 | 140 | static bool checkPassObjectSizeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2338 | 140 | if (!D || (!isa<ParmVarDecl>(D))) { |
2339 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2340 | 0 | << Attr << "parameters"; |
2341 | 0 | return false; |
2342 | 0 | } |
2343 | 140 | return true; |
2344 | 140 | } |
2345 | | |
2346 | 0 | static unsigned PassObjectSizeAttrSpellingMap(const ParsedAttr &Attr) { |
2347 | 0 | enum Spelling { |
2348 | 0 | GNU_pass_object_size = 0, |
2349 | 0 | CXX11_clang_pass_object_size = 1, |
2350 | 0 | C2x_clang_pass_object_size = 2, |
2351 | 0 | GNU_pass_dynamic_object_size = 3, |
2352 | 0 | CXX11_clang_pass_dynamic_object_size = 4, |
2353 | 0 | C2x_clang_pass_dynamic_object_size = 5 |
2354 | 0 | }; |
2355 | 0 |
|
2356 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
2357 | 0 | switch (Idx) { |
2358 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
2359 | 0 | case 0: return GNU_pass_object_size; |
2360 | 0 | case 1: return CXX11_clang_pass_object_size; |
2361 | 0 | case 2: return C2x_clang_pass_object_size; |
2362 | 0 | case 3: return GNU_pass_dynamic_object_size; |
2363 | 0 | case 4: return CXX11_clang_pass_dynamic_object_size; |
2364 | 0 | case 5: return C2x_clang_pass_dynamic_object_size; |
2365 | 0 | } |
2366 | 0 | } |
2367 | | |
2368 | 0 | static void matchRulesForPassObjectSize(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2369 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
2370 | 0 | } |
2371 | | |
2372 | 0 | static bool checkPragmaClangBSSSectionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2373 | 0 | if (!D || (!isGlobalVar(D))) { |
2374 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2375 | 0 | << Attr << "global variables"; |
2376 | 0 | return false; |
2377 | 0 | } |
2378 | 0 | return true; |
2379 | 0 | } |
2380 | | |
2381 | 0 | static bool checkPragmaClangDataSectionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2382 | 0 | if (!D || (!isGlobalVar(D))) { |
2383 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2384 | 0 | << Attr << "global variables"; |
2385 | 0 | return false; |
2386 | 0 | } |
2387 | 0 | return true; |
2388 | 0 | } |
2389 | | |
2390 | 0 | static bool checkPragmaClangRodataSectionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2391 | 0 | if (!D || (!isGlobalVar(D))) { |
2392 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2393 | 0 | << Attr << "global variables"; |
2394 | 0 | return false; |
2395 | 0 | } |
2396 | 0 | return true; |
2397 | 0 | } |
2398 | | |
2399 | 0 | static bool checkPragmaClangTextSectionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2400 | 0 | if (!D || (!isa<FunctionDecl>(D))) { |
2401 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2402 | 0 | << Attr << "functions"; |
2403 | 0 | return false; |
2404 | 0 | } |
2405 | 0 | return true; |
2406 | 0 | } |
2407 | | |
2408 | 161 | static bool checkPtGuardedByAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2409 | 161 | if (!D || (!isa<FieldDecl>(D) && !isSharedVar(D)88 )) { |
2410 | 20 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2411 | 20 | << Attr << "non-static data members and global variables"; |
2412 | 20 | return false; |
2413 | 20 | } |
2414 | 141 | return true; |
2415 | 141 | } |
2416 | | |
2417 | 47 | static bool checkPtGuardedVarAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2418 | 47 | if (!D || (!isa<FieldDecl>(D) && !isSharedVar(D)38 )) { |
2419 | 20 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2420 | 20 | << Attr << "non-static data members and global variables"; |
2421 | 20 | return false; |
2422 | 20 | } |
2423 | 27 | return true; |
2424 | 27 | } |
2425 | | |
2426 | 17 | static bool isNonStaticNonConstCXXMethod(const Decl *D) { |
2427 | 17 | if (const auto *S = dyn_cast<CXXMethodDecl>(D)) |
2428 | 14 | return !S->isStatic() && !S->isConst()13 ; |
2429 | 3 | return false; |
2430 | 3 | } |
2431 | | |
2432 | 17 | static bool checkReinitializesAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2433 | 17 | if (!D || (!isNonStaticNonConstCXXMethod(D))) { |
2434 | 5 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2435 | 5 | << Attr << "non-static non-const member functions"; |
2436 | 5 | return false; |
2437 | 5 | } |
2438 | 12 | return true; |
2439 | 12 | } |
2440 | | |
2441 | 443 | static bool checkReleaseCapabilityAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2442 | 443 | if (!D || (!isa<FunctionDecl>(D))) { |
2443 | 13 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2444 | 13 | << Attr << "functions"; |
2445 | 13 | return false; |
2446 | 13 | } |
2447 | 430 | return true; |
2448 | 430 | } |
2449 | | |
2450 | 0 | static unsigned ReleaseCapabilityAttrSpellingMap(const ParsedAttr &Attr) { |
2451 | 0 | enum Spelling { |
2452 | 0 | GNU_release_capability = 0, |
2453 | 0 | CXX11_clang_release_capability = 1, |
2454 | 0 | GNU_release_shared_capability = 2, |
2455 | 0 | CXX11_clang_release_shared_capability = 3, |
2456 | 0 | GNU_release_generic_capability = 4, |
2457 | 0 | CXX11_clang_release_generic_capability = 5, |
2458 | 0 | GNU_unlock_function = 6, |
2459 | 0 | CXX11_clang_unlock_function = 7 |
2460 | 0 | }; |
2461 | 0 |
|
2462 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
2463 | 0 | switch (Idx) { |
2464 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
2465 | 0 | case 0: return GNU_release_capability; |
2466 | 0 | case 1: return CXX11_clang_release_capability; |
2467 | 0 | case 2: return GNU_release_shared_capability; |
2468 | 0 | case 3: return CXX11_clang_release_shared_capability; |
2469 | 0 | case 4: return GNU_release_generic_capability; |
2470 | 0 | case 5: return CXX11_clang_release_generic_capability; |
2471 | 0 | case 6: return GNU_unlock_function; |
2472 | 0 | case 7: return CXX11_clang_unlock_function; |
2473 | 0 | } |
2474 | 0 | } |
2475 | | |
2476 | 2 | static bool checkRenderScriptKernelAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2477 | 2 | if (!D || (!isa<FunctionDecl>(D))) { |
2478 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2479 | 1 | << Attr << "functions"; |
2480 | 1 | return false; |
2481 | 1 | } |
2482 | 1 | return true; |
2483 | 1 | } |
2484 | | |
2485 | 4 | static bool checkRenderScriptLangOpts(Sema &S, const ParsedAttr &Attr) { |
2486 | 4 | auto &LangOpts = S.LangOpts; |
2487 | 4 | if (LangOpts.RenderScript) |
2488 | 2 | return true; |
2489 | 2 | |
2490 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
2491 | 2 | return false; |
2492 | 2 | } |
2493 | | |
2494 | 0 | static void matchRulesForRenderScriptKernel(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2495 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2496 | 0 | } |
2497 | | |
2498 | 15 | static bool checkReqdWorkGroupSizeAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2499 | 15 | if (!D || (!isa<FunctionDecl>(D))) { |
2500 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2501 | 1 | << Attr << "functions"; |
2502 | 1 | return false; |
2503 | 1 | } |
2504 | 14 | return true; |
2505 | 14 | } |
2506 | | |
2507 | 0 | static void matchRulesForReqdWorkGroupSize(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2508 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2509 | 0 | } |
2510 | | |
2511 | 169 | static bool checkRequireConstantInitAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2512 | 169 | if (!D || (!isGlobalVar(D))) { |
2513 | 12 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2514 | 12 | << Attr << "global variables"; |
2515 | 12 | return false; |
2516 | 12 | } |
2517 | 157 | return true; |
2518 | 157 | } |
2519 | | |
2520 | 2 | static void matchRulesForRequireConstantInit(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2521 | 2 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/true)); |
2522 | 2 | } |
2523 | | |
2524 | 751 | static bool checkRequiresCapabilityAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2525 | 751 | if (!D || (!isa<FunctionDecl>(D))) { |
2526 | 30 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2527 | 30 | << Attr << "functions"; |
2528 | 30 | return false; |
2529 | 30 | } |
2530 | 721 | return true; |
2531 | 721 | } |
2532 | | |
2533 | 0 | static unsigned RequiresCapabilityAttrSpellingMap(const ParsedAttr &Attr) { |
2534 | 0 | enum Spelling { |
2535 | 0 | GNU_requires_capability = 0, |
2536 | 0 | CXX11_clang_requires_capability = 1, |
2537 | 0 | GNU_exclusive_locks_required = 2, |
2538 | 0 | CXX11_clang_exclusive_locks_required = 3, |
2539 | 0 | GNU_requires_shared_capability = 4, |
2540 | 0 | CXX11_clang_requires_shared_capability = 5, |
2541 | 0 | GNU_shared_locks_required = 6, |
2542 | 0 | CXX11_clang_shared_locks_required = 7 |
2543 | 0 | }; |
2544 | 0 |
|
2545 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
2546 | 0 | switch (Idx) { |
2547 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
2548 | 0 | case 0: return GNU_requires_capability; |
2549 | 0 | case 1: return CXX11_clang_requires_capability; |
2550 | 0 | case 2: return GNU_exclusive_locks_required; |
2551 | 0 | case 3: return CXX11_clang_exclusive_locks_required; |
2552 | 0 | case 4: return GNU_requires_shared_capability; |
2553 | 0 | case 5: return CXX11_clang_requires_shared_capability; |
2554 | 0 | case 6: return GNU_shared_locks_required; |
2555 | 0 | case 7: return CXX11_clang_shared_locks_required; |
2556 | 0 | } |
2557 | 0 | } |
2558 | | |
2559 | 2.20k | static bool checkRestrictAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2560 | 2.20k | if (!D || (!isa<FunctionDecl>(D))) { |
2561 | 11 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2562 | 11 | << Attr << "functions"; |
2563 | 11 | return false; |
2564 | 11 | } |
2565 | 2.19k | return true; |
2566 | 2.19k | } |
2567 | | |
2568 | 0 | static unsigned RestrictAttrSpellingMap(const ParsedAttr &Attr) { |
2569 | 0 | enum Spelling { |
2570 | 0 | Declspec_restrict = 0, |
2571 | 0 | GNU_malloc = 1, |
2572 | 0 | CXX11_gnu_malloc = 2 |
2573 | 0 | }; |
2574 | 0 |
|
2575 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
2576 | 0 | switch (Idx) { |
2577 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
2578 | 0 | case 0: return Declspec_restrict; |
2579 | 0 | case 1: return GNU_malloc; |
2580 | 0 | case 2: return CXX11_gnu_malloc; |
2581 | 0 | } |
2582 | 0 | } |
2583 | | |
2584 | 0 | static void matchRulesForRestrict(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2585 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2586 | 0 | } |
2587 | | |
2588 | 13 | static bool checkReturnTypestateAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2589 | 13 | if (!D || (!isa<FunctionDecl>(D) && !isa<ParmVarDecl>(D)4 )) { |
2590 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2591 | 1 | << Attr << "functions and parameters"; |
2592 | 1 | return false; |
2593 | 1 | } |
2594 | 12 | return true; |
2595 | 12 | } |
2596 | | |
2597 | 0 | static void matchRulesForReturnTypestate(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2598 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2599 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
2600 | 0 | } |
2601 | | |
2602 | 29 | static bool checkReturnsNonNullAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2603 | 29 | if (!D || (!isa<ObjCMethodDecl>(D) && !isa<FunctionDecl>(D)25 )) { |
2604 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2605 | 2 | << Attr << "Objective-C methods and functions"; |
2606 | 2 | return false; |
2607 | 2 | } |
2608 | 27 | return true; |
2609 | 27 | } |
2610 | | |
2611 | 0 | static void matchRulesForReturnsNonNull(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2612 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
2613 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2614 | 0 | } |
2615 | | |
2616 | 20 | static bool checkReturnsTwiceAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2617 | 20 | if (!D || (!isa<FunctionDecl>(D))) { |
2618 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2619 | 2 | << Attr << "functions"; |
2620 | 2 | return false; |
2621 | 2 | } |
2622 | 18 | return true; |
2623 | 18 | } |
2624 | | |
2625 | 0 | static void matchRulesForReturnsTwice(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2626 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2627 | 0 | } |
2628 | | |
2629 | 88 | static bool checkScopedLockableAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2630 | 88 | if (!D || (!isa<RecordDecl>(D))) { |
2631 | 18 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2632 | 18 | << Attr << "structs, unions, and classes"; |
2633 | 18 | return false; |
2634 | 18 | } |
2635 | 70 | return true; |
2636 | 70 | } |
2637 | | |
2638 | 0 | static void matchRulesForScopedLockable(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2639 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
2640 | 0 | } |
2641 | | |
2642 | 5.89k | static bool checkSectionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2643 | 5.89k | if (!D || (!isa<FunctionDecl>(D) && !isGlobalVar(D)5.86k && !isa<ObjCMethodDecl>(D)8 && !isa<ObjCPropertyDecl>(D)6 )) { |
2644 | 4 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2645 | 4 | << Attr << "functions, global variables, Objective-C methods, and Objective-C properties"; |
2646 | 4 | return false; |
2647 | 4 | } |
2648 | 5.88k | return true; |
2649 | 5.88k | } |
2650 | | |
2651 | 0 | static unsigned SectionAttrSpellingMap(const ParsedAttr &Attr) { |
2652 | 0 | enum Spelling { |
2653 | 0 | GNU_section = 0, |
2654 | 0 | CXX11_gnu_section = 1, |
2655 | 0 | Declspec_allocate = 2 |
2656 | 0 | }; |
2657 | 0 |
|
2658 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
2659 | 0 | switch (Idx) { |
2660 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
2661 | 0 | case 0: return GNU_section; |
2662 | 0 | case 1: return CXX11_gnu_section; |
2663 | 0 | case 2: return Declspec_allocate; |
2664 | 0 | } |
2665 | 0 | } |
2666 | | |
2667 | 0 | static void matchRulesForSection(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2668 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2669 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/true)); |
2670 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
2671 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_property, /*IsSupported=*/LangOpts.ObjC)); |
2672 | 0 | } |
2673 | | |
2674 | 13 | static bool checkSetTypestateAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2675 | 13 | if (!D || (!isa<CXXMethodDecl>(D))) { |
2676 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2677 | 2 | << Attr << "functions"; |
2678 | 2 | return false; |
2679 | 2 | } |
2680 | 11 | return true; |
2681 | 11 | } |
2682 | | |
2683 | 0 | static void matchRulesForSetTypestate(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2684 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function_is_member, /*IsSupported=*/LangOpts.CPlusPlus)); |
2685 | 0 | } |
2686 | | |
2687 | 88 | static bool checkSharedTrylockFunctionAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2688 | 88 | if (!D || (!isa<FunctionDecl>(D))) { |
2689 | 15 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2690 | 15 | << Attr << "functions"; |
2691 | 15 | return false; |
2692 | 15 | } |
2693 | 73 | return true; |
2694 | 73 | } |
2695 | | |
2696 | 35 | static bool checkSpeculativeLoadHardeningAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2697 | 35 | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)6 )) { |
2698 | 6 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2699 | 6 | << Attr << "functions and Objective-C methods"; |
2700 | 6 | return false; |
2701 | 6 | } |
2702 | 29 | return true; |
2703 | 29 | } |
2704 | | |
2705 | 0 | static void matchRulesForSpeculativeLoadHardening(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2706 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2707 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
2708 | 0 | } |
2709 | | |
2710 | 58 | static bool checkSwiftContextAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2711 | 58 | if (!D || (!isa<ParmVarDecl>(D))) { |
2712 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2713 | 0 | << Attr << "parameters"; |
2714 | 0 | return false; |
2715 | 0 | } |
2716 | 58 | return true; |
2717 | 58 | } |
2718 | | |
2719 | 0 | static void matchRulesForSwiftContext(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2720 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
2721 | 0 | } |
2722 | | |
2723 | 34 | static bool checkSwiftErrorResultAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2724 | 34 | if (!D || (!isa<ParmVarDecl>(D))) { |
2725 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2726 | 0 | << Attr << "parameters"; |
2727 | 0 | return false; |
2728 | 0 | } |
2729 | 34 | return true; |
2730 | 34 | } |
2731 | | |
2732 | 0 | static void matchRulesForSwiftErrorResult(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2733 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
2734 | 0 | } |
2735 | | |
2736 | 68 | static bool checkSwiftIndirectResultAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2737 | 68 | if (!D || (!isa<ParmVarDecl>(D))) { |
2738 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2739 | 0 | << Attr << "parameters"; |
2740 | 0 | return false; |
2741 | 0 | } |
2742 | 68 | return true; |
2743 | 68 | } |
2744 | | |
2745 | 0 | static void matchRulesForSwiftIndirectResult(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2746 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/true)); |
2747 | 0 | } |
2748 | | |
2749 | 34 | static bool isTLSVar(const Decl *D) { |
2750 | 34 | if (const auto *S = dyn_cast<VarDecl>(D)) |
2751 | 33 | return S->getTLSKind() != 0; |
2752 | 1 | return false; |
2753 | 1 | } |
2754 | | |
2755 | 32 | static bool checkTLSModelAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2756 | 32 | if (!D || (!isTLSVar(D))) { |
2757 | 2 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2758 | 2 | << Attr << "thread-local variables"; |
2759 | 2 | return false; |
2760 | 2 | } |
2761 | 30 | return true; |
2762 | 30 | } |
2763 | | |
2764 | 0 | static void matchRulesForTLSModel(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2765 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable_is_thread_local, /*IsSupported=*/true)); |
2766 | 0 | } |
2767 | | |
2768 | 738k | static bool checkTargetAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2769 | 738k | if (!D || (!isa<FunctionDecl>(D))) { |
2770 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2771 | 0 | << Attr << "functions"; |
2772 | 0 | return false; |
2773 | 0 | } |
2774 | 738k | return true; |
2775 | 738k | } |
2776 | | |
2777 | 0 | static void matchRulesForTarget(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2778 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2779 | 0 | } |
2780 | | |
2781 | 9 | static bool checkTestTypestateAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2782 | 9 | if (!D || (!isa<CXXMethodDecl>(D))) { |
2783 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2784 | 2 | << Attr << "functions"; |
2785 | 2 | return false; |
2786 | 2 | } |
2787 | 7 | return true; |
2788 | 7 | } |
2789 | | |
2790 | 0 | static void matchRulesForTestTypestate(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2791 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function_is_member, /*IsSupported=*/LangOpts.CPlusPlus)); |
2792 | 0 | } |
2793 | | |
2794 | 55 | static bool checkThreadAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2795 | 55 | if (!D || (!isa<VarDecl>(D))) { |
2796 | 4 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2797 | 4 | << Attr << "variables"; |
2798 | 4 | return false; |
2799 | 4 | } |
2800 | 51 | return true; |
2801 | 51 | } |
2802 | | |
2803 | 69 | static bool checkCOnlyLangOpts(Sema &S, const ParsedAttr &Attr) { |
2804 | 69 | auto &LangOpts = S.LangOpts; |
2805 | 69 | if ((!LangOpts.CPlusPlus)) |
2806 | 66 | return true; |
2807 | 3 | |
2808 | 3 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
2809 | 3 | return false; |
2810 | 3 | } |
2811 | | |
2812 | 34 | static bool checkTrivialABIAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2813 | 34 | if (!D || (!isa<CXXRecordDecl>(D))) { |
2814 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2815 | 1 | << Attr << "classes"; |
2816 | 1 | return false; |
2817 | 1 | } |
2818 | 33 | return true; |
2819 | 33 | } |
2820 | | |
2821 | 0 | static void matchRulesForTrivialABI(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2822 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
2823 | 0 | } |
2824 | | |
2825 | 31 | static bool checkTryAcquireCapabilityAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2826 | 31 | if (!D || (!isa<FunctionDecl>(D))) { |
2827 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2828 | 1 | << Attr << "functions"; |
2829 | 1 | return false; |
2830 | 1 | } |
2831 | 30 | return true; |
2832 | 30 | } |
2833 | | |
2834 | 0 | static unsigned TryAcquireCapabilityAttrSpellingMap(const ParsedAttr &Attr) { |
2835 | 0 | enum Spelling { |
2836 | 0 | GNU_try_acquire_capability = 0, |
2837 | 0 | CXX11_clang_try_acquire_capability = 1, |
2838 | 0 | GNU_try_acquire_shared_capability = 2, |
2839 | 0 | CXX11_clang_try_acquire_shared_capability = 3 |
2840 | 0 | }; |
2841 | 0 |
|
2842 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
2843 | 0 | switch (Idx) { |
2844 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
2845 | 0 | case 0: return GNU_try_acquire_capability; |
2846 | 0 | case 1: return CXX11_clang_try_acquire_capability; |
2847 | 0 | case 2: return GNU_try_acquire_shared_capability; |
2848 | 0 | case 3: return CXX11_clang_try_acquire_shared_capability; |
2849 | 0 | } |
2850 | 0 | } |
2851 | | |
2852 | 13 | static bool checkUninitializedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2853 | 13 | if (!D || (!isLocalVar(D))) { |
2854 | 8 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2855 | 8 | << Attr << "local variables"; |
2856 | 8 | return false; |
2857 | 8 | } |
2858 | 5 | return true; |
2859 | 5 | } |
2860 | | |
2861 | 36.3k | static bool checkUnusedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2862 | 36.3k | if (!D || (!isa<VarDecl>(D) && !isa<ObjCIvarDecl>(D)35.8k && !isa<TypeDecl>(D)35.8k && !isa<EnumDecl>(D)256 && !isa<EnumConstantDecl>(D)256 && !isa<LabelDecl>(D)252 && !isa<FieldDecl>(D)249 && !isa<ObjCMethodDecl>(D)163 && !isFunctionLike(D)160 )) { |
2863 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2864 | 1 | << Attr << "variables, non-static data members, types, enums, enumerators, labels, non-static data members, Objective-C methods, functions, and function pointers"; |
2865 | 1 | return false; |
2866 | 1 | } |
2867 | 36.3k | return true; |
2868 | 36.3k | } |
2869 | | |
2870 | 0 | static unsigned UnusedAttrSpellingMap(const ParsedAttr &Attr) { |
2871 | 0 | enum Spelling { |
2872 | 0 | CXX11_maybe_unused = 0, |
2873 | 0 | GNU_unused = 1, |
2874 | 0 | CXX11_gnu_unused = 2, |
2875 | 0 | C2x_maybe_unused = 3 |
2876 | 0 | }; |
2877 | 0 |
|
2878 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
2879 | 0 | switch (Idx) { |
2880 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
2881 | 0 | case 0: return CXX11_maybe_unused; |
2882 | 0 | case 1: return GNU_unused; |
2883 | 0 | case 2: return CXX11_gnu_unused; |
2884 | 0 | case 3: return C2x_maybe_unused; |
2885 | 0 | } |
2886 | 0 | } |
2887 | | |
2888 | 7.25k | static bool isNonLocalVar(const Decl *D) { |
2889 | 7.25k | if (const auto *S = dyn_cast<VarDecl>(D)) |
2890 | 6.71k | return !S->hasLocalStorage(); |
2891 | 539 | return false; |
2892 | 539 | } |
2893 | | |
2894 | 7.25k | static bool checkUsedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2895 | 7.25k | if (!D || (!isNonLocalVar(D) && !isa<FunctionDecl>(D)540 && !isa<ObjCMethodDecl>(D)2 )) { |
2896 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2897 | 2 | << Attr << "variables with non-local storage, functions, and Objective-C methods"; |
2898 | 2 | return false; |
2899 | 2 | } |
2900 | 7.25k | return true; |
2901 | 7.25k | } |
2902 | | |
2903 | 139 | static bool checkUuidAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2904 | 139 | if (!D || (!isa<RecordDecl>(D) && !isa<EnumDecl>(D)4 )) { |
2905 | 3 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2906 | 3 | << Attr << "structs, unions, classes, and enums"; |
2907 | 3 | return false; |
2908 | 3 | } |
2909 | 136 | return true; |
2910 | 136 | } |
2911 | | |
2912 | 139 | static bool checkMicrosoftExtBorlandLangOpts(Sema &S, const ParsedAttr &Attr) { |
2913 | 139 | auto &LangOpts = S.LangOpts; |
2914 | 139 | if (LangOpts.MicrosoftExt || LangOpts.Borland2 ) |
2915 | 139 | return true; |
2916 | 0 | |
2917 | 0 | S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); |
2918 | 0 | return false; |
2919 | 0 | } |
2920 | | |
2921 | 11 | static bool checkVecReturnAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2922 | 11 | if (!D || (!isa<CXXRecordDecl>(D))) { |
2923 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2924 | 0 | << Attr << "classes"; |
2925 | 0 | return false; |
2926 | 0 | } |
2927 | 11 | return true; |
2928 | 11 | } |
2929 | | |
2930 | 0 | static void matchRulesForVecReturn(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2931 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
2932 | 0 | } |
2933 | | |
2934 | 10 | static bool checkVecTypeHintAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2935 | 10 | if (!D || (!isa<FunctionDecl>(D))) { |
2936 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
2937 | 1 | << Attr << "functions"; |
2938 | 1 | return false; |
2939 | 1 | } |
2940 | 9 | return true; |
2941 | 9 | } |
2942 | | |
2943 | 0 | static void matchRulesForVecTypeHint(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2944 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
2945 | 0 | } |
2946 | | |
2947 | 8 | static bool checkWarnUnusedAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2948 | 8 | if (!D || (!isa<RecordDecl>(D))) { |
2949 | 1 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2950 | 1 | << Attr << "structs, unions, and classes"; |
2951 | 1 | return false; |
2952 | 1 | } |
2953 | 7 | return true; |
2954 | 7 | } |
2955 | | |
2956 | 0 | static void matchRulesForWarnUnused(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2957 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
2958 | 0 | } |
2959 | | |
2960 | 10.1k | static bool checkWarnUnusedResultAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2961 | 10.1k | if (!D || (!isa<ObjCMethodDecl>(D) && !isa<EnumDecl>(D)10.1k && !isa<RecordDecl>(D)10.1k && !isFunctionLike(D)10.1k )) { |
2962 | 3 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2963 | 3 | << Attr << "Objective-C methods, enums, structs, unions, classes, functions, and function pointers"; |
2964 | 3 | return false; |
2965 | 3 | } |
2966 | 10.1k | return true; |
2967 | 10.1k | } |
2968 | | |
2969 | 0 | static unsigned WarnUnusedResultAttrSpellingMap(const ParsedAttr &Attr) { |
2970 | 0 | enum Spelling { |
2971 | 0 | CXX11_nodiscard = 0, |
2972 | 0 | C2x_nodiscard = 1, |
2973 | 0 | CXX11_clang_warn_unused_result = 2, |
2974 | 0 | GNU_warn_unused_result = 3, |
2975 | 0 | CXX11_gnu_warn_unused_result = 4 |
2976 | 0 | }; |
2977 | 0 |
|
2978 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
2979 | 0 | switch (Idx) { |
2980 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
2981 | 0 | case 0: return CXX11_nodiscard; |
2982 | 0 | case 1: return C2x_nodiscard; |
2983 | 0 | case 2: return CXX11_clang_warn_unused_result; |
2984 | 0 | case 3: return GNU_warn_unused_result; |
2985 | 0 | case 4: return CXX11_gnu_warn_unused_result; |
2986 | 0 | } |
2987 | 0 | } |
2988 | | |
2989 | 0 | static void matchRulesForWarnUnusedResult(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
2990 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
2991 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_enum, /*IsSupported=*/true)); |
2992 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
2993 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/true)); |
2994 | 0 | } |
2995 | | |
2996 | 30.1k | static bool checkWeakAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
2997 | 30.1k | if (!D || (!isa<VarDecl>(D) && !isa<FunctionDecl>(D)30.0k && !isa<CXXRecordDecl>(D)4 )) { |
2998 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
2999 | 2 | << Attr << "variables, functions, and classes"; |
3000 | 2 | return false; |
3001 | 2 | } |
3002 | 30.1k | return true; |
3003 | 30.1k | } |
3004 | | |
3005 | 0 | static void matchRulesForWeak(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
3006 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
3007 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
3008 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_record, /*IsSupported=*/true)); |
3009 | 0 | } |
3010 | | |
3011 | 40 | static bool checkWeakRefAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
3012 | 40 | if (!D || (!isa<VarDecl>(D) && !isa<FunctionDecl>(D)24 )) { |
3013 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
3014 | 0 | << Attr << "variables and functions"; |
3015 | 0 | return false; |
3016 | 0 | } |
3017 | 40 | return true; |
3018 | 40 | } |
3019 | | |
3020 | 0 | static void matchRulesForWeakRef(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
3021 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_variable, /*IsSupported=*/true)); |
3022 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
3023 | 0 | } |
3024 | | |
3025 | 1 | static bool checkWebAssemblyImportModuleAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
3026 | 1 | if (!D || (!isa<FunctionDecl>(D))) { |
3027 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
3028 | 0 | << Attr << "functions"; |
3029 | 0 | return false; |
3030 | 0 | } |
3031 | 1 | return true; |
3032 | 1 | } |
3033 | | |
3034 | 4 | static bool isTargetwasm32wasm64(const TargetInfo &Target) { |
3035 | 4 | const llvm::Triple &T = Target.getTriple(); (void)T; |
3036 | 4 | return true && (T.getArch() == llvm::Triple::wasm32 || T.getArch() == llvm::Triple::wasm640 ); |
3037 | 4 | } |
3038 | | |
3039 | 0 | static void matchRulesForWebAssemblyImportModule(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
3040 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
3041 | 0 | } |
3042 | | |
3043 | 1 | static bool checkWebAssemblyImportNameAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
3044 | 1 | if (!D || (!isa<FunctionDecl>(D))) { |
3045 | 0 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
3046 | 0 | << Attr << "functions"; |
3047 | 0 | return false; |
3048 | 0 | } |
3049 | 1 | return true; |
3050 | 1 | } |
3051 | | |
3052 | 0 | static void matchRulesForWebAssemblyImportName(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
3053 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
3054 | 0 | } |
3055 | | |
3056 | 8 | static bool checkWorkGroupSizeHintAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
3057 | 8 | if (!D || (!isa<FunctionDecl>(D))) { |
3058 | 1 | S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type_str) |
3059 | 1 | << Attr << "functions"; |
3060 | 1 | return false; |
3061 | 1 | } |
3062 | 7 | return true; |
3063 | 7 | } |
3064 | | |
3065 | 0 | static void matchRulesForWorkGroupSizeHint(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
3066 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
3067 | 0 | } |
3068 | | |
3069 | 701 | static bool checkXRayInstrumentAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
3070 | 701 | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)2 )) { |
3071 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
3072 | 2 | << Attr << "functions and Objective-C methods"; |
3073 | 2 | return false; |
3074 | 2 | } |
3075 | 699 | return true; |
3076 | 699 | } |
3077 | | |
3078 | 0 | static unsigned XRayInstrumentAttrSpellingMap(const ParsedAttr &Attr) { |
3079 | 0 | enum Spelling { |
3080 | 0 | GNU_xray_always_instrument = 0, |
3081 | 0 | CXX11_clang_xray_always_instrument = 1, |
3082 | 0 | C2x_clang_xray_always_instrument = 2, |
3083 | 0 | GNU_xray_never_instrument = 3, |
3084 | 0 | CXX11_clang_xray_never_instrument = 4, |
3085 | 0 | C2x_clang_xray_never_instrument = 5 |
3086 | 0 | }; |
3087 | 0 |
|
3088 | 0 | unsigned Idx = Attr.getAttributeSpellingListIndex(); |
3089 | 0 | switch (Idx) { |
3090 | 0 | default: llvm_unreachable("Unknown spelling list index"); |
3091 | 0 | case 0: return GNU_xray_always_instrument; |
3092 | 0 | case 1: return CXX11_clang_xray_always_instrument; |
3093 | 0 | case 2: return C2x_clang_xray_always_instrument; |
3094 | 0 | case 3: return GNU_xray_never_instrument; |
3095 | 0 | case 4: return CXX11_clang_xray_never_instrument; |
3096 | 0 | case 5: return C2x_clang_xray_never_instrument; |
3097 | 0 | } |
3098 | 0 | } |
3099 | | |
3100 | 0 | static void matchRulesForXRayInstrument(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
3101 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
3102 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
3103 | 0 | } |
3104 | | |
3105 | 19 | static bool checkXRayLogArgsAppertainsTo(Sema &S, const ParsedAttr &Attr, const Decl *D) { |
3106 | 19 | if (!D || (!isa<FunctionDecl>(D) && !isa<ObjCMethodDecl>(D)2 )) { |
3107 | 2 | S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type_str) |
3108 | 2 | << Attr << "functions and Objective-C methods"; |
3109 | 2 | return false; |
3110 | 2 | } |
3111 | 17 | return true; |
3112 | 17 | } |
3113 | | |
3114 | 0 | static void matchRulesForXRayLogArgs(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) { |
3115 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_function, /*IsSupported=*/true)); |
3116 | 0 | MatchRules.push_back(std::make_pair(attr::SubjectMatchRule_objc_method, /*IsSupported=*/LangOpts.ObjC)); |
3117 | 0 | } |
3118 | | |
3119 | | static const ParsedAttrInfo AttrInfoMap[ParsedAttr::UnknownAttribute + 1] = { |
3120 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_AArch64VectorPcs |
3121 | | { 2, 0, 0, 0, 0, 0, 0, 1, checkAMDGPUFlatWorkGroupSizeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAMDGPUFlatWorkGroupSize }, // AT_AMDGPUFlatWorkGroupSize |
3122 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkAMDGPUNumSGPRAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAMDGPUNumSGPR }, // AT_AMDGPUNumSGPR |
3123 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkAMDGPUNumVGPRAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAMDGPUNumVGPR }, // AT_AMDGPUNumVGPR |
3124 | | { 1, 1, 0, 0, 0, 0, 0, 1, checkAMDGPUWavesPerEUAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAMDGPUWavesPerEU }, // AT_AMDGPUWavesPerEU |
3125 | | { 0, 1, 1, 1, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, isTargetarmthumbarmebthumbebavrx86x86_64msp430mipsmipselriscv32riscv64, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Interrupt |
3126 | | { 0, 0, 0, 1, 0, 0, 1, 1, checkAVRSignalAppertainsTo, defaultDiagnoseLangOpts, isTargetavr, defaultSpellingIndexToSemanticSpelling, matchRulesForAVRSignal }, // AT_AVRSignal |
3127 | | { 0, 15, 0, 0, 0, 0, 1, 1, checkAbiTagAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAbiTag }, // AT_AbiTag |
3128 | | { 0, 15, 0, 0, 0, 0, 0, 0, checkAcquireCapabilityAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, AcquireCapabilityAttrSpellingMap, nullptr }, // AT_AcquireCapability |
3129 | | { 0, 15, 0, 0, 0, 0, 0, 0, checkAcquiredAfterAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_AcquiredAfter |
3130 | | { 0, 15, 0, 0, 0, 0, 0, 0, checkAcquiredBeforeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_AcquiredBefore |
3131 | | { 1, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_AddressSpace |
3132 | | { 1, 0, 0, 0, 0, 0, 1, 1, checkAliasAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAlias }, // AT_Alias |
3133 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkAlignValueAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAlignValue }, // AT_AlignValue |
3134 | | { 0, 1, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, AlignedAttrSpellingMap, nullptr }, // AT_Aligned |
3135 | | { 1, 0, 0, 0, 0, 0, 1, 0, checkAllocAlignAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_AllocAlign |
3136 | | { 1, 1, 0, 0, 0, 0, 1, 1, checkAllocSizeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAllocSize }, // AT_AllocSize |
3137 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkAlwaysDestroyAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAlwaysDestroy }, // AT_AlwaysDestroy |
3138 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkAlwaysInlineAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, AlwaysInlineAttrSpellingMap, matchRulesForAlwaysInline }, // AT_AlwaysInline |
3139 | | { 0, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_AnalyzerNoReturn |
3140 | | { 1, 0, 0, 0, 0, 0, 0, 1, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAnnotate }, // AT_Annotate |
3141 | | { 0, 0, 0, 1, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, isTargetx86x86_64, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_AnyX86NoCallerSavedRegisters |
3142 | | { 0, 0, 0, 1, 1, 0, 1, 1, checkAnyX86NoCfCheckAppertainsTo, defaultDiagnoseLangOpts, isTargetx86x86_64, defaultSpellingIndexToSemanticSpelling, matchRulesForAnyX86NoCfCheck }, // AT_AnyX86NoCfCheck |
3143 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkArcWeakrefUnavailableAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForArcWeakrefUnavailable }, // AT_ArcWeakrefUnavailable |
3144 | | { 3, 0, 0, 0, 0, 0, 0, 0, checkArgumentWithTypeTagAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, ArgumentWithTypeTagAttrSpellingMap, nullptr }, // AT_ArgumentWithTypeTag |
3145 | | { 0, 0, 0, 0, 0, 0, 1, 0, checkArtificialAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Artificial |
3146 | | { 0, 15, 0, 0, 0, 0, 0, 0, checkAssertCapabilityAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, AssertCapabilityAttrSpellingMap, nullptr }, // AT_AssertCapability |
3147 | | { 0, 15, 0, 0, 0, 0, 0, 0, checkAssertExclusiveLockAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_AssertExclusiveLock |
3148 | | { 0, 15, 0, 0, 0, 0, 0, 0, checkAssertSharedLockAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_AssertSharedLock |
3149 | | { 1, 1, 0, 0, 0, 0, 1, 1, checkAssumeAlignedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAssumeAligned }, // AT_AssumeAligned |
3150 | | { 9, 0, 1, 0, 0, 0, 0, 1, checkAvailabilityAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForAvailability }, // AT_Availability |
3151 | | { 1, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Blocks |
3152 | | { 0, 0, 0, 0, 1, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_CDecl |
3153 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkCFAuditedTransferAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCFAuditedTransfer }, // AT_CFAuditedTransfer |
3154 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkCFConsumedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCFConsumed }, // AT_CFConsumed |
3155 | | { 0, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_CFReturnsNotRetained |
3156 | | { 0, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_CFReturnsRetained |
3157 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkCFUnknownTransferAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCFUnknownTransfer }, // AT_CFUnknownTransfer |
3158 | | { 0, 15, 0, 0, 0, 0, 0, 1, checkCPUDispatchAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCPUDispatch }, // AT_CPUDispatch |
3159 | | { 0, 15, 0, 0, 0, 0, 0, 1, checkCPUSpecificAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCPUSpecific }, // AT_CPUSpecific |
3160 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkCUDAConstantAppertainsTo, checkCUDALangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCUDAConstant }, // AT_CUDAConstant |
3161 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkCUDADeviceAppertainsTo, checkCUDALangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCUDADevice }, // AT_CUDADevice |
3162 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkCUDAGlobalAppertainsTo, checkCUDALangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCUDAGlobal }, // AT_CUDAGlobal |
3163 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkCUDAHostAppertainsTo, checkCUDALangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCUDAHost }, // AT_CUDAHost |
3164 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkCUDAInvalidTargetAppertainsTo, checkCUDALangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_CUDAInvalidTarget |
3165 | | { 1, 1, 0, 0, 0, 0, 0, 1, checkCUDALaunchBoundsAppertainsTo, checkCUDALangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCUDALaunchBounds }, // AT_CUDALaunchBounds |
3166 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkCUDASharedAppertainsTo, checkCUDALangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCUDAShared }, // AT_CUDAShared |
3167 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkCXX11NoReturnAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCXX11NoReturn }, // AT_CXX11NoReturn |
3168 | | { 0, 15, 0, 0, 0, 0, 0, 1, checkCallableWhenAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCallableWhen }, // AT_CallableWhen |
3169 | | { 0, 15, 0, 0, 0, 0, 0, 1, checkCallbackAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCallback }, // AT_Callback |
3170 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkCapabilityAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, CapabilityAttrSpellingMap, matchRulesForCapability }, // AT_Capability |
3171 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkCarriesDependencyAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCarriesDependency }, // AT_CarriesDependency |
3172 | | { 1, 0, 0, 0, 0, 0, 1, 0, checkCleanupAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Cleanup |
3173 | | { 1, 0, 0, 0, 0, 0, 0, 0, checkCodeSegAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_CodeSeg |
3174 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkColdAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCold }, // AT_Cold |
3175 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkCommonAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForCommon }, // AT_Common |
3176 | | { 0, 0, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Const |
3177 | | { 0, 1, 0, 0, 0, 0, 1, 1, checkConstructorAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForConstructor }, // AT_Constructor |
3178 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkConsumableAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForConsumable }, // AT_Consumable |
3179 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkConsumableAutoCastAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForConsumableAutoCast }, // AT_ConsumableAutoCast |
3180 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkConsumableSetOnReadAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForConsumableSetOnRead }, // AT_ConsumableSetOnRead |
3181 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkConvergentAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForConvergent }, // AT_Convergent |
3182 | | { 0, 0, 0, 1, 0, 0, 1, 1, checkDLLExportAppertainsTo, defaultDiagnoseLangOpts, isTargetx86x86_64armthumbaarch64Win32, defaultSpellingIndexToSemanticSpelling, matchRulesForDLLExport }, // AT_DLLExport |
3183 | | { 0, 0, 0, 1, 0, 0, 0, 0, checkDLLExportStaticLocalAppertainsTo, defaultDiagnoseLangOpts, isTargetx86x86_64armthumbaarch64Win32, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_DLLExportStaticLocal |
3184 | | { 0, 0, 0, 1, 0, 0, 1, 1, checkDLLImportAppertainsTo, defaultDiagnoseLangOpts, isTargetx86x86_64armthumbaarch64Win32, defaultSpellingIndexToSemanticSpelling, matchRulesForDLLImport }, // AT_DLLImport |
3185 | | { 0, 0, 0, 1, 0, 0, 0, 0, checkDLLImportStaticLocalAppertainsTo, defaultDiagnoseLangOpts, isTargetx86x86_64armthumbaarch64Win32, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_DLLImportStaticLocal |
3186 | | { 0, 2, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Deprecated |
3187 | | { 0, 1, 0, 0, 0, 0, 1, 1, checkDestructorAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForDestructor }, // AT_Destructor |
3188 | | { 3, 0, 0, 0, 0, 0, 0, 0, checkDiagnoseIfAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_DiagnoseIf |
3189 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkDisableTailCallsAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForDisableTailCalls }, // AT_DisableTailCalls |
3190 | | { 0, 0, 0, 1, 0, 0, 0, 0, checkEmptyBasesAppertainsTo, defaultDiagnoseLangOpts, isTargetx86x86_64armthumbaarch64, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_EmptyBases |
3191 | | { 2, 0, 0, 0, 0, 0, 0, 1, checkEnableIfAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForEnableIf }, // AT_EnableIf |
3192 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkEnumExtensibilityAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForEnumExtensibility }, // AT_EnumExtensibility |
3193 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkExcludeFromExplicitInstantiationAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForExcludeFromExplicitInstantiation }, // AT_ExcludeFromExplicitInstantiation |
3194 | | { 1, 15, 0, 0, 0, 0, 0, 0, checkExclusiveTrylockFunctionAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_ExclusiveTrylockFunction |
3195 | | { 1, 0, 0, 0, 0, 0, 0, 0, checkExtVectorTypeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_ExtVectorType |
3196 | | { 0, 3, 1, 0, 0, 0, 0, 1, checkExternalSourceSymbolAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForExternalSourceSymbol }, // AT_ExternalSourceSymbol |
3197 | | { 0, 0, 0, 0, 0, 1, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_FallThrough |
3198 | | { 0, 0, 0, 0, 1, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_FastCall |
3199 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkFlagEnumAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForFlagEnum }, // AT_FlagEnum |
3200 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkFlattenAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForFlatten }, // AT_Flatten |
3201 | | { 3, 0, 0, 0, 0, 0, 1, 0, checkFormatAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Format |
3202 | | { 1, 0, 0, 0, 0, 0, 1, 0, checkFormatArgAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_FormatArg |
3203 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkGNUInlineAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForGNUInline }, // AT_GNUInline |
3204 | | { 1, 0, 0, 0, 0, 0, 0, 0, checkGuardedByAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_GuardedBy |
3205 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkGuardedVarAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_GuardedVar |
3206 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkHIPPinnedShadowAppertainsTo, checkHIPLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForHIPPinnedShadow }, // AT_HIPPinnedShadow |
3207 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkHotAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForHot }, // AT_Hot |
3208 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkIBActionAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForIBAction }, // AT_IBAction |
3209 | | { 0, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_IBOutlet |
3210 | | { 0, 1, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_IBOutletCollection |
3211 | | { 1, 0, 0, 1, 0, 0, 1, 1, checkIFuncAppertainsTo, defaultDiagnoseLangOpts, isTargetELF, defaultSpellingIndexToSemanticSpelling, matchRulesForIFunc }, // AT_IFunc |
3212 | | { 1, 0, 0, 0, 0, 0, 1, 1, checkInitPriorityAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForInitPriority }, // AT_InitPriority |
3213 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_IntelOclBicc |
3214 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkInternalLinkageAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForInternalLinkage }, // AT_InternalLinkage |
3215 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkLTOVisibilityPublicAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForLTOVisibilityPublic }, // AT_LTOVisibilityPublic |
3216 | | { 1, 0, 0, 1, 0, 0, 0, 0, checkLayoutVersionAppertainsTo, defaultDiagnoseLangOpts, isTargetx86x86_64armthumbaarch64, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_LayoutVersion |
3217 | | { 0, 0, 0, 0, 1, 0, 0, 0, checkLifetimeBoundAppertainsTo, checkCPlusPlusLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_LifetimeBound |
3218 | | { 1, 0, 0, 0, 0, 0, 0, 0, checkLockReturnedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_LockReturned |
3219 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkLockableAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForLockable }, // AT_Lockable |
3220 | | { 0, 15, 0, 0, 0, 0, 0, 0, checkLocksExcludedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_LocksExcluded |
3221 | | { 3, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, LoopHintAttrSpellingMap, nullptr }, // AT_LoopHint |
3222 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkMIGServerRoutineAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForMIGServerRoutine }, // AT_MIGServerRoutine |
3223 | | { 0, 0, 0, 0, 1, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_MSABI |
3224 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkMSAllocatorAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_MSAllocator |
3225 | | { 0, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, checkMicrosoftExtLangOpts, defaultTargetRequirements, MSInheritanceAttrSpellingMap, nullptr }, // AT_MSInheritance |
3226 | | { 0, 0, 0, 1, 0, 0, 0, 0, checkMSNoVTableAppertainsTo, defaultDiagnoseLangOpts, isTargetx86x86_64armthumbaarch64, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_MSNoVTable |
3227 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkMSStructAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForMSStruct }, // AT_MSStruct |
3228 | | { 0, 0, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_MayAlias |
3229 | | { 0, 0, 0, 1, 0, 0, 1, 1, checkMicroMipsAppertainsTo, defaultDiagnoseLangOpts, isTargetmipsmipsel, defaultSpellingIndexToSemanticSpelling, matchRulesForMicroMips }, // AT_MicroMips |
3230 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkMinSizeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForMinSize }, // AT_MinSize |
3231 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkMinVectorWidthAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForMinVectorWidth }, // AT_MinVectorWidth |
3232 | | { 0, 0, 0, 1, 0, 0, 1, 1, checkMips16AppertainsTo, defaultDiagnoseLangOpts, isTargetmipsmipsel, defaultSpellingIndexToSemanticSpelling, matchRulesForMips16 }, // AT_Mips16 |
3233 | | { 0, 0, 0, 1, 0, 0, 1, 1, checkMipsLongCallAppertainsTo, defaultDiagnoseLangOpts, isTargetmipsmipselmips64mips64el, MipsLongCallAttrSpellingMap, matchRulesForMipsLongCall }, // AT_MipsLongCall |
3234 | | { 0, 0, 0, 1, 0, 0, 1, 1, checkMipsShortCallAppertainsTo, defaultDiagnoseLangOpts, isTargetmipsmipselmips64mips64el, MipsShortCallAttrSpellingMap, matchRulesForMipsShortCall }, // AT_MipsShortCall |
3235 | | { 1, 0, 0, 0, 0, 0, 1, 0, checkModeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Mode |
3236 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkNSConsumedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNSConsumed }, // AT_NSConsumed |
3237 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkNSConsumesSelfAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNSConsumesSelf }, // AT_NSConsumesSelf |
3238 | | { 0, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_NSReturnsAutoreleased |
3239 | | { 0, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_NSReturnsNotRetained |
3240 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_NSReturnsRetained |
3241 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkNakedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNaked }, // AT_Naked |
3242 | | { 1, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_NeonPolyVectorType |
3243 | | { 1, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_NeonVectorType |
3244 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkNoAliasAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_NoAlias |
3245 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkNoCommonAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoCommon }, // AT_NoCommon |
3246 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkNoDebugAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoDebug }, // AT_NoDebug |
3247 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_NoDeref |
3248 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkNoDestroyAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoDestroy }, // AT_NoDestroy |
3249 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkNoDuplicateAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoDuplicate }, // AT_NoDuplicate |
3250 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkNoEscapeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoEscape }, // AT_NoEscape |
3251 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkNoInlineAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoInline }, // AT_NoInline |
3252 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkNoInstrumentFunctionAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoInstrumentFunction }, // AT_NoInstrumentFunction |
3253 | | { 0, 0, 0, 1, 0, 0, 1, 1, checkNoMicroMipsAppertainsTo, defaultDiagnoseLangOpts, isTargetmipsmipsel, defaultSpellingIndexToSemanticSpelling, matchRulesForNoMicroMips }, // AT_NoMicroMips |
3254 | | { 0, 0, 0, 1, 0, 0, 1, 1, checkNoMips16AppertainsTo, defaultDiagnoseLangOpts, isTargetmipsmipsel, defaultSpellingIndexToSemanticSpelling, matchRulesForNoMips16 }, // AT_NoMips16 |
3255 | | { 0, 0, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_NoReturn |
3256 | | { 0, 15, 0, 0, 0, 0, 0, 1, checkNoSanitizeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoSanitize }, // AT_NoSanitize |
3257 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkNoSanitizeSpecificAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoSanitizeSpecific }, // AT_NoSanitizeSpecific |
3258 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkNoSpeculativeLoadHardeningAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoSpeculativeLoadHardening }, // AT_NoSpeculativeLoadHardening |
3259 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkNoSplitStackAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoSplitStack }, // AT_NoSplitStack |
3260 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkNoStackProtectorAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoStackProtector }, // AT_NoStackProtector |
3261 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkNoThreadSafetyAnalysisAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoThreadSafetyAnalysis }, // AT_NoThreadSafetyAnalysis |
3262 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkNoThrowAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNoThrow }, // AT_NoThrow |
3263 | | { 0, 0, 0, 1, 0, 0, 0, 0, checkNoUniqueAddressAppertainsTo, defaultDiagnoseLangOpts, isTarget, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_NoUniqueAddress |
3264 | | { 0, 15, 0, 0, 0, 0, 1, 0, checkNonNullAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_NonNull |
3265 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkNotTailCalledAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForNotTailCalled }, // AT_NotTailCalled |
3266 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkOSConsumedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForOSConsumed }, // AT_OSConsumed |
3267 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkOSConsumesThisAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_OSConsumesThis |
3268 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkOSReturnsNotRetainedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForOSReturnsNotRetained }, // AT_OSReturnsNotRetained |
3269 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkOSReturnsRetainedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForOSReturnsRetained }, // AT_OSReturnsRetained |
3270 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkOSReturnsRetainedOnNonZeroAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForOSReturnsRetainedOnNonZero }, // AT_OSReturnsRetainedOnNonZero |
3271 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkOSReturnsRetainedOnZeroAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForOSReturnsRetainedOnZero }, // AT_OSReturnsRetainedOnZero |
3272 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCBoxableAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCBoxable }, // AT_ObjCBoxable |
3273 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkObjCBridgeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCBridge }, // AT_ObjCBridge |
3274 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkObjCBridgeMutableAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCBridgeMutable }, // AT_ObjCBridgeMutable |
3275 | | { 3, 0, 1, 0, 0, 0, 0, 1, checkObjCBridgeRelatedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCBridgeRelated }, // AT_ObjCBridgeRelated |
3276 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCClassStubAppertainsTo, checkObjCNonFragileRuntimeLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCClassStub }, // AT_ObjCClassStub |
3277 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCDesignatedInitializerAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCDesignatedInitializer }, // AT_ObjCDesignatedInitializer |
3278 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCExceptionAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCException }, // AT_ObjCException |
3279 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCExplicitProtocolImplAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCExplicitProtocolImpl }, // AT_ObjCExplicitProtocolImpl |
3280 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCExternallyRetainedAppertainsTo, checkObjCAutoRefCountLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCExternallyRetained }, // AT_ObjCExternallyRetained |
3281 | | { 1, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_ObjCGC |
3282 | | { 0, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_ObjCIndependentClass |
3283 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_ObjCInertUnsafeUnretained |
3284 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_ObjCKindOf |
3285 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkObjCMethodFamilyAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCMethodFamily }, // AT_ObjCMethodFamily |
3286 | | { 0, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_ObjCNSObject |
3287 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCNonLazyClassAppertainsTo, checkObjCLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCNonLazyClass }, // AT_ObjCNonLazyClass |
3288 | | { 1, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_ObjCOwnership |
3289 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCPreciseLifetimeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCPreciseLifetime }, // AT_ObjCPreciseLifetime |
3290 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCRequiresPropertyDefsAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCRequiresPropertyDefs }, // AT_ObjCRequiresPropertyDefs |
3291 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCRequiresSuperAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCRequiresSuper }, // AT_ObjCRequiresSuper |
3292 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCReturnsInnerPointerAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCReturnsInnerPointer }, // AT_ObjCReturnsInnerPointer |
3293 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCRootClassAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCRootClass }, // AT_ObjCRootClass |
3294 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkObjCRuntimeNameAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCRuntimeName }, // AT_ObjCRuntimeName |
3295 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCRuntimeVisibleAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCRuntimeVisible }, // AT_ObjCRuntimeVisible |
3296 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkObjCSubclassingRestrictedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForObjCSubclassingRestricted }, // AT_ObjCSubclassingRestricted |
3297 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkOpenCLAccessAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, OpenCLAccessAttrSpellingMap, nullptr }, // AT_OpenCLAccess |
3298 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_OpenCLConstantAddressSpace |
3299 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_OpenCLGenericAddressSpace |
3300 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_OpenCLGlobalAddressSpace |
3301 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkOpenCLIntelReqdSubGroupSizeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForOpenCLIntelReqdSubGroupSize }, // AT_OpenCLIntelReqdSubGroupSize |
3302 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkOpenCLKernelAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_OpenCLKernel |
3303 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_OpenCLLocalAddressSpace |
3304 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkOpenCLNoSVMAppertainsTo, checkOpenCLLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForOpenCLNoSVM }, // AT_OpenCLNoSVM |
3305 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_OpenCLPrivateAddressSpace |
3306 | | { 1, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_OpenCLUnrollHint |
3307 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkOptimizeNoneAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForOptimizeNone }, // AT_OptimizeNone |
3308 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkOverloadableAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForOverloadable }, // AT_Overloadable |
3309 | | { 1, 15, 0, 0, 0, 0, 0, 0, checkOwnershipAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, OwnershipAttrSpellingMap, nullptr }, // AT_Ownership |
3310 | | { 0, 0, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Packed |
3311 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkParamTypestateAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForParamTypestate }, // AT_ParamTypestate |
3312 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Pascal |
3313 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkPassObjectSizeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, PassObjectSizeAttrSpellingMap, matchRulesForPassObjectSize }, // AT_PassObjectSize |
3314 | | { 1, 0, 0, 0, 1, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Pcs |
3315 | | { 1, 0, 0, 0, 0, 0, 0, 0, checkPragmaClangBSSSectionAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_PragmaClangBSSSection |
3316 | | { 1, 0, 0, 0, 0, 0, 0, 0, checkPragmaClangDataSectionAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_PragmaClangDataSection |
3317 | | { 1, 0, 0, 0, 0, 0, 0, 0, checkPragmaClangRodataSectionAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_PragmaClangRodataSection |
3318 | | { 1, 0, 0, 0, 0, 0, 0, 0, checkPragmaClangTextSectionAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_PragmaClangTextSection |
3319 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_PreserveAll |
3320 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_PreserveMost |
3321 | | { 1, 0, 0, 0, 0, 0, 0, 0, checkPtGuardedByAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_PtGuardedBy |
3322 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkPtGuardedVarAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_PtGuardedVar |
3323 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Ptr32 |
3324 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Ptr64 |
3325 | | { 0, 0, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Pure |
3326 | | { 0, 0, 0, 0, 1, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_RegCall |
3327 | | { 1, 0, 0, 0, 1, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Regparm |
3328 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkReinitializesAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Reinitializes |
3329 | | { 0, 15, 0, 0, 0, 0, 0, 0, checkReleaseCapabilityAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, ReleaseCapabilityAttrSpellingMap, nullptr }, // AT_ReleaseCapability |
3330 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkRenderScriptKernelAppertainsTo, checkRenderScriptLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForRenderScriptKernel }, // AT_RenderScriptKernel |
3331 | | { 3, 0, 0, 0, 0, 0, 0, 1, checkReqdWorkGroupSizeAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForReqdWorkGroupSize }, // AT_ReqdWorkGroupSize |
3332 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkRequireConstantInitAppertainsTo, checkCPlusPlusLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForRequireConstantInit }, // AT_RequireConstantInit |
3333 | | { 0, 15, 0, 0, 0, 0, 0, 0, checkRequiresCapabilityAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, RequiresCapabilityAttrSpellingMap, nullptr }, // AT_RequiresCapability |
3334 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkRestrictAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, RestrictAttrSpellingMap, matchRulesForRestrict }, // AT_Restrict |
3335 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkReturnTypestateAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForReturnTypestate }, // AT_ReturnTypestate |
3336 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkReturnsNonNullAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForReturnsNonNull }, // AT_ReturnsNonNull |
3337 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkReturnsTwiceAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForReturnsTwice }, // AT_ReturnsTwice |
3338 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_SPtr |
3339 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkScopedLockableAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForScopedLockable }, // AT_ScopedLockable |
3340 | | { 1, 0, 0, 0, 0, 0, 1, 1, checkSectionAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, SectionAttrSpellingMap, matchRulesForSection }, // AT_Section |
3341 | | { 0, 0, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_SelectAny |
3342 | | { 0, 2, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Sentinel |
3343 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkSetTypestateAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForSetTypestate }, // AT_SetTypestate |
3344 | | { 1, 15, 0, 0, 0, 0, 0, 0, checkSharedTrylockFunctionAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_SharedTrylockFunction |
3345 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkSpeculativeLoadHardeningAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForSpeculativeLoadHardening }, // AT_SpeculativeLoadHardening |
3346 | | { 0, 0, 0, 0, 1, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_StdCall |
3347 | | { 0, 15, 0, 0, 0, 1, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Suppress |
3348 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_SwiftCall |
3349 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkSwiftContextAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForSwiftContext }, // AT_SwiftContext |
3350 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkSwiftErrorResultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForSwiftErrorResult }, // AT_SwiftErrorResult |
3351 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkSwiftIndirectResultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForSwiftIndirectResult }, // AT_SwiftIndirectResult |
3352 | | { 0, 0, 0, 0, 1, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_SysVABI |
3353 | | { 1, 0, 0, 0, 0, 0, 1, 1, checkTLSModelAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForTLSModel }, // AT_TLSModel |
3354 | | { 1, 0, 0, 0, 0, 0, 1, 1, checkTargetAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForTarget }, // AT_Target |
3355 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkTestTypestateAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForTestTypestate }, // AT_TestTypestate |
3356 | | { 0, 0, 0, 0, 1, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_ThisCall |
3357 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkThreadAppertainsTo, checkMicrosoftExtLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Thread |
3358 | | { 0, 0, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, checkCOnlyLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_TransparentUnion |
3359 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkTrivialABIAppertainsTo, checkCPlusPlusLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForTrivialABI }, // AT_TrivialABI |
3360 | | { 1, 15, 0, 0, 0, 0, 0, 0, checkTryAcquireCapabilityAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, TryAcquireCapabilityAttrSpellingMap, nullptr }, // AT_TryAcquireCapability |
3361 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_TypeNonNull |
3362 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_TypeNullUnspecified |
3363 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_TypeNullable |
3364 | | { 4, 0, 1, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_TypeTagForDatatype |
3365 | | { 1, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_TypeVisibility |
3366 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_UPtr |
3367 | | { 0, 1, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Unavailable |
3368 | | { 0, 0, 0, 0, 0, 0, 0, 0, checkUninitializedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Uninitialized |
3369 | | { 0, 0, 0, 0, 0, 0, 1, 0, checkUnusedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, UnusedAttrSpellingMap, nullptr }, // AT_Unused |
3370 | | { 0, 0, 0, 0, 0, 0, 1, 0, checkUsedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Used |
3371 | | { 1, 0, 0, 0, 0, 0, 0, 0, checkUuidAppertainsTo, checkMicrosoftExtBorlandLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Uuid |
3372 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkVecReturnAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForVecReturn }, // AT_VecReturn |
3373 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkVecTypeHintAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForVecTypeHint }, // AT_VecTypeHint |
3374 | | { 0, 0, 0, 0, 1, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_VectorCall |
3375 | | { 1, 0, 0, 0, 1, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_VectorSize |
3376 | | { 1, 0, 0, 0, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_Visibility |
3377 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkWarnUnusedAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForWarnUnused }, // AT_WarnUnused |
3378 | | { 0, 1, 0, 0, 0, 0, 1, 1, checkWarnUnusedResultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, WarnUnusedResultAttrSpellingMap, matchRulesForWarnUnusedResult }, // AT_WarnUnusedResult |
3379 | | { 0, 0, 0, 0, 0, 0, 1, 1, checkWeakAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForWeak }, // AT_Weak |
3380 | | { 0, 0, 0, 0, 0, 0, 0, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_WeakImport |
3381 | | { 0, 1, 0, 0, 0, 0, 1, 1, checkWeakRefAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForWeakRef }, // AT_WeakRef |
3382 | | { 1, 0, 0, 1, 0, 0, 0, 1, checkWebAssemblyImportModuleAppertainsTo, defaultDiagnoseLangOpts, isTargetwasm32wasm64, defaultSpellingIndexToSemanticSpelling, matchRulesForWebAssemblyImportModule }, // AT_WebAssemblyImportModule |
3383 | | { 1, 0, 0, 1, 0, 0, 0, 1, checkWebAssemblyImportNameAppertainsTo, defaultDiagnoseLangOpts, isTargetwasm32wasm64, defaultSpellingIndexToSemanticSpelling, matchRulesForWebAssemblyImportName }, // AT_WebAssemblyImportName |
3384 | | { 3, 0, 0, 0, 0, 0, 0, 1, checkWorkGroupSizeHintAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForWorkGroupSizeHint }, // AT_WorkGroupSizeHint |
3385 | | { 0, 0, 0, 1, 0, 0, 1, 0, defaultAppertainsTo, defaultDiagnoseLangOpts, isTargetx86x86_64, defaultSpellingIndexToSemanticSpelling, nullptr }, // AT_X86ForceAlignArgPointer |
3386 | | { 0, 0, 0, 0, 0, 0, 0, 1, checkXRayInstrumentAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, XRayInstrumentAttrSpellingMap, matchRulesForXRayInstrument }, // AT_XRayInstrument |
3387 | | { 1, 0, 0, 0, 0, 0, 0, 1, checkXRayLogArgsAppertainsTo, defaultDiagnoseLangOpts, defaultTargetRequirements, defaultSpellingIndexToSemanticSpelling, matchRulesForXRayLogArgs } // AT_XRayLogArgs |
3388 | | }; |
3389 | | |
3390 | 582k | static bool checkAttributeMatchRuleAppliesTo(const Decl *D, attr::SubjectMatchRule rule) { |
3391 | 582k | switch (rule) { |
3392 | 582k | case attr::SubjectMatchRule_block: |
3393 | 61 | return isa<BlockDecl>(D); |
3394 | 582k | case attr::SubjectMatchRule_enum: |
3395 | 41 | return isa<EnumDecl>(D); |
3396 | 582k | case attr::SubjectMatchRule_enum_constant: |
3397 | 26 | return isa<EnumConstantDecl>(D); |
3398 | 582k | case attr::SubjectMatchRule_field: |
3399 | 80 | return isa<FieldDecl>(D); |
3400 | 582k | case attr::SubjectMatchRule_function: |
3401 | 288k | return isa<FunctionDecl>(D); |
3402 | 582k | case attr::SubjectMatchRule_function_is_member: |
3403 | 26 | return isa<CXXMethodDecl>(D); |
3404 | 582k | case attr::SubjectMatchRule_namespace: |
3405 | 38 | return isa<NamespaceDecl>(D); |
3406 | 582k | case attr::SubjectMatchRule_objc_category: |
3407 | 26 | return isa<ObjCCategoryDecl>(D); |
3408 | 582k | case attr::SubjectMatchRule_objc_implementation: |
3409 | 7 | return isa<ObjCImplDecl>(D); |
3410 | 582k | case attr::SubjectMatchRule_objc_interface: |
3411 | 102 | return isa<ObjCInterfaceDecl>(D); |
3412 | 582k | case attr::SubjectMatchRule_objc_method: |
3413 | 83 | return isa<ObjCMethodDecl>(D); |
3414 | 582k | case attr::SubjectMatchRule_objc_method_is_instance: |
3415 | 16 | return isObjCInstanceMethod(D); |
3416 | 582k | case attr::SubjectMatchRule_objc_property: |
3417 | 30 | return isa<ObjCPropertyDecl>(D); |
3418 | 582k | case attr::SubjectMatchRule_objc_protocol: |
3419 | 55 | return isa<ObjCProtocolDecl>(D); |
3420 | 582k | case attr::SubjectMatchRule_record: |
3421 | 292k | return isa<RecordDecl>(D) || isa<CXXRecordDecl>(D)288k ; |
3422 | 582k | case attr::SubjectMatchRule_record_not_is_union: |
3423 | 78 | return isStruct(D); |
3424 | 582k | case attr::SubjectMatchRule_hasType_abstract: |
3425 | 0 | assert(false && "Abstract matcher rule isn't allowed"); |
3426 | 0 | return false; |
3427 | 582k | case attr::SubjectMatchRule_hasType_functionType: |
3428 | 44 | return isFunctionLike(D); |
3429 | 582k | case attr::SubjectMatchRule_type_alias: |
3430 | 40 | return isa<TypedefNameDecl>(D); |
3431 | 582k | case attr::SubjectMatchRule_variable: |
3432 | 92 | return isa<VarDecl>(D); |
3433 | 582k | case attr::SubjectMatchRule_variable_is_thread_local: |
3434 | 2 | return isTLSVar(D); |
3435 | 582k | case attr::SubjectMatchRule_variable_is_global: |
3436 | 40 | return isGlobalVar(D); |
3437 | 582k | case attr::SubjectMatchRule_variable_is_parameter: |
3438 | 26 | return isa<ParmVarDecl>(D); |
3439 | 582k | case attr::SubjectMatchRule_variable_not_is_parameter: |
3440 | 30 | return isNonParmVar(D); |
3441 | 0 | } |
3442 | 0 | llvm_unreachable("Invalid match rule"); |
3443 | 0 | return false; |
3444 | 0 | } |
3445 | | |