1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Parsed attribute helpers *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Attr.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10#if !defined(WANT_DECL_MERGE_LOGIC) && !defined(WANT_STMT_MERGE_LOGIC)
11static bool isStruct(const Decl *D) {
12 if (const auto *S = dyn_cast<RecordDecl>(Val: D))
13 return !S->isUnion();
14 return false;
15}
16
17static bool isSharedVar(const Decl *D) {
18 if (const auto *S = dyn_cast<VarDecl>(Val: D))
19 return S->hasGlobalStorage() && !S->getTLSKind();
20 return false;
21}
22
23static bool isGlobalVar(const Decl *D) {
24 if (const auto *S = dyn_cast<VarDecl>(Val: D))
25 return S->hasGlobalStorage();
26 return false;
27}
28
29static bool isHasFunctionProto(const Decl *D) {
30 if (const auto *S = dyn_cast<Decl>(Val: D))
31 return (S->getFunctionType(BlocksToo: true) != nullptr &&
32 isa<FunctionProtoType>(Val: S->getFunctionType())) ||
33 isa<ObjCMethodDecl>(Val: S) ||
34 isa<BlockDecl>(Val: S);
35 return false;
36}
37
38static bool isFunctionLike(const Decl *D) {
39 if (const auto *S = dyn_cast<Decl>(Val: D))
40 return S->getFunctionType(BlocksToo: false) != nullptr;
41 return false;
42}
43
44static bool isInlineFunction(const Decl *D) {
45 if (const auto *S = dyn_cast<FunctionDecl>(Val: D))
46 return S->isInlineSpecified();
47 return false;
48}
49
50static bool isLocalVar(const Decl *D) {
51 if (const auto *S = dyn_cast<VarDecl>(Val: D))
52 return S->hasLocalStorage() && !isa<ParmVarDecl>(Val: S);
53 return false;
54}
55
56static bool isNonTLSGlobalVar(const Decl *D) {
57 if (const auto *S = dyn_cast<VarDecl>(Val: D))
58 return S->hasGlobalStorage() &&
59 S->getTLSKind() == 0;
60 return false;
61}
62
63static bool isHLSLEntry(const Decl *D) {
64 if (const auto *S = dyn_cast<FunctionDecl>(Val: D))
65 return S->isExternallyVisible() && !isa<CXXMethodDecl>(Val: S);
66 return false;
67}
68
69static bool isHLSLBufferObj(const Decl *D) {
70 if (const auto *S = dyn_cast<HLSLBufferDecl>(Val: D))
71 return isa<HLSLBufferDecl>(Val: S);
72 return false;
73}
74
75static bool isExternalGlobalVar(const Decl *D) {
76 if (const auto *S = dyn_cast<VarDecl>(Val: D))
77 return S->hasGlobalStorage() &&
78 S->getStorageClass()!=StorageClass::SC_Static &&
79 !S->isLocalExternDecl();
80 return false;
81}
82
83static bool isObjCInstanceMethod(const Decl *D) {
84 if (const auto *S = dyn_cast<ObjCMethodDecl>(Val: D))
85 return S->isInstanceMethod();
86 return false;
87}
88
89static bool isImplicitObjectParameter(const Decl *D) {
90 if (const auto *S = dyn_cast<FunctionDecl>(Val: D))
91 return static_cast<void>(S), false;
92 return false;
93}
94
95static bool isNonParmVar(const Decl *D) {
96 if (const auto *S = dyn_cast<VarDecl>(Val: D))
97 return S->getKind() != Decl::ParmVar;
98 return false;
99}
100
101static bool isNonBitField(const Decl *D) {
102 if (const auto *S = dyn_cast<FieldDecl>(Val: D))
103 return !S->isBitField();
104 return false;
105}
106
107static bool isNonStaticCXXMethod(const Decl *D) {
108 if (const auto *S = dyn_cast<CXXMethodDecl>(Val: D))
109 return !S->isStatic();
110 return false;
111}
112
113static bool isClassTmpl(const Decl *D) {
114 if (const auto *S = dyn_cast<CXXRecordDecl>(Val: D))
115 return S->getDescribedClassTemplate();
116 return false;
117}
118
119static bool isBitField(const Decl *D) {
120 if (const auto *S = dyn_cast<FieldDecl>(Val: D))
121 return S->isBitField();
122 return false;
123}
124
125static bool isNonStaticNonConstCXXMethod(const Decl *D) {
126 if (const auto *S = dyn_cast<CXXMethodDecl>(Val: D))
127 return !S->isStatic() && !S->isConst();
128 return false;
129}
130
131static bool isNonLocalVar(const Decl *D) {
132 if (const auto *S = dyn_cast<VarDecl>(Val: D))
133 return !S->hasLocalStorage();
134 return false;
135}
136
137static bool isFunctionTmpl(const Decl *D) {
138 if (const auto *S = dyn_cast<FunctionDecl>(Val: D))
139 return S->getTemplatedKind() ==
140 FunctionDecl::TK_FunctionTemplate;
141 return false;
142}
143
144static bool isTLSVar(const Decl *D) {
145 if (const auto *S = dyn_cast<VarDecl>(Val: D))
146 return S->getTLSKind() != 0;
147 return false;
148}
149
150static bool isFunctionPointer(const Decl *D) {
151 if (const auto *S = dyn_cast<Decl>(Val: D))
152 return S->isFunctionPointerType();
153 return false;
154}
155
156static constexpr ParsedAttrInfo::Spelling AArch64SVEPcsSpellings[] = {
157 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "aarch64_sve_pcs"},
158 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::aarch64_sve_pcs"},
159 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::aarch64_sve_pcs"},
160};
161struct ParsedAttrInfoAArch64SVEPcs final : public ParsedAttrInfo {
162 constexpr ParsedAttrInfoAArch64SVEPcs() : ParsedAttrInfo(
163 /*AttrKind=*/ParsedAttr::AT_AArch64SVEPcs,
164 /*NumArgs=*/0,
165 /*OptArgs=*/0,
166 /*NumArgMembers=*/0,
167 /*HasCustomParsing=*/0,
168 /*AcceptsExprPack=*/0,
169 /*IsTargetSpecific=*/0,
170 /*IsType=*/1,
171 /*IsStmt=*/0,
172 /*IsKnownToGCC=*/0,
173 /*IsSupportedByPragmaAttribute=*/0,
174 /*Spellings=*/AArch64SVEPcsSpellings,
175 /*ArgNames=*/{}) {}
176bool isParamExpr(size_t N) const override {
177 return false;
178}
179
180static const ParsedAttrInfoAArch64SVEPcs Instance;
181};
182const ParsedAttrInfoAArch64SVEPcs ParsedAttrInfoAArch64SVEPcs::Instance;
183static constexpr ParsedAttrInfo::Spelling AArch64VectorPcsSpellings[] = {
184 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "aarch64_vector_pcs"},
185 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::aarch64_vector_pcs"},
186 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::aarch64_vector_pcs"},
187};
188struct ParsedAttrInfoAArch64VectorPcs final : public ParsedAttrInfo {
189 constexpr ParsedAttrInfoAArch64VectorPcs() : ParsedAttrInfo(
190 /*AttrKind=*/ParsedAttr::AT_AArch64VectorPcs,
191 /*NumArgs=*/0,
192 /*OptArgs=*/0,
193 /*NumArgMembers=*/0,
194 /*HasCustomParsing=*/0,
195 /*AcceptsExprPack=*/0,
196 /*IsTargetSpecific=*/0,
197 /*IsType=*/1,
198 /*IsStmt=*/0,
199 /*IsKnownToGCC=*/0,
200 /*IsSupportedByPragmaAttribute=*/0,
201 /*Spellings=*/AArch64VectorPcsSpellings,
202 /*ArgNames=*/{}) {}
203bool isParamExpr(size_t N) const override {
204 return false;
205}
206
207static const ParsedAttrInfoAArch64VectorPcs Instance;
208};
209const ParsedAttrInfoAArch64VectorPcs ParsedAttrInfoAArch64VectorPcs::Instance;
210static constexpr ParsedAttrInfo::Spelling AMDGPUFlatWorkGroupSizeSpellings[] = {
211 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "amdgpu_flat_work_group_size"},
212 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::amdgpu_flat_work_group_size"},
213};
214static constexpr const char *AMDGPUFlatWorkGroupSizeArgNames[] = {
215"Min","Max",};
216struct ParsedAttrInfoAMDGPUFlatWorkGroupSize final : public ParsedAttrInfo {
217 constexpr ParsedAttrInfoAMDGPUFlatWorkGroupSize() : ParsedAttrInfo(
218 /*AttrKind=*/ParsedAttr::AT_AMDGPUFlatWorkGroupSize,
219 /*NumArgs=*/2,
220 /*OptArgs=*/0,
221 /*NumArgMembers=*/2,
222 /*HasCustomParsing=*/0,
223 /*AcceptsExprPack=*/0,
224 /*IsTargetSpecific=*/0,
225 /*IsType=*/0,
226 /*IsStmt=*/0,
227 /*IsKnownToGCC=*/0,
228 /*IsSupportedByPragmaAttribute=*/1,
229 /*Spellings=*/AMDGPUFlatWorkGroupSizeSpellings,
230 /*ArgNames=*/AMDGPUFlatWorkGroupSizeArgNames) {}
231bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
232 if (!isa<FunctionDecl>(Val: D)) {
233 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
234 << Attr << Attr.isRegularKeywordAttribute() << "kernel functions";
235 return false;
236 }
237 return true;
238}
239
240bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
241 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
242 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
243 return false;
244}
245
246void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
247 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
248}
249
250bool isParamExpr(size_t N) const override {
251 return (N == 0) || (N == 1) || false;
252}
253
254static const ParsedAttrInfoAMDGPUFlatWorkGroupSize Instance;
255};
256const ParsedAttrInfoAMDGPUFlatWorkGroupSize ParsedAttrInfoAMDGPUFlatWorkGroupSize::Instance;
257static constexpr ParsedAttrInfo::Spelling AMDGPUKernelCallSpellings[] = {
258 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "amdgpu_kernel"},
259 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::amdgpu_kernel"},
260 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::amdgpu_kernel"},
261};
262struct ParsedAttrInfoAMDGPUKernelCall final : public ParsedAttrInfo {
263 constexpr ParsedAttrInfoAMDGPUKernelCall() : ParsedAttrInfo(
264 /*AttrKind=*/ParsedAttr::AT_AMDGPUKernelCall,
265 /*NumArgs=*/0,
266 /*OptArgs=*/0,
267 /*NumArgMembers=*/0,
268 /*HasCustomParsing=*/0,
269 /*AcceptsExprPack=*/0,
270 /*IsTargetSpecific=*/0,
271 /*IsType=*/1,
272 /*IsStmt=*/0,
273 /*IsKnownToGCC=*/0,
274 /*IsSupportedByPragmaAttribute=*/0,
275 /*Spellings=*/AMDGPUKernelCallSpellings,
276 /*ArgNames=*/{}) {}
277bool isParamExpr(size_t N) const override {
278 return false;
279}
280
281static const ParsedAttrInfoAMDGPUKernelCall Instance;
282};
283const ParsedAttrInfoAMDGPUKernelCall ParsedAttrInfoAMDGPUKernelCall::Instance;
284static constexpr ParsedAttrInfo::Spelling AMDGPUMaxNumWorkGroupsSpellings[] = {
285 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "amdgpu_max_num_work_groups"},
286 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::amdgpu_max_num_work_groups"},
287};
288static constexpr const char *AMDGPUMaxNumWorkGroupsArgNames[] = {
289"MaxNumWorkGroupsX","MaxNumWorkGroupsY","MaxNumWorkGroupsZ",};
290struct ParsedAttrInfoAMDGPUMaxNumWorkGroups final : public ParsedAttrInfo {
291 constexpr ParsedAttrInfoAMDGPUMaxNumWorkGroups() : ParsedAttrInfo(
292 /*AttrKind=*/ParsedAttr::AT_AMDGPUMaxNumWorkGroups,
293 /*NumArgs=*/1,
294 /*OptArgs=*/2,
295 /*NumArgMembers=*/3,
296 /*HasCustomParsing=*/0,
297 /*AcceptsExprPack=*/0,
298 /*IsTargetSpecific=*/0,
299 /*IsType=*/0,
300 /*IsStmt=*/0,
301 /*IsKnownToGCC=*/0,
302 /*IsSupportedByPragmaAttribute=*/1,
303 /*Spellings=*/AMDGPUMaxNumWorkGroupsSpellings,
304 /*ArgNames=*/AMDGPUMaxNumWorkGroupsArgNames) {}
305bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
306 if (!isa<FunctionDecl>(Val: D)) {
307 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
308 << Attr << Attr.isRegularKeywordAttribute() << "kernel functions";
309 return false;
310 }
311 return true;
312}
313
314bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
315 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
316 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
317 return false;
318}
319
320void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
321 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
322}
323
324bool isParamExpr(size_t N) const override {
325 return (N == 0) || (N == 1) || (N == 2) || false;
326}
327
328static const ParsedAttrInfoAMDGPUMaxNumWorkGroups Instance;
329};
330const ParsedAttrInfoAMDGPUMaxNumWorkGroups ParsedAttrInfoAMDGPUMaxNumWorkGroups::Instance;
331static constexpr ParsedAttrInfo::Spelling AMDGPUNumSGPRSpellings[] = {
332 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "amdgpu_num_sgpr"},
333 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::amdgpu_num_sgpr"},
334};
335static constexpr const char *AMDGPUNumSGPRArgNames[] = {
336"NumSGPR",};
337struct ParsedAttrInfoAMDGPUNumSGPR final : public ParsedAttrInfo {
338 constexpr ParsedAttrInfoAMDGPUNumSGPR() : ParsedAttrInfo(
339 /*AttrKind=*/ParsedAttr::AT_AMDGPUNumSGPR,
340 /*NumArgs=*/1,
341 /*OptArgs=*/0,
342 /*NumArgMembers=*/1,
343 /*HasCustomParsing=*/0,
344 /*AcceptsExprPack=*/0,
345 /*IsTargetSpecific=*/0,
346 /*IsType=*/0,
347 /*IsStmt=*/0,
348 /*IsKnownToGCC=*/0,
349 /*IsSupportedByPragmaAttribute=*/1,
350 /*Spellings=*/AMDGPUNumSGPRSpellings,
351 /*ArgNames=*/AMDGPUNumSGPRArgNames) {}
352bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
353 if (!isa<FunctionDecl>(Val: D)) {
354 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
355 << Attr << Attr.isRegularKeywordAttribute() << "kernel functions";
356 return false;
357 }
358 return true;
359}
360
361bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
362 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
363 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
364 return false;
365}
366
367void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
368 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
369}
370
371bool isParamExpr(size_t N) const override {
372 return false;
373}
374
375static const ParsedAttrInfoAMDGPUNumSGPR Instance;
376};
377const ParsedAttrInfoAMDGPUNumSGPR ParsedAttrInfoAMDGPUNumSGPR::Instance;
378static constexpr ParsedAttrInfo::Spelling AMDGPUNumVGPRSpellings[] = {
379 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "amdgpu_num_vgpr"},
380 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::amdgpu_num_vgpr"},
381};
382static constexpr const char *AMDGPUNumVGPRArgNames[] = {
383"NumVGPR",};
384struct ParsedAttrInfoAMDGPUNumVGPR final : public ParsedAttrInfo {
385 constexpr ParsedAttrInfoAMDGPUNumVGPR() : ParsedAttrInfo(
386 /*AttrKind=*/ParsedAttr::AT_AMDGPUNumVGPR,
387 /*NumArgs=*/1,
388 /*OptArgs=*/0,
389 /*NumArgMembers=*/1,
390 /*HasCustomParsing=*/0,
391 /*AcceptsExprPack=*/0,
392 /*IsTargetSpecific=*/0,
393 /*IsType=*/0,
394 /*IsStmt=*/0,
395 /*IsKnownToGCC=*/0,
396 /*IsSupportedByPragmaAttribute=*/1,
397 /*Spellings=*/AMDGPUNumVGPRSpellings,
398 /*ArgNames=*/AMDGPUNumVGPRArgNames) {}
399bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
400 if (!isa<FunctionDecl>(Val: D)) {
401 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
402 << Attr << Attr.isRegularKeywordAttribute() << "kernel functions";
403 return false;
404 }
405 return true;
406}
407
408bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
409 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
410 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
411 return false;
412}
413
414void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
415 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
416}
417
418bool isParamExpr(size_t N) const override {
419 return false;
420}
421
422static const ParsedAttrInfoAMDGPUNumVGPR Instance;
423};
424const ParsedAttrInfoAMDGPUNumVGPR ParsedAttrInfoAMDGPUNumVGPR::Instance;
425static constexpr ParsedAttrInfo::Spelling AMDGPUWavesPerEUSpellings[] = {
426 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "amdgpu_waves_per_eu"},
427 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::amdgpu_waves_per_eu"},
428};
429static constexpr const char *AMDGPUWavesPerEUArgNames[] = {
430"Min","Max",};
431struct ParsedAttrInfoAMDGPUWavesPerEU final : public ParsedAttrInfo {
432 constexpr ParsedAttrInfoAMDGPUWavesPerEU() : ParsedAttrInfo(
433 /*AttrKind=*/ParsedAttr::AT_AMDGPUWavesPerEU,
434 /*NumArgs=*/1,
435 /*OptArgs=*/1,
436 /*NumArgMembers=*/2,
437 /*HasCustomParsing=*/0,
438 /*AcceptsExprPack=*/0,
439 /*IsTargetSpecific=*/0,
440 /*IsType=*/0,
441 /*IsStmt=*/0,
442 /*IsKnownToGCC=*/0,
443 /*IsSupportedByPragmaAttribute=*/1,
444 /*Spellings=*/AMDGPUWavesPerEUSpellings,
445 /*ArgNames=*/AMDGPUWavesPerEUArgNames) {}
446bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
447 if (!isa<FunctionDecl>(Val: D)) {
448 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
449 << Attr << Attr.isRegularKeywordAttribute() << "kernel functions";
450 return false;
451 }
452 return true;
453}
454
455bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
456 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
457 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
458 return false;
459}
460
461void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
462 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
463}
464
465bool isParamExpr(size_t N) const override {
466 return (N == 0) || (N == 1) || false;
467}
468
469static const ParsedAttrInfoAMDGPUWavesPerEU Instance;
470};
471const ParsedAttrInfoAMDGPUWavesPerEU ParsedAttrInfoAMDGPUWavesPerEU::Instance;
472static constexpr ParsedAttrInfo::Spelling InterruptSpellings[] = {
473 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "interrupt"},
474 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::interrupt"},
475 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::interrupt"},
476};
477static constexpr const char *InterruptArgNames[] = {
478"Interrupt",};
479struct ParsedAttrInfoInterrupt final : public ParsedAttrInfo {
480 constexpr ParsedAttrInfoInterrupt() : ParsedAttrInfo(
481 /*AttrKind=*/ParsedAttr::AT_Interrupt,
482 /*NumArgs=*/0,
483 /*OptArgs=*/1,
484 /*NumArgMembers=*/1,
485 /*HasCustomParsing=*/1,
486 /*AcceptsExprPack=*/0,
487 /*IsTargetSpecific=*/1,
488 /*IsType=*/0,
489 /*IsStmt=*/0,
490 /*IsKnownToGCC=*/1,
491 /*IsSupportedByPragmaAttribute=*/0,
492 /*Spellings=*/InterruptSpellings,
493 /*ArgNames=*/InterruptArgNames) {}
494bool existsInTarget(const TargetInfo &Target) const override {
495 const llvm::Triple &T = Target.getTriple(); (void)T;
496 return true && (T.getArch() == llvm::Triple::arm || T.getArch() == llvm::Triple::thumb || T.getArch() == llvm::Triple::armeb || T.getArch() == llvm::Triple::thumbeb || T.getArch() == llvm::Triple::avr || T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64 || T.getArch() == llvm::Triple::m68k || T.getArch() == llvm::Triple::msp430 || T.getArch() == llvm::Triple::mips || T.getArch() == llvm::Triple::mipsel || T.getArch() == llvm::Triple::riscv32 || T.getArch() == llvm::Triple::riscv64);
497}
498
499bool isParamExpr(size_t N) const override {
500 return false;
501}
502
503static const ParsedAttrInfoInterrupt Instance;
504};
505const ParsedAttrInfoInterrupt ParsedAttrInfoInterrupt::Instance;
506static constexpr ParsedAttrInfo::Spelling AVRSignalSpellings[] = {
507 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "signal"},
508 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::signal"},
509 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::signal"},
510};
511struct ParsedAttrInfoAVRSignal final : public ParsedAttrInfo {
512 constexpr ParsedAttrInfoAVRSignal() : ParsedAttrInfo(
513 /*AttrKind=*/ParsedAttr::AT_AVRSignal,
514 /*NumArgs=*/0,
515 /*OptArgs=*/0,
516 /*NumArgMembers=*/0,
517 /*HasCustomParsing=*/0,
518 /*AcceptsExprPack=*/0,
519 /*IsTargetSpecific=*/1,
520 /*IsType=*/0,
521 /*IsStmt=*/0,
522 /*IsKnownToGCC=*/1,
523 /*IsSupportedByPragmaAttribute=*/1,
524 /*Spellings=*/AVRSignalSpellings,
525 /*ArgNames=*/{}) {}
526bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
527 if (!isa<FunctionDecl>(Val: D)) {
528 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
529 << Attr << Attr.isRegularKeywordAttribute() << "functions";
530 return false;
531 }
532 return true;
533}
534
535bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
536 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
537 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
538 return false;
539}
540
541bool existsInTarget(const TargetInfo &Target) const override {
542 const llvm::Triple &T = Target.getTriple(); (void)T;
543 return true && (T.getArch() == llvm::Triple::avr);
544}
545
546void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
547 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
548}
549
550bool isParamExpr(size_t N) const override {
551 return false;
552}
553
554static const ParsedAttrInfoAVRSignal Instance;
555};
556const ParsedAttrInfoAVRSignal ParsedAttrInfoAVRSignal::Instance;
557static constexpr ParsedAttrInfo::Spelling AbiTagSpellings[] = {
558 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "abi_tag"},
559 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::abi_tag"},
560};
561static constexpr const char *AbiTagArgNames[] = {
562"Tags...",};
563struct ParsedAttrInfoAbiTag final : public ParsedAttrInfo {
564 constexpr ParsedAttrInfoAbiTag() : ParsedAttrInfo(
565 /*AttrKind=*/ParsedAttr::AT_AbiTag,
566 /*NumArgs=*/0,
567 /*OptArgs=*/15,
568 /*NumArgMembers=*/1,
569 /*HasCustomParsing=*/0,
570 /*AcceptsExprPack=*/0,
571 /*IsTargetSpecific=*/0,
572 /*IsType=*/0,
573 /*IsStmt=*/0,
574 /*IsKnownToGCC=*/1,
575 /*IsSupportedByPragmaAttribute=*/1,
576 /*Spellings=*/AbiTagSpellings,
577 /*ArgNames=*/AbiTagArgNames) {}
578bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
579 if (!isStruct(D) && !isa<VarDecl>(Val: D) && !isa<FunctionDecl>(Val: D) && !isa<NamespaceDecl>(Val: D)) {
580 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
581 << Attr << Attr.isRegularKeywordAttribute() << "structs, variables, functions, and namespaces";
582 return false;
583 }
584 return true;
585}
586
587bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
588 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
589 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
590 return false;
591}
592
593void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
594 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record_not_is_union, /*IsSupported=*/y: true));
595 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
596 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
597 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_namespace, /*IsSupported=*/y: LangOpts.CPlusPlus));
598}
599
600bool isParamExpr(size_t N) const override {
601 return false;
602}
603
604static const ParsedAttrInfoAbiTag Instance;
605};
606const ParsedAttrInfoAbiTag ParsedAttrInfoAbiTag::Instance;
607static constexpr ParsedAttrInfo::Spelling AcquireCapabilitySpellings[] = {
608 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "acquire_capability"},
609 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::acquire_capability"},
610 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "acquire_shared_capability"},
611 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::acquire_shared_capability"},
612 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "exclusive_lock_function"},
613 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "shared_lock_function"},
614};
615static constexpr const char *AcquireCapabilityArgNames[] = {
616"Args...",};
617struct ParsedAttrInfoAcquireCapability final : public ParsedAttrInfo {
618 constexpr ParsedAttrInfoAcquireCapability() : ParsedAttrInfo(
619 /*AttrKind=*/ParsedAttr::AT_AcquireCapability,
620 /*NumArgs=*/0,
621 /*OptArgs=*/15,
622 /*NumArgMembers=*/1,
623 /*HasCustomParsing=*/0,
624 /*AcceptsExprPack=*/0,
625 /*IsTargetSpecific=*/0,
626 /*IsType=*/0,
627 /*IsStmt=*/0,
628 /*IsKnownToGCC=*/0,
629 /*IsSupportedByPragmaAttribute=*/0,
630 /*Spellings=*/AcquireCapabilitySpellings,
631 /*ArgNames=*/AcquireCapabilityArgNames) {}
632bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
633 if (!isa<FunctionDecl>(Val: D)) {
634 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
635 << Attr << Attr.isRegularKeywordAttribute() << "functions";
636 return false;
637 }
638 return true;
639}
640
641bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
642 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
643 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
644 return false;
645}
646
647unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
648 enum Spelling {
649 GNU_acquire_capability = 0,
650 CXX11_clang_acquire_capability = 1,
651 GNU_acquire_shared_capability = 2,
652 CXX11_clang_acquire_shared_capability = 3,
653 GNU_exclusive_lock_function = 4,
654 GNU_shared_lock_function = 5,
655 SpellingNotCalculated = 15
656
657 };
658
659 unsigned Idx = Attr.getAttributeSpellingListIndex();
660 switch (Idx) {
661 default: llvm_unreachable("Unknown spelling list index");
662 case 0: return GNU_acquire_capability;
663 case 1: return CXX11_clang_acquire_capability;
664 case 2: return GNU_acquire_shared_capability;
665 case 3: return CXX11_clang_acquire_shared_capability;
666 case 4: return GNU_exclusive_lock_function;
667 case 5: return GNU_shared_lock_function;
668 }
669}
670
671bool isParamExpr(size_t N) const override {
672 return (N == 0) || false;
673}
674
675static const ParsedAttrInfoAcquireCapability Instance;
676};
677const ParsedAttrInfoAcquireCapability ParsedAttrInfoAcquireCapability::Instance;
678static constexpr ParsedAttrInfo::Spelling AcquireHandleSpellings[] = {
679 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "acquire_handle"},
680 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::acquire_handle"},
681 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::acquire_handle"},
682};
683static constexpr const char *AcquireHandleArgNames[] = {
684"HandleType",};
685struct ParsedAttrInfoAcquireHandle final : public ParsedAttrInfo {
686 constexpr ParsedAttrInfoAcquireHandle() : ParsedAttrInfo(
687 /*AttrKind=*/ParsedAttr::AT_AcquireHandle,
688 /*NumArgs=*/1,
689 /*OptArgs=*/0,
690 /*NumArgMembers=*/1,
691 /*HasCustomParsing=*/0,
692 /*AcceptsExprPack=*/0,
693 /*IsTargetSpecific=*/0,
694 /*IsType=*/1,
695 /*IsStmt=*/0,
696 /*IsKnownToGCC=*/0,
697 /*IsSupportedByPragmaAttribute=*/1,
698 /*Spellings=*/AcquireHandleSpellings,
699 /*ArgNames=*/AcquireHandleArgNames) {}
700bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
701 if (!isa<FunctionDecl>(Val: D) && !isa<TypedefNameDecl>(Val: D) && !isa<ParmVarDecl>(Val: D)) {
702 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
703 << Attr << Attr.isRegularKeywordAttribute() << "functions, typedefs, and parameters";
704 return false;
705 }
706 return true;
707}
708
709bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
710 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
711 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
712 return false;
713}
714
715void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
716 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
717 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
718 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
719}
720
721bool isParamExpr(size_t N) const override {
722 return false;
723}
724
725static const ParsedAttrInfoAcquireHandle Instance;
726};
727const ParsedAttrInfoAcquireHandle ParsedAttrInfoAcquireHandle::Instance;
728static constexpr ParsedAttrInfo::Spelling AcquiredAfterSpellings[] = {
729 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "acquired_after"},
730};
731static constexpr const char *AcquiredAfterArgNames[] = {
732"Args...",};
733struct ParsedAttrInfoAcquiredAfter final : public ParsedAttrInfo {
734 constexpr ParsedAttrInfoAcquiredAfter() : ParsedAttrInfo(
735 /*AttrKind=*/ParsedAttr::AT_AcquiredAfter,
736 /*NumArgs=*/0,
737 /*OptArgs=*/15,
738 /*NumArgMembers=*/1,
739 /*HasCustomParsing=*/0,
740 /*AcceptsExprPack=*/0,
741 /*IsTargetSpecific=*/0,
742 /*IsType=*/0,
743 /*IsStmt=*/0,
744 /*IsKnownToGCC=*/0,
745 /*IsSupportedByPragmaAttribute=*/0,
746 /*Spellings=*/AcquiredAfterSpellings,
747 /*ArgNames=*/AcquiredAfterArgNames) {}
748bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
749 if (!isa<FieldDecl>(Val: D) && !isSharedVar(D)) {
750 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
751 << Attr << Attr.isRegularKeywordAttribute() << "non-static data members and global variables";
752 return false;
753 }
754 return true;
755}
756
757bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
758 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
759 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
760 return false;
761}
762
763bool isParamExpr(size_t N) const override {
764 return (N == 0) || false;
765}
766
767static const ParsedAttrInfoAcquiredAfter Instance;
768};
769const ParsedAttrInfoAcquiredAfter ParsedAttrInfoAcquiredAfter::Instance;
770static constexpr ParsedAttrInfo::Spelling AcquiredBeforeSpellings[] = {
771 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "acquired_before"},
772};
773static constexpr const char *AcquiredBeforeArgNames[] = {
774"Args...",};
775struct ParsedAttrInfoAcquiredBefore final : public ParsedAttrInfo {
776 constexpr ParsedAttrInfoAcquiredBefore() : ParsedAttrInfo(
777 /*AttrKind=*/ParsedAttr::AT_AcquiredBefore,
778 /*NumArgs=*/0,
779 /*OptArgs=*/15,
780 /*NumArgMembers=*/1,
781 /*HasCustomParsing=*/0,
782 /*AcceptsExprPack=*/0,
783 /*IsTargetSpecific=*/0,
784 /*IsType=*/0,
785 /*IsStmt=*/0,
786 /*IsKnownToGCC=*/0,
787 /*IsSupportedByPragmaAttribute=*/0,
788 /*Spellings=*/AcquiredBeforeSpellings,
789 /*ArgNames=*/AcquiredBeforeArgNames) {}
790bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
791 if (!isa<FieldDecl>(Val: D) && !isSharedVar(D)) {
792 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
793 << Attr << Attr.isRegularKeywordAttribute() << "non-static data members and global variables";
794 return false;
795 }
796 return true;
797}
798
799bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
800 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
801 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
802 return false;
803}
804
805bool isParamExpr(size_t N) const override {
806 return (N == 0) || false;
807}
808
809static const ParsedAttrInfoAcquiredBefore Instance;
810};
811const ParsedAttrInfoAcquiredBefore ParsedAttrInfoAcquiredBefore::Instance;
812static constexpr ParsedAttrInfo::Spelling AddressSpaceSpellings[] = {
813 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "address_space"},
814 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::address_space"},
815 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::address_space"},
816};
817static constexpr const char *AddressSpaceArgNames[] = {
818"AddressSpace",};
819struct ParsedAttrInfoAddressSpace final : public ParsedAttrInfo {
820 constexpr ParsedAttrInfoAddressSpace() : ParsedAttrInfo(
821 /*AttrKind=*/ParsedAttr::AT_AddressSpace,
822 /*NumArgs=*/1,
823 /*OptArgs=*/0,
824 /*NumArgMembers=*/1,
825 /*HasCustomParsing=*/0,
826 /*AcceptsExprPack=*/0,
827 /*IsTargetSpecific=*/0,
828 /*IsType=*/1,
829 /*IsStmt=*/0,
830 /*IsKnownToGCC=*/0,
831 /*IsSupportedByPragmaAttribute=*/0,
832 /*Spellings=*/AddressSpaceSpellings,
833 /*ArgNames=*/AddressSpaceArgNames) {}
834bool isParamExpr(size_t N) const override {
835 return false;
836}
837
838static const ParsedAttrInfoAddressSpace Instance;
839};
840const ParsedAttrInfoAddressSpace ParsedAttrInfoAddressSpace::Instance;
841static constexpr ParsedAttrInfo::Spelling AliasSpellings[] = {
842 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "alias"},
843 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::alias"},
844 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::alias"},
845};
846static constexpr const char *AliasArgNames[] = {
847"Aliasee",};
848struct ParsedAttrInfoAlias final : public ParsedAttrInfo {
849 constexpr ParsedAttrInfoAlias() : ParsedAttrInfo(
850 /*AttrKind=*/ParsedAttr::AT_Alias,
851 /*NumArgs=*/1,
852 /*OptArgs=*/0,
853 /*NumArgMembers=*/1,
854 /*HasCustomParsing=*/0,
855 /*AcceptsExprPack=*/0,
856 /*IsTargetSpecific=*/0,
857 /*IsType=*/0,
858 /*IsStmt=*/0,
859 /*IsKnownToGCC=*/1,
860 /*IsSupportedByPragmaAttribute=*/1,
861 /*Spellings=*/AliasSpellings,
862 /*ArgNames=*/AliasArgNames) {}
863bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
864 if (!isa<FunctionDecl>(Val: D) && !isGlobalVar(D)) {
865 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
866 << Attr << Attr.isRegularKeywordAttribute() << "functions and global variables";
867 return false;
868 }
869 return true;
870}
871
872bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
873 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
874 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
875 return false;
876}
877
878void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
879 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
880 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/y: true));
881}
882
883bool isParamExpr(size_t N) const override {
884 return false;
885}
886
887static const ParsedAttrInfoAlias Instance;
888};
889const ParsedAttrInfoAlias ParsedAttrInfoAlias::Instance;
890static constexpr ParsedAttrInfo::Spelling AlignValueSpellings[] = {
891 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "align_value"},
892};
893static constexpr const char *AlignValueArgNames[] = {
894"Alignment",};
895struct ParsedAttrInfoAlignValue final : public ParsedAttrInfo {
896 constexpr ParsedAttrInfoAlignValue() : ParsedAttrInfo(
897 /*AttrKind=*/ParsedAttr::AT_AlignValue,
898 /*NumArgs=*/1,
899 /*OptArgs=*/0,
900 /*NumArgMembers=*/1,
901 /*HasCustomParsing=*/0,
902 /*AcceptsExprPack=*/0,
903 /*IsTargetSpecific=*/0,
904 /*IsType=*/0,
905 /*IsStmt=*/0,
906 /*IsKnownToGCC=*/0,
907 /*IsSupportedByPragmaAttribute=*/1,
908 /*Spellings=*/AlignValueSpellings,
909 /*ArgNames=*/AlignValueArgNames) {}
910bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
911 if (!isa<VarDecl>(Val: D) && !isa<TypedefNameDecl>(Val: D)) {
912 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
913 << Attr << Attr.isRegularKeywordAttribute() << "variables and typedefs";
914 return false;
915 }
916 return true;
917}
918
919bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
920 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
921 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
922 return false;
923}
924
925void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
926 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
927 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
928}
929
930bool isParamExpr(size_t N) const override {
931 return (N == 0) || false;
932}
933
934static const ParsedAttrInfoAlignValue Instance;
935};
936const ParsedAttrInfoAlignValue ParsedAttrInfoAlignValue::Instance;
937static constexpr ParsedAttrInfo::Spelling AlignedSpellings[] = {
938 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "aligned"},
939 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::aligned"},
940 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::aligned"},
941 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "align"},
942 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "alignas"},
943 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_Alignas"},
944};
945static constexpr const char *AlignedArgNames[] = {
946"Alignment",};
947struct ParsedAttrInfoAligned final : public ParsedAttrInfo {
948 constexpr ParsedAttrInfoAligned() : ParsedAttrInfo(
949 /*AttrKind=*/ParsedAttr::AT_Aligned,
950 /*NumArgs=*/0,
951 /*OptArgs=*/1,
952 /*NumArgMembers=*/1,
953 /*HasCustomParsing=*/0,
954 /*AcceptsExprPack=*/0,
955 /*IsTargetSpecific=*/0,
956 /*IsType=*/0,
957 /*IsStmt=*/0,
958 /*IsKnownToGCC=*/1,
959 /*IsSupportedByPragmaAttribute=*/0,
960 /*Spellings=*/AlignedSpellings,
961 /*ArgNames=*/AlignedArgNames) {}
962unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
963 enum Spelling {
964 GNU_aligned = 0,
965 CXX11_gnu_aligned = 1,
966 C23_gnu_aligned = 2,
967 Declspec_align = 3,
968 Keyword_alignas = 4,
969 Keyword_Alignas = 5,
970 SpellingNotCalculated = 15
971
972 };
973
974 unsigned Idx = Attr.getAttributeSpellingListIndex();
975 switch (Idx) {
976 default: llvm_unreachable("Unknown spelling list index");
977 case 0: return GNU_aligned;
978 case 1: return CXX11_gnu_aligned;
979 case 2: return C23_gnu_aligned;
980 case 3: return Declspec_align;
981 case 4: return Keyword_alignas;
982 case 5: return Keyword_Alignas;
983 }
984}
985
986bool isParamExpr(size_t N) const override {
987 return false;
988}
989
990static const ParsedAttrInfoAligned Instance;
991};
992const ParsedAttrInfoAligned ParsedAttrInfoAligned::Instance;
993static constexpr ParsedAttrInfo::Spelling AllocAlignSpellings[] = {
994 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "alloc_align"},
995 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::alloc_align"},
996 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::alloc_align"},
997};
998static constexpr const char *AllocAlignArgNames[] = {
999"ParamIndex",};
1000struct ParsedAttrInfoAllocAlign final : public ParsedAttrInfo {
1001 constexpr ParsedAttrInfoAllocAlign() : ParsedAttrInfo(
1002 /*AttrKind=*/ParsedAttr::AT_AllocAlign,
1003 /*NumArgs=*/1,
1004 /*OptArgs=*/0,
1005 /*NumArgMembers=*/1,
1006 /*HasCustomParsing=*/0,
1007 /*AcceptsExprPack=*/0,
1008 /*IsTargetSpecific=*/0,
1009 /*IsType=*/0,
1010 /*IsStmt=*/0,
1011 /*IsKnownToGCC=*/1,
1012 /*IsSupportedByPragmaAttribute=*/0,
1013 /*Spellings=*/AllocAlignSpellings,
1014 /*ArgNames=*/AllocAlignArgNames) {}
1015bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1016 if (!isHasFunctionProto(D)) {
1017 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
1018 << Attr << Attr.isRegularKeywordAttribute() << "non-K&R-style functions";
1019 return false;
1020 }
1021 return true;
1022}
1023
1024bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1025 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1026 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1027 return false;
1028}
1029
1030bool isParamExpr(size_t N) const override {
1031 return false;
1032}
1033
1034static const ParsedAttrInfoAllocAlign Instance;
1035};
1036const ParsedAttrInfoAllocAlign ParsedAttrInfoAllocAlign::Instance;
1037static constexpr ParsedAttrInfo::Spelling AllocSizeSpellings[] = {
1038 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "alloc_size"},
1039 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::alloc_size"},
1040 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::alloc_size"},
1041};
1042static constexpr const char *AllocSizeArgNames[] = {
1043"ElemSizeParam","NumElemsParam",};
1044struct ParsedAttrInfoAllocSize final : public ParsedAttrInfo {
1045 constexpr ParsedAttrInfoAllocSize() : ParsedAttrInfo(
1046 /*AttrKind=*/ParsedAttr::AT_AllocSize,
1047 /*NumArgs=*/1,
1048 /*OptArgs=*/1,
1049 /*NumArgMembers=*/2,
1050 /*HasCustomParsing=*/0,
1051 /*AcceptsExprPack=*/0,
1052 /*IsTargetSpecific=*/0,
1053 /*IsType=*/0,
1054 /*IsStmt=*/0,
1055 /*IsKnownToGCC=*/1,
1056 /*IsSupportedByPragmaAttribute=*/0,
1057 /*Spellings=*/AllocSizeSpellings,
1058 /*ArgNames=*/AllocSizeArgNames) {}
1059bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1060 if (!isHasFunctionProto(D)) {
1061 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
1062 << Attr << Attr.isRegularKeywordAttribute() << "non-K&R-style functions";
1063 return false;
1064 }
1065 return true;
1066}
1067
1068bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1069 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1070 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1071 return false;
1072}
1073
1074bool isParamExpr(size_t N) const override {
1075 return false;
1076}
1077
1078static const ParsedAttrInfoAllocSize Instance;
1079};
1080const ParsedAttrInfoAllocSize ParsedAttrInfoAllocSize::Instance;
1081static constexpr ParsedAttrInfo::Spelling AllocatingSpellings[] = {
1082 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "allocating"},
1083 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::allocating"},
1084 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::allocating"},
1085};
1086struct ParsedAttrInfoAllocating final : public ParsedAttrInfo {
1087 constexpr ParsedAttrInfoAllocating() : ParsedAttrInfo(
1088 /*AttrKind=*/ParsedAttr::AT_Allocating,
1089 /*NumArgs=*/0,
1090 /*OptArgs=*/0,
1091 /*NumArgMembers=*/0,
1092 /*HasCustomParsing=*/0,
1093 /*AcceptsExprPack=*/0,
1094 /*IsTargetSpecific=*/0,
1095 /*IsType=*/1,
1096 /*IsStmt=*/0,
1097 /*IsKnownToGCC=*/0,
1098 /*IsSupportedByPragmaAttribute=*/0,
1099 /*Spellings=*/AllocatingSpellings,
1100 /*ArgNames=*/{}) {}
1101bool isParamExpr(size_t N) const override {
1102 return false;
1103}
1104
1105static const ParsedAttrInfoAllocating Instance;
1106};
1107const ParsedAttrInfoAllocating ParsedAttrInfoAllocating::Instance;
1108static constexpr ParsedAttrInfo::Spelling AlwaysDestroySpellings[] = {
1109 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "always_destroy"},
1110 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::always_destroy"},
1111};
1112struct ParsedAttrInfoAlwaysDestroy final : public ParsedAttrInfo {
1113 constexpr ParsedAttrInfoAlwaysDestroy() : ParsedAttrInfo(
1114 /*AttrKind=*/ParsedAttr::AT_AlwaysDestroy,
1115 /*NumArgs=*/0,
1116 /*OptArgs=*/0,
1117 /*NumArgMembers=*/0,
1118 /*HasCustomParsing=*/0,
1119 /*AcceptsExprPack=*/0,
1120 /*IsTargetSpecific=*/0,
1121 /*IsType=*/0,
1122 /*IsStmt=*/0,
1123 /*IsKnownToGCC=*/0,
1124 /*IsSupportedByPragmaAttribute=*/1,
1125 /*Spellings=*/AlwaysDestroySpellings,
1126 /*ArgNames=*/{}) {}
1127bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1128 if (!isa<VarDecl>(Val: D)) {
1129 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
1130 << Attr << Attr.isRegularKeywordAttribute() << "variables";
1131 return false;
1132 }
1133 return true;
1134}
1135
1136bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1137 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1138 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1139 return false;
1140}
1141
1142 using ParsedAttrInfo::diagMutualExclusion;
1143
1144 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
1145 if (const auto *A = D->getAttr<NoDestroyAttr>()) {
1146 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
1147 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
1148return false;
1149 }
1150 return true;
1151 }
1152
1153void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
1154 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
1155}
1156
1157bool isParamExpr(size_t N) const override {
1158 return false;
1159}
1160
1161static const ParsedAttrInfoAlwaysDestroy Instance;
1162};
1163const ParsedAttrInfoAlwaysDestroy ParsedAttrInfoAlwaysDestroy::Instance;
1164static constexpr ParsedAttrInfo::Spelling AlwaysInlineSpellings[] = {
1165 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "always_inline"},
1166 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::always_inline"},
1167 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::always_inline"},
1168 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::always_inline"},
1169 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::always_inline"},
1170 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__forceinline"},
1171};
1172struct ParsedAttrInfoAlwaysInline final : public ParsedAttrInfo {
1173 constexpr ParsedAttrInfoAlwaysInline() : ParsedAttrInfo(
1174 /*AttrKind=*/ParsedAttr::AT_AlwaysInline,
1175 /*NumArgs=*/0,
1176 /*OptArgs=*/0,
1177 /*NumArgMembers=*/0,
1178 /*HasCustomParsing=*/0,
1179 /*AcceptsExprPack=*/0,
1180 /*IsTargetSpecific=*/0,
1181 /*IsType=*/0,
1182 /*IsStmt=*/1,
1183 /*IsKnownToGCC=*/1,
1184 /*IsSupportedByPragmaAttribute=*/1,
1185 /*Spellings=*/AlwaysInlineSpellings,
1186 /*ArgNames=*/{}) {}
1187bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1188 if (!isa<FunctionDecl>(Val: D)) {
1189 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
1190 << Attr << Attr.isRegularKeywordAttribute() << "functions and statements";
1191 return false;
1192 }
1193 return true;
1194}
1195
1196bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
1197 if (!isa<Stmt>(Val: St)) {
1198 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
1199 << Attr << Attr.isRegularKeywordAttribute() << "functions and statements";
1200 return false;
1201 }
1202 return true;
1203}
1204
1205 using ParsedAttrInfo::diagMutualExclusion;
1206
1207 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
1208 if (const auto *A = D->getAttr<NotTailCalledAttr>()) {
1209 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
1210 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
1211return false;
1212 }
1213 return true;
1214 }
1215
1216unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
1217 enum Spelling {
1218 GNU_always_inline = 0,
1219 CXX11_gnu_always_inline = 1,
1220 C23_gnu_always_inline = 2,
1221 CXX11_clang_always_inline = 3,
1222 C23_clang_always_inline = 4,
1223 Keyword_forceinline = 5,
1224 SpellingNotCalculated = 15
1225
1226 };
1227
1228 unsigned Idx = Attr.getAttributeSpellingListIndex();
1229 switch (Idx) {
1230 default: llvm_unreachable("Unknown spelling list index");
1231 case 0: return GNU_always_inline;
1232 case 1: return CXX11_gnu_always_inline;
1233 case 2: return C23_gnu_always_inline;
1234 case 3: return CXX11_clang_always_inline;
1235 case 4: return C23_clang_always_inline;
1236 case 5: return Keyword_forceinline;
1237 }
1238}
1239
1240void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
1241 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
1242}
1243
1244bool isParamExpr(size_t N) const override {
1245 return false;
1246}
1247
1248static const ParsedAttrInfoAlwaysInline Instance;
1249};
1250const ParsedAttrInfoAlwaysInline ParsedAttrInfoAlwaysInline::Instance;
1251static constexpr ParsedAttrInfo::Spelling AnalyzerNoReturnSpellings[] = {
1252 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "analyzer_noreturn"},
1253};
1254struct ParsedAttrInfoAnalyzerNoReturn final : public ParsedAttrInfo {
1255 constexpr ParsedAttrInfoAnalyzerNoReturn() : ParsedAttrInfo(
1256 /*AttrKind=*/ParsedAttr::AT_AnalyzerNoReturn,
1257 /*NumArgs=*/0,
1258 /*OptArgs=*/0,
1259 /*NumArgMembers=*/0,
1260 /*HasCustomParsing=*/0,
1261 /*AcceptsExprPack=*/0,
1262 /*IsTargetSpecific=*/0,
1263 /*IsType=*/0,
1264 /*IsStmt=*/0,
1265 /*IsKnownToGCC=*/0,
1266 /*IsSupportedByPragmaAttribute=*/0,
1267 /*Spellings=*/AnalyzerNoReturnSpellings,
1268 /*ArgNames=*/{}) {}
1269bool isParamExpr(size_t N) const override {
1270 return false;
1271}
1272
1273static const ParsedAttrInfoAnalyzerNoReturn Instance;
1274};
1275const ParsedAttrInfoAnalyzerNoReturn ParsedAttrInfoAnalyzerNoReturn::Instance;
1276static constexpr ParsedAttrInfo::Spelling AnnotateSpellings[] = {
1277 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "annotate"},
1278 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::annotate"},
1279 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::annotate"},
1280};
1281static constexpr const char *AnnotateArgNames[] = {
1282"Annotation","Args...",};
1283struct ParsedAttrInfoAnnotate final : public ParsedAttrInfo {
1284 constexpr ParsedAttrInfoAnnotate() : ParsedAttrInfo(
1285 /*AttrKind=*/ParsedAttr::AT_Annotate,
1286 /*NumArgs=*/1,
1287 /*OptArgs=*/15,
1288 /*NumArgMembers=*/2,
1289 /*HasCustomParsing=*/0,
1290 /*AcceptsExprPack=*/1,
1291 /*IsTargetSpecific=*/0,
1292 /*IsType=*/0,
1293 /*IsStmt=*/0,
1294 /*IsKnownToGCC=*/0,
1295 /*IsSupportedByPragmaAttribute=*/1,
1296 /*Spellings=*/AnnotateSpellings,
1297 /*ArgNames=*/AnnotateArgNames) {}
1298bool isParamExpr(size_t N) const override {
1299 return (N == 1) || false;
1300}
1301
1302static const ParsedAttrInfoAnnotate Instance;
1303};
1304const ParsedAttrInfoAnnotate ParsedAttrInfoAnnotate::Instance;
1305static constexpr ParsedAttrInfo::Spelling AnnotateTypeSpellings[] = {
1306 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::annotate_type"},
1307 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::annotate_type"},
1308};
1309static constexpr const char *AnnotateTypeArgNames[] = {
1310"Annotation","Args...",};
1311struct ParsedAttrInfoAnnotateType final : public ParsedAttrInfo {
1312 constexpr ParsedAttrInfoAnnotateType() : ParsedAttrInfo(
1313 /*AttrKind=*/ParsedAttr::AT_AnnotateType,
1314 /*NumArgs=*/1,
1315 /*OptArgs=*/15,
1316 /*NumArgMembers=*/2,
1317 /*HasCustomParsing=*/1,
1318 /*AcceptsExprPack=*/1,
1319 /*IsTargetSpecific=*/0,
1320 /*IsType=*/1,
1321 /*IsStmt=*/0,
1322 /*IsKnownToGCC=*/0,
1323 /*IsSupportedByPragmaAttribute=*/0,
1324 /*Spellings=*/AnnotateTypeSpellings,
1325 /*ArgNames=*/AnnotateTypeArgNames) {}
1326bool isParamExpr(size_t N) const override {
1327 return (N == 1) || false;
1328}
1329
1330static const ParsedAttrInfoAnnotateType Instance;
1331};
1332const ParsedAttrInfoAnnotateType ParsedAttrInfoAnnotateType::Instance;
1333static constexpr ParsedAttrInfo::Spelling AnyX86NoCallerSavedRegistersSpellings[] = {
1334 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_caller_saved_registers"},
1335 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::no_caller_saved_registers"},
1336 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::no_caller_saved_registers"},
1337};
1338struct ParsedAttrInfoAnyX86NoCallerSavedRegisters final : public ParsedAttrInfo {
1339 constexpr ParsedAttrInfoAnyX86NoCallerSavedRegisters() : ParsedAttrInfo(
1340 /*AttrKind=*/ParsedAttr::AT_AnyX86NoCallerSavedRegisters,
1341 /*NumArgs=*/0,
1342 /*OptArgs=*/0,
1343 /*NumArgMembers=*/0,
1344 /*HasCustomParsing=*/0,
1345 /*AcceptsExprPack=*/0,
1346 /*IsTargetSpecific=*/1,
1347 /*IsType=*/0,
1348 /*IsStmt=*/0,
1349 /*IsKnownToGCC=*/1,
1350 /*IsSupportedByPragmaAttribute=*/0,
1351 /*Spellings=*/AnyX86NoCallerSavedRegistersSpellings,
1352 /*ArgNames=*/{}) {}
1353bool existsInTarget(const TargetInfo &Target) const override {
1354 const llvm::Triple &T = Target.getTriple(); (void)T;
1355 return true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64);
1356}
1357
1358AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
1359 D->addAttr(A: ::new (S.Context) AnyX86NoCallerSavedRegistersAttr(S.Context, Attr));
1360 return AttributeApplied;
1361}
1362
1363bool isParamExpr(size_t N) const override {
1364 return false;
1365}
1366
1367static const ParsedAttrInfoAnyX86NoCallerSavedRegisters Instance;
1368};
1369const ParsedAttrInfoAnyX86NoCallerSavedRegisters ParsedAttrInfoAnyX86NoCallerSavedRegisters::Instance;
1370static constexpr ParsedAttrInfo::Spelling AnyX86NoCfCheckSpellings[] = {
1371 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nocf_check"},
1372 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::nocf_check"},
1373 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::nocf_check"},
1374};
1375struct ParsedAttrInfoAnyX86NoCfCheck final : public ParsedAttrInfo {
1376 constexpr ParsedAttrInfoAnyX86NoCfCheck() : ParsedAttrInfo(
1377 /*AttrKind=*/ParsedAttr::AT_AnyX86NoCfCheck,
1378 /*NumArgs=*/0,
1379 /*OptArgs=*/0,
1380 /*NumArgMembers=*/0,
1381 /*HasCustomParsing=*/0,
1382 /*AcceptsExprPack=*/0,
1383 /*IsTargetSpecific=*/1,
1384 /*IsType=*/1,
1385 /*IsStmt=*/0,
1386 /*IsKnownToGCC=*/1,
1387 /*IsSupportedByPragmaAttribute=*/1,
1388 /*Spellings=*/AnyX86NoCfCheckSpellings,
1389 /*ArgNames=*/{}) {}
1390bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1391 if (!isFunctionLike(D)) {
1392 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
1393 << Attr << Attr.isRegularKeywordAttribute() << "functions and function pointers";
1394 return false;
1395 }
1396 return true;
1397}
1398
1399bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1400 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1401 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1402 return false;
1403}
1404
1405bool existsInTarget(const TargetInfo &Target) const override {
1406 const llvm::Triple &T = Target.getTriple(); (void)T;
1407 return true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64);
1408}
1409
1410void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
1411 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/y: true));
1412}
1413
1414bool isParamExpr(size_t N) const override {
1415 return false;
1416}
1417
1418static const ParsedAttrInfoAnyX86NoCfCheck Instance;
1419};
1420const ParsedAttrInfoAnyX86NoCfCheck ParsedAttrInfoAnyX86NoCfCheck::Instance;
1421static constexpr ParsedAttrInfo::Spelling ArcWeakrefUnavailableSpellings[] = {
1422 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_arc_weak_reference_unavailable"},
1423 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_arc_weak_reference_unavailable"},
1424 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_arc_weak_reference_unavailable"},
1425};
1426struct ParsedAttrInfoArcWeakrefUnavailable final : public ParsedAttrInfo {
1427 constexpr ParsedAttrInfoArcWeakrefUnavailable() : ParsedAttrInfo(
1428 /*AttrKind=*/ParsedAttr::AT_ArcWeakrefUnavailable,
1429 /*NumArgs=*/0,
1430 /*OptArgs=*/0,
1431 /*NumArgMembers=*/0,
1432 /*HasCustomParsing=*/0,
1433 /*AcceptsExprPack=*/0,
1434 /*IsTargetSpecific=*/0,
1435 /*IsType=*/0,
1436 /*IsStmt=*/0,
1437 /*IsKnownToGCC=*/0,
1438 /*IsSupportedByPragmaAttribute=*/1,
1439 /*Spellings=*/ArcWeakrefUnavailableSpellings,
1440 /*ArgNames=*/{}) {}
1441bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1442 if (!isa<ObjCInterfaceDecl>(Val: D)) {
1443 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1444 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C interfaces";
1445 return false;
1446 }
1447 return true;
1448}
1449
1450bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1451 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1452 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1453 return false;
1454}
1455
1456void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
1457 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
1458}
1459
1460AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
1461 D->addAttr(A: ::new (S.Context) ArcWeakrefUnavailableAttr(S.Context, Attr));
1462 return AttributeApplied;
1463}
1464
1465bool isParamExpr(size_t N) const override {
1466 return false;
1467}
1468
1469static const ParsedAttrInfoArcWeakrefUnavailable Instance;
1470};
1471const ParsedAttrInfoArcWeakrefUnavailable ParsedAttrInfoArcWeakrefUnavailable::Instance;
1472static constexpr ParsedAttrInfo::Spelling ArgumentWithTypeTagSpellings[] = {
1473 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "argument_with_type_tag"},
1474 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::argument_with_type_tag"},
1475 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::argument_with_type_tag"},
1476 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "pointer_with_type_tag"},
1477 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::pointer_with_type_tag"},
1478 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::pointer_with_type_tag"},
1479};
1480static constexpr const char *ArgumentWithTypeTagArgNames[] = {
1481"ArgumentKind","ArgumentIdx","TypeTagIdx",};
1482struct ParsedAttrInfoArgumentWithTypeTag final : public ParsedAttrInfo {
1483 constexpr ParsedAttrInfoArgumentWithTypeTag() : ParsedAttrInfo(
1484 /*AttrKind=*/ParsedAttr::AT_ArgumentWithTypeTag,
1485 /*NumArgs=*/3,
1486 /*OptArgs=*/0,
1487 /*NumArgMembers=*/3,
1488 /*HasCustomParsing=*/0,
1489 /*AcceptsExprPack=*/0,
1490 /*IsTargetSpecific=*/0,
1491 /*IsType=*/0,
1492 /*IsStmt=*/0,
1493 /*IsKnownToGCC=*/0,
1494 /*IsSupportedByPragmaAttribute=*/0,
1495 /*Spellings=*/ArgumentWithTypeTagSpellings,
1496 /*ArgNames=*/ArgumentWithTypeTagArgNames) {}
1497bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1498 if (!isHasFunctionProto(D)) {
1499 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1500 << Attr << Attr.isRegularKeywordAttribute() << "non-K&R-style functions";
1501 return false;
1502 }
1503 return true;
1504}
1505
1506bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1507 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1508 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1509 return false;
1510}
1511
1512unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
1513 enum Spelling {
1514 GNU_argument_with_type_tag = 0,
1515 CXX11_clang_argument_with_type_tag = 1,
1516 C23_clang_argument_with_type_tag = 2,
1517 GNU_pointer_with_type_tag = 3,
1518 CXX11_clang_pointer_with_type_tag = 4,
1519 C23_clang_pointer_with_type_tag = 5,
1520 SpellingNotCalculated = 15
1521
1522 };
1523
1524 unsigned Idx = Attr.getAttributeSpellingListIndex();
1525 switch (Idx) {
1526 default: llvm_unreachable("Unknown spelling list index");
1527 case 0: return GNU_argument_with_type_tag;
1528 case 1: return CXX11_clang_argument_with_type_tag;
1529 case 2: return C23_clang_argument_with_type_tag;
1530 case 3: return GNU_pointer_with_type_tag;
1531 case 4: return CXX11_clang_pointer_with_type_tag;
1532 case 5: return C23_clang_pointer_with_type_tag;
1533 }
1534}
1535
1536bool isParamExpr(size_t N) const override {
1537 return false;
1538}
1539
1540static const ParsedAttrInfoArgumentWithTypeTag Instance;
1541};
1542const ParsedAttrInfoArgumentWithTypeTag ParsedAttrInfoArgumentWithTypeTag::Instance;
1543static constexpr ParsedAttrInfo::Spelling ArmBuiltinAliasSpellings[] = {
1544 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "__clang_arm_builtin_alias"},
1545 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::__clang_arm_builtin_alias"},
1546 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::__clang_arm_builtin_alias"},
1547};
1548static constexpr const char *ArmBuiltinAliasArgNames[] = {
1549"BuiltinName",};
1550struct ParsedAttrInfoArmBuiltinAlias final : public ParsedAttrInfo {
1551 constexpr ParsedAttrInfoArmBuiltinAlias() : ParsedAttrInfo(
1552 /*AttrKind=*/ParsedAttr::AT_ArmBuiltinAlias,
1553 /*NumArgs=*/1,
1554 /*OptArgs=*/0,
1555 /*NumArgMembers=*/1,
1556 /*HasCustomParsing=*/0,
1557 /*AcceptsExprPack=*/0,
1558 /*IsTargetSpecific=*/1,
1559 /*IsType=*/0,
1560 /*IsStmt=*/0,
1561 /*IsKnownToGCC=*/0,
1562 /*IsSupportedByPragmaAttribute=*/1,
1563 /*Spellings=*/ArmBuiltinAliasSpellings,
1564 /*ArgNames=*/ArmBuiltinAliasArgNames) {}
1565bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1566 if (!isa<FunctionDecl>(Val: D)) {
1567 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1568 << Attr << Attr.isRegularKeywordAttribute() << "functions";
1569 return false;
1570 }
1571 return true;
1572}
1573
1574bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1575 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1576 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1577 return false;
1578}
1579
1580bool existsInTarget(const TargetInfo &Target) const override {
1581 const llvm::Triple &T = Target.getTriple(); (void)T;
1582 return true && (T.getArch() == llvm::Triple::arm || T.getArch() == llvm::Triple::thumb || T.getArch() == llvm::Triple::armeb || T.getArch() == llvm::Triple::thumbeb || T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::aarch64_32);
1583}
1584
1585void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
1586 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
1587}
1588
1589bool isParamExpr(size_t N) const override {
1590 return false;
1591}
1592
1593static const ParsedAttrInfoArmBuiltinAlias Instance;
1594};
1595const ParsedAttrInfoArmBuiltinAlias ParsedAttrInfoArmBuiltinAlias::Instance;
1596static constexpr ParsedAttrInfo::Spelling ArmInSpellings[] = {
1597 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__arm_in"},
1598};
1599static constexpr const char *ArmInArgNames[] = {
1600"InArgs...",};
1601struct ParsedAttrInfoArmIn final : public ParsedAttrInfo {
1602 constexpr ParsedAttrInfoArmIn() : ParsedAttrInfo(
1603 /*AttrKind=*/ParsedAttr::AT_ArmIn,
1604 /*NumArgs=*/0,
1605 /*OptArgs=*/15,
1606 /*NumArgMembers=*/1,
1607 /*HasCustomParsing=*/0,
1608 /*AcceptsExprPack=*/0,
1609 /*IsTargetSpecific=*/1,
1610 /*IsType=*/1,
1611 /*IsStmt=*/0,
1612 /*IsKnownToGCC=*/0,
1613 /*IsSupportedByPragmaAttribute=*/0,
1614 /*Spellings=*/ArmInSpellings,
1615 /*ArgNames=*/ArmInArgNames) {}
1616bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1617 if (!isHasFunctionProto(D)) {
1618 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1619 << Attr << Attr.isRegularKeywordAttribute() << "non-K&R-style functions";
1620 return false;
1621 }
1622 return true;
1623}
1624
1625bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1626 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1627 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1628 return false;
1629}
1630
1631bool existsInTarget(const TargetInfo &Target) const override {
1632 const llvm::Triple &T = Target.getTriple(); (void)T;
1633 return true && (T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::aarch64_32);
1634}
1635
1636bool isParamExpr(size_t N) const override {
1637 return false;
1638}
1639
1640static const ParsedAttrInfoArmIn Instance;
1641};
1642const ParsedAttrInfoArmIn ParsedAttrInfoArmIn::Instance;
1643static constexpr ParsedAttrInfo::Spelling ArmInOutSpellings[] = {
1644 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__arm_inout"},
1645};
1646static constexpr const char *ArmInOutArgNames[] = {
1647"InOutArgs...",};
1648struct ParsedAttrInfoArmInOut final : public ParsedAttrInfo {
1649 constexpr ParsedAttrInfoArmInOut() : ParsedAttrInfo(
1650 /*AttrKind=*/ParsedAttr::AT_ArmInOut,
1651 /*NumArgs=*/0,
1652 /*OptArgs=*/15,
1653 /*NumArgMembers=*/1,
1654 /*HasCustomParsing=*/0,
1655 /*AcceptsExprPack=*/0,
1656 /*IsTargetSpecific=*/1,
1657 /*IsType=*/1,
1658 /*IsStmt=*/0,
1659 /*IsKnownToGCC=*/0,
1660 /*IsSupportedByPragmaAttribute=*/0,
1661 /*Spellings=*/ArmInOutSpellings,
1662 /*ArgNames=*/ArmInOutArgNames) {}
1663bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1664 if (!isHasFunctionProto(D)) {
1665 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1666 << Attr << Attr.isRegularKeywordAttribute() << "non-K&R-style functions";
1667 return false;
1668 }
1669 return true;
1670}
1671
1672bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1673 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1674 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1675 return false;
1676}
1677
1678bool existsInTarget(const TargetInfo &Target) const override {
1679 const llvm::Triple &T = Target.getTriple(); (void)T;
1680 return true && (T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::aarch64_32);
1681}
1682
1683bool isParamExpr(size_t N) const override {
1684 return false;
1685}
1686
1687static const ParsedAttrInfoArmInOut Instance;
1688};
1689const ParsedAttrInfoArmInOut ParsedAttrInfoArmInOut::Instance;
1690static constexpr ParsedAttrInfo::Spelling ArmLocallyStreamingSpellings[] = {
1691 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__arm_locally_streaming"},
1692};
1693struct ParsedAttrInfoArmLocallyStreaming final : public ParsedAttrInfo {
1694 constexpr ParsedAttrInfoArmLocallyStreaming() : ParsedAttrInfo(
1695 /*AttrKind=*/ParsedAttr::AT_ArmLocallyStreaming,
1696 /*NumArgs=*/0,
1697 /*OptArgs=*/0,
1698 /*NumArgMembers=*/0,
1699 /*HasCustomParsing=*/0,
1700 /*AcceptsExprPack=*/0,
1701 /*IsTargetSpecific=*/1,
1702 /*IsType=*/0,
1703 /*IsStmt=*/0,
1704 /*IsKnownToGCC=*/0,
1705 /*IsSupportedByPragmaAttribute=*/0,
1706 /*Spellings=*/ArmLocallyStreamingSpellings,
1707 /*ArgNames=*/{}) {}
1708bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1709 if (!isa<FunctionDecl>(Val: D)) {
1710 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1711 << Attr << Attr.isRegularKeywordAttribute() << "functions";
1712 return false;
1713 }
1714 return true;
1715}
1716
1717bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1718 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1719 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1720 return false;
1721}
1722
1723bool existsInTarget(const TargetInfo &Target) const override {
1724 const llvm::Triple &T = Target.getTriple(); (void)T;
1725 return true && (T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::aarch64_32);
1726}
1727
1728bool isParamExpr(size_t N) const override {
1729 return false;
1730}
1731
1732static const ParsedAttrInfoArmLocallyStreaming Instance;
1733};
1734const ParsedAttrInfoArmLocallyStreaming ParsedAttrInfoArmLocallyStreaming::Instance;
1735static constexpr ParsedAttrInfo::Spelling ArmMveStrictPolymorphismSpellings[] = {
1736 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "__clang_arm_mve_strict_polymorphism"},
1737 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::__clang_arm_mve_strict_polymorphism"},
1738 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::__clang_arm_mve_strict_polymorphism"},
1739};
1740struct ParsedAttrInfoArmMveStrictPolymorphism final : public ParsedAttrInfo {
1741 constexpr ParsedAttrInfoArmMveStrictPolymorphism() : ParsedAttrInfo(
1742 /*AttrKind=*/ParsedAttr::AT_ArmMveStrictPolymorphism,
1743 /*NumArgs=*/0,
1744 /*OptArgs=*/0,
1745 /*NumArgMembers=*/0,
1746 /*HasCustomParsing=*/0,
1747 /*AcceptsExprPack=*/0,
1748 /*IsTargetSpecific=*/1,
1749 /*IsType=*/1,
1750 /*IsStmt=*/0,
1751 /*IsKnownToGCC=*/0,
1752 /*IsSupportedByPragmaAttribute=*/0,
1753 /*Spellings=*/ArmMveStrictPolymorphismSpellings,
1754 /*ArgNames=*/{}) {}
1755bool existsInTarget(const TargetInfo &Target) const override {
1756 const llvm::Triple &T = Target.getTriple(); (void)T;
1757 return true && (T.getArch() == llvm::Triple::arm || T.getArch() == llvm::Triple::thumb || T.getArch() == llvm::Triple::armeb || T.getArch() == llvm::Triple::thumbeb);
1758}
1759
1760bool isParamExpr(size_t N) const override {
1761 return false;
1762}
1763
1764static const ParsedAttrInfoArmMveStrictPolymorphism Instance;
1765};
1766const ParsedAttrInfoArmMveStrictPolymorphism ParsedAttrInfoArmMveStrictPolymorphism::Instance;
1767static constexpr ParsedAttrInfo::Spelling ArmNewSpellings[] = {
1768 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__arm_new"},
1769};
1770static constexpr const char *ArmNewArgNames[] = {
1771"NewArgs...",};
1772struct ParsedAttrInfoArmNew final : public ParsedAttrInfo {
1773 constexpr ParsedAttrInfoArmNew() : ParsedAttrInfo(
1774 /*AttrKind=*/ParsedAttr::AT_ArmNew,
1775 /*NumArgs=*/0,
1776 /*OptArgs=*/15,
1777 /*NumArgMembers=*/1,
1778 /*HasCustomParsing=*/0,
1779 /*AcceptsExprPack=*/0,
1780 /*IsTargetSpecific=*/1,
1781 /*IsType=*/0,
1782 /*IsStmt=*/0,
1783 /*IsKnownToGCC=*/0,
1784 /*IsSupportedByPragmaAttribute=*/0,
1785 /*Spellings=*/ArmNewSpellings,
1786 /*ArgNames=*/ArmNewArgNames) {}
1787bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1788 if (!isa<FunctionDecl>(Val: D)) {
1789 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1790 << Attr << Attr.isRegularKeywordAttribute() << "functions";
1791 return false;
1792 }
1793 return true;
1794}
1795
1796bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1797 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1798 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1799 return false;
1800}
1801
1802bool existsInTarget(const TargetInfo &Target) const override {
1803 const llvm::Triple &T = Target.getTriple(); (void)T;
1804 return true && (T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::aarch64_32);
1805}
1806
1807bool isParamExpr(size_t N) const override {
1808 return false;
1809}
1810
1811static const ParsedAttrInfoArmNew Instance;
1812};
1813const ParsedAttrInfoArmNew ParsedAttrInfoArmNew::Instance;
1814static constexpr ParsedAttrInfo::Spelling ArmOutSpellings[] = {
1815 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__arm_out"},
1816};
1817static constexpr const char *ArmOutArgNames[] = {
1818"OutArgs...",};
1819struct ParsedAttrInfoArmOut final : public ParsedAttrInfo {
1820 constexpr ParsedAttrInfoArmOut() : ParsedAttrInfo(
1821 /*AttrKind=*/ParsedAttr::AT_ArmOut,
1822 /*NumArgs=*/0,
1823 /*OptArgs=*/15,
1824 /*NumArgMembers=*/1,
1825 /*HasCustomParsing=*/0,
1826 /*AcceptsExprPack=*/0,
1827 /*IsTargetSpecific=*/1,
1828 /*IsType=*/1,
1829 /*IsStmt=*/0,
1830 /*IsKnownToGCC=*/0,
1831 /*IsSupportedByPragmaAttribute=*/0,
1832 /*Spellings=*/ArmOutSpellings,
1833 /*ArgNames=*/ArmOutArgNames) {}
1834bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1835 if (!isHasFunctionProto(D)) {
1836 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1837 << Attr << Attr.isRegularKeywordAttribute() << "non-K&R-style functions";
1838 return false;
1839 }
1840 return true;
1841}
1842
1843bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1844 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1845 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1846 return false;
1847}
1848
1849bool existsInTarget(const TargetInfo &Target) const override {
1850 const llvm::Triple &T = Target.getTriple(); (void)T;
1851 return true && (T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::aarch64_32);
1852}
1853
1854bool isParamExpr(size_t N) const override {
1855 return false;
1856}
1857
1858static const ParsedAttrInfoArmOut Instance;
1859};
1860const ParsedAttrInfoArmOut ParsedAttrInfoArmOut::Instance;
1861static constexpr ParsedAttrInfo::Spelling ArmPreservesSpellings[] = {
1862 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__arm_preserves"},
1863};
1864static constexpr const char *ArmPreservesArgNames[] = {
1865"PreserveArgs...",};
1866struct ParsedAttrInfoArmPreserves final : public ParsedAttrInfo {
1867 constexpr ParsedAttrInfoArmPreserves() : ParsedAttrInfo(
1868 /*AttrKind=*/ParsedAttr::AT_ArmPreserves,
1869 /*NumArgs=*/0,
1870 /*OptArgs=*/15,
1871 /*NumArgMembers=*/1,
1872 /*HasCustomParsing=*/0,
1873 /*AcceptsExprPack=*/0,
1874 /*IsTargetSpecific=*/1,
1875 /*IsType=*/1,
1876 /*IsStmt=*/0,
1877 /*IsKnownToGCC=*/0,
1878 /*IsSupportedByPragmaAttribute=*/0,
1879 /*Spellings=*/ArmPreservesSpellings,
1880 /*ArgNames=*/ArmPreservesArgNames) {}
1881bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1882 if (!isHasFunctionProto(D)) {
1883 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1884 << Attr << Attr.isRegularKeywordAttribute() << "non-K&R-style functions";
1885 return false;
1886 }
1887 return true;
1888}
1889
1890bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1891 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1892 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1893 return false;
1894}
1895
1896bool existsInTarget(const TargetInfo &Target) const override {
1897 const llvm::Triple &T = Target.getTriple(); (void)T;
1898 return true && (T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::aarch64_32);
1899}
1900
1901bool isParamExpr(size_t N) const override {
1902 return false;
1903}
1904
1905static const ParsedAttrInfoArmPreserves Instance;
1906};
1907const ParsedAttrInfoArmPreserves ParsedAttrInfoArmPreserves::Instance;
1908static constexpr ParsedAttrInfo::Spelling ArmStreamingSpellings[] = {
1909 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__arm_streaming"},
1910};
1911struct ParsedAttrInfoArmStreaming final : public ParsedAttrInfo {
1912 constexpr ParsedAttrInfoArmStreaming() : ParsedAttrInfo(
1913 /*AttrKind=*/ParsedAttr::AT_ArmStreaming,
1914 /*NumArgs=*/0,
1915 /*OptArgs=*/0,
1916 /*NumArgMembers=*/0,
1917 /*HasCustomParsing=*/0,
1918 /*AcceptsExprPack=*/0,
1919 /*IsTargetSpecific=*/1,
1920 /*IsType=*/1,
1921 /*IsStmt=*/0,
1922 /*IsKnownToGCC=*/0,
1923 /*IsSupportedByPragmaAttribute=*/0,
1924 /*Spellings=*/ArmStreamingSpellings,
1925 /*ArgNames=*/{}) {}
1926bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1927 if (!isHasFunctionProto(D)) {
1928 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1929 << Attr << Attr.isRegularKeywordAttribute() << "non-K&R-style functions";
1930 return false;
1931 }
1932 return true;
1933}
1934
1935bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1936 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1937 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1938 return false;
1939}
1940
1941bool existsInTarget(const TargetInfo &Target) const override {
1942 const llvm::Triple &T = Target.getTriple(); (void)T;
1943 return true && (T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::aarch64_32);
1944}
1945
1946bool isParamExpr(size_t N) const override {
1947 return false;
1948}
1949
1950static const ParsedAttrInfoArmStreaming Instance;
1951};
1952const ParsedAttrInfoArmStreaming ParsedAttrInfoArmStreaming::Instance;
1953static constexpr ParsedAttrInfo::Spelling ArmStreamingCompatibleSpellings[] = {
1954 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__arm_streaming_compatible"},
1955};
1956struct ParsedAttrInfoArmStreamingCompatible final : public ParsedAttrInfo {
1957 constexpr ParsedAttrInfoArmStreamingCompatible() : ParsedAttrInfo(
1958 /*AttrKind=*/ParsedAttr::AT_ArmStreamingCompatible,
1959 /*NumArgs=*/0,
1960 /*OptArgs=*/0,
1961 /*NumArgMembers=*/0,
1962 /*HasCustomParsing=*/0,
1963 /*AcceptsExprPack=*/0,
1964 /*IsTargetSpecific=*/1,
1965 /*IsType=*/1,
1966 /*IsStmt=*/0,
1967 /*IsKnownToGCC=*/0,
1968 /*IsSupportedByPragmaAttribute=*/0,
1969 /*Spellings=*/ArmStreamingCompatibleSpellings,
1970 /*ArgNames=*/{}) {}
1971bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
1972 if (!isHasFunctionProto(D)) {
1973 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
1974 << Attr << Attr.isRegularKeywordAttribute() << "non-K&R-style functions";
1975 return false;
1976 }
1977 return true;
1978}
1979
1980bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
1981 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
1982 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
1983 return false;
1984}
1985
1986bool existsInTarget(const TargetInfo &Target) const override {
1987 const llvm::Triple &T = Target.getTriple(); (void)T;
1988 return true && (T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::aarch64_32);
1989}
1990
1991bool isParamExpr(size_t N) const override {
1992 return false;
1993}
1994
1995static const ParsedAttrInfoArmStreamingCompatible Instance;
1996};
1997const ParsedAttrInfoArmStreamingCompatible ParsedAttrInfoArmStreamingCompatible::Instance;
1998static constexpr ParsedAttrInfo::Spelling ArmSveVectorBitsSpellings[] = {
1999 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "arm_sve_vector_bits"},
2000};
2001static constexpr const char *ArmSveVectorBitsArgNames[] = {
2002"NumBits",};
2003struct ParsedAttrInfoArmSveVectorBits final : public ParsedAttrInfo {
2004 constexpr ParsedAttrInfoArmSveVectorBits() : ParsedAttrInfo(
2005 /*AttrKind=*/ParsedAttr::AT_ArmSveVectorBits,
2006 /*NumArgs=*/1,
2007 /*OptArgs=*/0,
2008 /*NumArgMembers=*/1,
2009 /*HasCustomParsing=*/0,
2010 /*AcceptsExprPack=*/0,
2011 /*IsTargetSpecific=*/0,
2012 /*IsType=*/1,
2013 /*IsStmt=*/0,
2014 /*IsKnownToGCC=*/0,
2015 /*IsSupportedByPragmaAttribute=*/0,
2016 /*Spellings=*/ArmSveVectorBitsSpellings,
2017 /*ArgNames=*/ArmSveVectorBitsArgNames) {}
2018bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2019 if (!isa<TypedefNameDecl>(Val: D)) {
2020 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
2021 << Attr << Attr.isRegularKeywordAttribute() << "typedefs";
2022 return false;
2023 }
2024 return true;
2025}
2026
2027bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2028 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2029 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2030 return false;
2031}
2032
2033bool isParamExpr(size_t N) const override {
2034 return false;
2035}
2036
2037static const ParsedAttrInfoArmSveVectorBits Instance;
2038};
2039const ParsedAttrInfoArmSveVectorBits ParsedAttrInfoArmSveVectorBits::Instance;
2040static constexpr ParsedAttrInfo::Spelling ArtificialSpellings[] = {
2041 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "artificial"},
2042 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::artificial"},
2043 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::artificial"},
2044};
2045struct ParsedAttrInfoArtificial final : public ParsedAttrInfo {
2046 constexpr ParsedAttrInfoArtificial() : ParsedAttrInfo(
2047 /*AttrKind=*/ParsedAttr::AT_Artificial,
2048 /*NumArgs=*/0,
2049 /*OptArgs=*/0,
2050 /*NumArgMembers=*/0,
2051 /*HasCustomParsing=*/0,
2052 /*AcceptsExprPack=*/0,
2053 /*IsTargetSpecific=*/0,
2054 /*IsType=*/0,
2055 /*IsStmt=*/0,
2056 /*IsKnownToGCC=*/1,
2057 /*IsSupportedByPragmaAttribute=*/0,
2058 /*Spellings=*/ArtificialSpellings,
2059 /*ArgNames=*/{}) {}
2060bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2061 if (!isInlineFunction(D)) {
2062 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
2063 << Attr << Attr.isRegularKeywordAttribute() << "inline functions";
2064 return false;
2065 }
2066 return true;
2067}
2068
2069bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2070 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2071 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2072 return false;
2073}
2074
2075AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
2076 D->addAttr(A: ::new (S.Context) ArtificialAttr(S.Context, Attr));
2077 return AttributeApplied;
2078}
2079
2080bool isParamExpr(size_t N) const override {
2081 return false;
2082}
2083
2084static const ParsedAttrInfoArtificial Instance;
2085};
2086const ParsedAttrInfoArtificial ParsedAttrInfoArtificial::Instance;
2087static constexpr ParsedAttrInfo::Spelling AssertCapabilitySpellings[] = {
2088 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "assert_capability"},
2089 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::assert_capability"},
2090 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "assert_shared_capability"},
2091 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::assert_shared_capability"},
2092};
2093static constexpr const char *AssertCapabilityArgNames[] = {
2094"Args...",};
2095struct ParsedAttrInfoAssertCapability final : public ParsedAttrInfo {
2096 constexpr ParsedAttrInfoAssertCapability() : ParsedAttrInfo(
2097 /*AttrKind=*/ParsedAttr::AT_AssertCapability,
2098 /*NumArgs=*/0,
2099 /*OptArgs=*/15,
2100 /*NumArgMembers=*/1,
2101 /*HasCustomParsing=*/0,
2102 /*AcceptsExprPack=*/0,
2103 /*IsTargetSpecific=*/0,
2104 /*IsType=*/0,
2105 /*IsStmt=*/0,
2106 /*IsKnownToGCC=*/0,
2107 /*IsSupportedByPragmaAttribute=*/0,
2108 /*Spellings=*/AssertCapabilitySpellings,
2109 /*ArgNames=*/AssertCapabilityArgNames) {}
2110bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2111 if (!isa<FunctionDecl>(Val: D)) {
2112 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
2113 << Attr << Attr.isRegularKeywordAttribute() << "functions";
2114 return false;
2115 }
2116 return true;
2117}
2118
2119bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2120 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2121 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2122 return false;
2123}
2124
2125unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
2126 enum Spelling {
2127 GNU_assert_capability = 0,
2128 CXX11_clang_assert_capability = 1,
2129 GNU_assert_shared_capability = 2,
2130 CXX11_clang_assert_shared_capability = 3,
2131 SpellingNotCalculated = 15
2132
2133 };
2134
2135 unsigned Idx = Attr.getAttributeSpellingListIndex();
2136 switch (Idx) {
2137 default: llvm_unreachable("Unknown spelling list index");
2138 case 0: return GNU_assert_capability;
2139 case 1: return CXX11_clang_assert_capability;
2140 case 2: return GNU_assert_shared_capability;
2141 case 3: return CXX11_clang_assert_shared_capability;
2142 }
2143}
2144
2145bool isParamExpr(size_t N) const override {
2146 return (N == 0) || false;
2147}
2148
2149static const ParsedAttrInfoAssertCapability Instance;
2150};
2151const ParsedAttrInfoAssertCapability ParsedAttrInfoAssertCapability::Instance;
2152static constexpr ParsedAttrInfo::Spelling AssertExclusiveLockSpellings[] = {
2153 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "assert_exclusive_lock"},
2154};
2155static constexpr const char *AssertExclusiveLockArgNames[] = {
2156"Args...",};
2157struct ParsedAttrInfoAssertExclusiveLock final : public ParsedAttrInfo {
2158 constexpr ParsedAttrInfoAssertExclusiveLock() : ParsedAttrInfo(
2159 /*AttrKind=*/ParsedAttr::AT_AssertExclusiveLock,
2160 /*NumArgs=*/0,
2161 /*OptArgs=*/15,
2162 /*NumArgMembers=*/1,
2163 /*HasCustomParsing=*/0,
2164 /*AcceptsExprPack=*/0,
2165 /*IsTargetSpecific=*/0,
2166 /*IsType=*/0,
2167 /*IsStmt=*/0,
2168 /*IsKnownToGCC=*/0,
2169 /*IsSupportedByPragmaAttribute=*/0,
2170 /*Spellings=*/AssertExclusiveLockSpellings,
2171 /*ArgNames=*/AssertExclusiveLockArgNames) {}
2172bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2173 if (!isa<FunctionDecl>(Val: D)) {
2174 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
2175 << Attr << Attr.isRegularKeywordAttribute() << "functions";
2176 return false;
2177 }
2178 return true;
2179}
2180
2181bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2182 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2183 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2184 return false;
2185}
2186
2187bool isParamExpr(size_t N) const override {
2188 return (N == 0) || false;
2189}
2190
2191static const ParsedAttrInfoAssertExclusiveLock Instance;
2192};
2193const ParsedAttrInfoAssertExclusiveLock ParsedAttrInfoAssertExclusiveLock::Instance;
2194static constexpr ParsedAttrInfo::Spelling AssertSharedLockSpellings[] = {
2195 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "assert_shared_lock"},
2196};
2197static constexpr const char *AssertSharedLockArgNames[] = {
2198"Args...",};
2199struct ParsedAttrInfoAssertSharedLock final : public ParsedAttrInfo {
2200 constexpr ParsedAttrInfoAssertSharedLock() : ParsedAttrInfo(
2201 /*AttrKind=*/ParsedAttr::AT_AssertSharedLock,
2202 /*NumArgs=*/0,
2203 /*OptArgs=*/15,
2204 /*NumArgMembers=*/1,
2205 /*HasCustomParsing=*/0,
2206 /*AcceptsExprPack=*/0,
2207 /*IsTargetSpecific=*/0,
2208 /*IsType=*/0,
2209 /*IsStmt=*/0,
2210 /*IsKnownToGCC=*/0,
2211 /*IsSupportedByPragmaAttribute=*/0,
2212 /*Spellings=*/AssertSharedLockSpellings,
2213 /*ArgNames=*/AssertSharedLockArgNames) {}
2214bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2215 if (!isa<FunctionDecl>(Val: D)) {
2216 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
2217 << Attr << Attr.isRegularKeywordAttribute() << "functions";
2218 return false;
2219 }
2220 return true;
2221}
2222
2223bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2224 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2225 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2226 return false;
2227}
2228
2229bool isParamExpr(size_t N) const override {
2230 return (N == 0) || false;
2231}
2232
2233static const ParsedAttrInfoAssertSharedLock Instance;
2234};
2235const ParsedAttrInfoAssertSharedLock ParsedAttrInfoAssertSharedLock::Instance;
2236static constexpr ParsedAttrInfo::Spelling AssumeAlignedSpellings[] = {
2237 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "assume_aligned"},
2238 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::assume_aligned"},
2239 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::assume_aligned"},
2240};
2241static constexpr const char *AssumeAlignedArgNames[] = {
2242"Alignment","Offset",};
2243struct ParsedAttrInfoAssumeAligned final : public ParsedAttrInfo {
2244 constexpr ParsedAttrInfoAssumeAligned() : ParsedAttrInfo(
2245 /*AttrKind=*/ParsedAttr::AT_AssumeAligned,
2246 /*NumArgs=*/1,
2247 /*OptArgs=*/1,
2248 /*NumArgMembers=*/2,
2249 /*HasCustomParsing=*/0,
2250 /*AcceptsExprPack=*/0,
2251 /*IsTargetSpecific=*/0,
2252 /*IsType=*/0,
2253 /*IsStmt=*/0,
2254 /*IsKnownToGCC=*/1,
2255 /*IsSupportedByPragmaAttribute=*/1,
2256 /*Spellings=*/AssumeAlignedSpellings,
2257 /*ArgNames=*/AssumeAlignedArgNames) {}
2258bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2259 if (!isa<ObjCMethodDecl>(Val: D) && !isa<FunctionDecl>(Val: D)) {
2260 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
2261 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods and functions";
2262 return false;
2263 }
2264 return true;
2265}
2266
2267bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2268 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2269 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2270 return false;
2271}
2272
2273void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2274 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
2275 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
2276}
2277
2278bool isParamExpr(size_t N) const override {
2279 return (N == 0) || (N == 1) || false;
2280}
2281
2282static const ParsedAttrInfoAssumeAligned Instance;
2283};
2284const ParsedAttrInfoAssumeAligned ParsedAttrInfoAssumeAligned::Instance;
2285static constexpr ParsedAttrInfo::Spelling AvailabilitySpellings[] = {
2286 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "availability"},
2287 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::availability"},
2288 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::availability"},
2289};
2290static constexpr const char *AvailabilityArgNames[] = {
2291"platform","introduced","deprecated","obsoleted","unavailable","message","strict","replacement","priority","environment",};
2292struct ParsedAttrInfoAvailability final : public ParsedAttrInfo {
2293 constexpr ParsedAttrInfoAvailability() : ParsedAttrInfo(
2294 /*AttrKind=*/ParsedAttr::AT_Availability,
2295 /*NumArgs=*/10,
2296 /*OptArgs=*/0,
2297 /*NumArgMembers=*/10,
2298 /*HasCustomParsing=*/1,
2299 /*AcceptsExprPack=*/0,
2300 /*IsTargetSpecific=*/0,
2301 /*IsType=*/0,
2302 /*IsStmt=*/0,
2303 /*IsKnownToGCC=*/0,
2304 /*IsSupportedByPragmaAttribute=*/1,
2305 /*Spellings=*/AvailabilitySpellings,
2306 /*ArgNames=*/AvailabilityArgNames) {}
2307bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2308 if (!isa<NamedDecl>(Val: D)) {
2309 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
2310 << Attr << Attr.isRegularKeywordAttribute() << "named declarations";
2311 return false;
2312 }
2313 return true;
2314}
2315
2316bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2317 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2318 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2319 return false;
2320}
2321
2322void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2323 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
2324 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_enum, /*IsSupported=*/y: true));
2325 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_enum_constant, /*IsSupported=*/y: true));
2326 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_field, /*IsSupported=*/y: true));
2327 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
2328 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_namespace, /*IsSupported=*/y: LangOpts.CPlusPlus));
2329 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_category, /*IsSupported=*/y: LangOpts.ObjC));
2330 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_implementation, /*IsSupported=*/y: LangOpts.ObjC));
2331 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
2332 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
2333 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_property, /*IsSupported=*/y: LangOpts.ObjC));
2334 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_protocol, /*IsSupported=*/y: LangOpts.ObjC));
2335 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
2336 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
2337 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
2338}
2339
2340bool isParamExpr(size_t N) const override {
2341 return false;
2342}
2343
2344static const ParsedAttrInfoAvailability Instance;
2345};
2346const ParsedAttrInfoAvailability ParsedAttrInfoAvailability::Instance;
2347static constexpr ParsedAttrInfo::Spelling AvailableOnlyInDefaultEvalMethodSpellings[] = {
2348 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "available_only_in_default_eval_method"},
2349 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::available_only_in_default_eval_method"},
2350 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::available_only_in_default_eval_method"},
2351};
2352struct ParsedAttrInfoAvailableOnlyInDefaultEvalMethod final : public ParsedAttrInfo {
2353 constexpr ParsedAttrInfoAvailableOnlyInDefaultEvalMethod() : ParsedAttrInfo(
2354 /*AttrKind=*/ParsedAttr::AT_AvailableOnlyInDefaultEvalMethod,
2355 /*NumArgs=*/0,
2356 /*OptArgs=*/0,
2357 /*NumArgMembers=*/0,
2358 /*HasCustomParsing=*/0,
2359 /*AcceptsExprPack=*/0,
2360 /*IsTargetSpecific=*/0,
2361 /*IsType=*/0,
2362 /*IsStmt=*/0,
2363 /*IsKnownToGCC=*/0,
2364 /*IsSupportedByPragmaAttribute=*/1,
2365 /*Spellings=*/AvailableOnlyInDefaultEvalMethodSpellings,
2366 /*ArgNames=*/{}) {}
2367bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2368 if (!isa<TypedefNameDecl>(Val: D)) {
2369 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
2370 << Attr << Attr.isRegularKeywordAttribute() << "typedefs";
2371 return false;
2372 }
2373 return true;
2374}
2375
2376bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2377 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2378 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2379 return false;
2380}
2381
2382void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2383 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
2384}
2385
2386bool isParamExpr(size_t N) const override {
2387 return false;
2388}
2389
2390static const ParsedAttrInfoAvailableOnlyInDefaultEvalMethod Instance;
2391};
2392const ParsedAttrInfoAvailableOnlyInDefaultEvalMethod ParsedAttrInfoAvailableOnlyInDefaultEvalMethod::Instance;
2393static constexpr ParsedAttrInfo::Spelling BPFPreserveAccessIndexSpellings[] = {
2394 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "preserve_access_index"},
2395 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::preserve_access_index"},
2396 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::preserve_access_index"},
2397};
2398struct ParsedAttrInfoBPFPreserveAccessIndex final : public ParsedAttrInfo {
2399 constexpr ParsedAttrInfoBPFPreserveAccessIndex() : ParsedAttrInfo(
2400 /*AttrKind=*/ParsedAttr::AT_BPFPreserveAccessIndex,
2401 /*NumArgs=*/0,
2402 /*OptArgs=*/0,
2403 /*NumArgMembers=*/0,
2404 /*HasCustomParsing=*/0,
2405 /*AcceptsExprPack=*/0,
2406 /*IsTargetSpecific=*/1,
2407 /*IsType=*/0,
2408 /*IsStmt=*/0,
2409 /*IsKnownToGCC=*/0,
2410 /*IsSupportedByPragmaAttribute=*/1,
2411 /*Spellings=*/BPFPreserveAccessIndexSpellings,
2412 /*ArgNames=*/{}) {}
2413bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2414 if (!isa<RecordDecl>(Val: D)) {
2415 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
2416 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
2417 return false;
2418 }
2419 return true;
2420}
2421
2422bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2423 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2424 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2425 return false;
2426}
2427
2428bool acceptsLangOpts(const LangOptions &LangOpts) const override {
2429 return (!LangOpts.CPlusPlus);
2430}
2431
2432bool existsInTarget(const TargetInfo &Target) const override {
2433 const llvm::Triple &T = Target.getTriple(); (void)T;
2434 return true && (T.getArch() == llvm::Triple::bpfel || T.getArch() == llvm::Triple::bpfeb);
2435}
2436
2437void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2438 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
2439}
2440
2441bool isParamExpr(size_t N) const override {
2442 return false;
2443}
2444
2445static const ParsedAttrInfoBPFPreserveAccessIndex Instance;
2446};
2447const ParsedAttrInfoBPFPreserveAccessIndex ParsedAttrInfoBPFPreserveAccessIndex::Instance;
2448static constexpr ParsedAttrInfo::Spelling BPFPreserveStaticOffsetSpellings[] = {
2449 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "preserve_static_offset"},
2450 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::preserve_static_offset"},
2451 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::preserve_static_offset"},
2452};
2453struct ParsedAttrInfoBPFPreserveStaticOffset final : public ParsedAttrInfo {
2454 constexpr ParsedAttrInfoBPFPreserveStaticOffset() : ParsedAttrInfo(
2455 /*AttrKind=*/ParsedAttr::AT_BPFPreserveStaticOffset,
2456 /*NumArgs=*/0,
2457 /*OptArgs=*/0,
2458 /*NumArgMembers=*/0,
2459 /*HasCustomParsing=*/0,
2460 /*AcceptsExprPack=*/0,
2461 /*IsTargetSpecific=*/1,
2462 /*IsType=*/0,
2463 /*IsStmt=*/0,
2464 /*IsKnownToGCC=*/0,
2465 /*IsSupportedByPragmaAttribute=*/1,
2466 /*Spellings=*/BPFPreserveStaticOffsetSpellings,
2467 /*ArgNames=*/{}) {}
2468bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2469 if (!isa<RecordDecl>(Val: D)) {
2470 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
2471 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
2472 return false;
2473 }
2474 return true;
2475}
2476
2477bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2478 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2479 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2480 return false;
2481}
2482
2483bool acceptsLangOpts(const LangOptions &LangOpts) const override {
2484 return (!LangOpts.CPlusPlus);
2485}
2486
2487bool existsInTarget(const TargetInfo &Target) const override {
2488 const llvm::Triple &T = Target.getTriple(); (void)T;
2489 return true && (T.getArch() == llvm::Triple::bpfel || T.getArch() == llvm::Triple::bpfeb);
2490}
2491
2492void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2493 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
2494}
2495
2496bool isParamExpr(size_t N) const override {
2497 return false;
2498}
2499
2500static const ParsedAttrInfoBPFPreserveStaticOffset Instance;
2501};
2502const ParsedAttrInfoBPFPreserveStaticOffset ParsedAttrInfoBPFPreserveStaticOffset::Instance;
2503static constexpr ParsedAttrInfo::Spelling BTFDeclTagSpellings[] = {
2504 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "btf_decl_tag"},
2505 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::btf_decl_tag"},
2506 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::btf_decl_tag"},
2507};
2508static constexpr const char *BTFDeclTagArgNames[] = {
2509"BTFDeclTag",};
2510struct ParsedAttrInfoBTFDeclTag final : public ParsedAttrInfo {
2511 constexpr ParsedAttrInfoBTFDeclTag() : ParsedAttrInfo(
2512 /*AttrKind=*/ParsedAttr::AT_BTFDeclTag,
2513 /*NumArgs=*/1,
2514 /*OptArgs=*/0,
2515 /*NumArgMembers=*/1,
2516 /*HasCustomParsing=*/0,
2517 /*AcceptsExprPack=*/0,
2518 /*IsTargetSpecific=*/0,
2519 /*IsType=*/0,
2520 /*IsStmt=*/0,
2521 /*IsKnownToGCC=*/0,
2522 /*IsSupportedByPragmaAttribute=*/1,
2523 /*Spellings=*/BTFDeclTagSpellings,
2524 /*ArgNames=*/BTFDeclTagArgNames) {}
2525bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2526 if (!isa<VarDecl>(Val: D) && !isa<FunctionDecl>(Val: D) && !isa<RecordDecl>(Val: D) && !isa<FieldDecl>(Val: D) && !isa<TypedefNameDecl>(Val: D)) {
2527 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
2528 << Attr << Attr.isRegularKeywordAttribute() << "variables, functions, structs, unions, classes, non-static data members, and typedefs";
2529 return false;
2530 }
2531 return true;
2532}
2533
2534bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2535 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2536 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2537 return false;
2538}
2539
2540bool acceptsLangOpts(const LangOptions &LangOpts) const override {
2541 return (!LangOpts.CPlusPlus);
2542}
2543
2544void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2545 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
2546 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
2547 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
2548 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_field, /*IsSupported=*/y: true));
2549 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
2550}
2551
2552bool isParamExpr(size_t N) const override {
2553 return false;
2554}
2555
2556static const ParsedAttrInfoBTFDeclTag Instance;
2557};
2558const ParsedAttrInfoBTFDeclTag ParsedAttrInfoBTFDeclTag::Instance;
2559static constexpr ParsedAttrInfo::Spelling BTFTypeTagSpellings[] = {
2560 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "btf_type_tag"},
2561 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::btf_type_tag"},
2562 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::btf_type_tag"},
2563};
2564static constexpr const char *BTFTypeTagArgNames[] = {
2565"BTFTypeTag",};
2566struct ParsedAttrInfoBTFTypeTag final : public ParsedAttrInfo {
2567 constexpr ParsedAttrInfoBTFTypeTag() : ParsedAttrInfo(
2568 /*AttrKind=*/ParsedAttr::AT_BTFTypeTag,
2569 /*NumArgs=*/1,
2570 /*OptArgs=*/0,
2571 /*NumArgMembers=*/1,
2572 /*HasCustomParsing=*/0,
2573 /*AcceptsExprPack=*/0,
2574 /*IsTargetSpecific=*/0,
2575 /*IsType=*/1,
2576 /*IsStmt=*/0,
2577 /*IsKnownToGCC=*/0,
2578 /*IsSupportedByPragmaAttribute=*/0,
2579 /*Spellings=*/BTFTypeTagSpellings,
2580 /*ArgNames=*/BTFTypeTagArgNames) {}
2581bool acceptsLangOpts(const LangOptions &LangOpts) const override {
2582 return (!LangOpts.CPlusPlus);
2583}
2584
2585bool isParamExpr(size_t N) const override {
2586 return false;
2587}
2588
2589static const ParsedAttrInfoBTFTypeTag Instance;
2590};
2591const ParsedAttrInfoBTFTypeTag ParsedAttrInfoBTFTypeTag::Instance;
2592static constexpr ParsedAttrInfo::Spelling BlockingSpellings[] = {
2593 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "blocking"},
2594 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::blocking"},
2595 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::blocking"},
2596};
2597struct ParsedAttrInfoBlocking final : public ParsedAttrInfo {
2598 constexpr ParsedAttrInfoBlocking() : ParsedAttrInfo(
2599 /*AttrKind=*/ParsedAttr::AT_Blocking,
2600 /*NumArgs=*/0,
2601 /*OptArgs=*/0,
2602 /*NumArgMembers=*/0,
2603 /*HasCustomParsing=*/0,
2604 /*AcceptsExprPack=*/0,
2605 /*IsTargetSpecific=*/0,
2606 /*IsType=*/1,
2607 /*IsStmt=*/0,
2608 /*IsKnownToGCC=*/0,
2609 /*IsSupportedByPragmaAttribute=*/0,
2610 /*Spellings=*/BlockingSpellings,
2611 /*ArgNames=*/{}) {}
2612bool isParamExpr(size_t N) const override {
2613 return false;
2614}
2615
2616static const ParsedAttrInfoBlocking Instance;
2617};
2618const ParsedAttrInfoBlocking ParsedAttrInfoBlocking::Instance;
2619static constexpr ParsedAttrInfo::Spelling BlocksSpellings[] = {
2620 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "blocks"},
2621 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::blocks"},
2622 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::blocks"},
2623};
2624static constexpr const char *BlocksArgNames[] = {
2625"Type",};
2626struct ParsedAttrInfoBlocks final : public ParsedAttrInfo {
2627 constexpr ParsedAttrInfoBlocks() : ParsedAttrInfo(
2628 /*AttrKind=*/ParsedAttr::AT_Blocks,
2629 /*NumArgs=*/1,
2630 /*OptArgs=*/0,
2631 /*NumArgMembers=*/1,
2632 /*HasCustomParsing=*/0,
2633 /*AcceptsExprPack=*/0,
2634 /*IsTargetSpecific=*/0,
2635 /*IsType=*/0,
2636 /*IsStmt=*/0,
2637 /*IsKnownToGCC=*/0,
2638 /*IsSupportedByPragmaAttribute=*/0,
2639 /*Spellings=*/BlocksSpellings,
2640 /*ArgNames=*/BlocksArgNames) {}
2641bool isParamExpr(size_t N) const override {
2642 return false;
2643}
2644
2645static const ParsedAttrInfoBlocks Instance;
2646};
2647const ParsedAttrInfoBlocks ParsedAttrInfoBlocks::Instance;
2648static constexpr ParsedAttrInfo::Spelling BuiltinAliasSpellings[] = {
2649 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::builtin_alias"},
2650 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::builtin_alias"},
2651 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "clang_builtin_alias"},
2652};
2653static constexpr const char *BuiltinAliasArgNames[] = {
2654"BuiltinName",};
2655struct ParsedAttrInfoBuiltinAlias final : public ParsedAttrInfo {
2656 constexpr ParsedAttrInfoBuiltinAlias() : ParsedAttrInfo(
2657 /*AttrKind=*/ParsedAttr::AT_BuiltinAlias,
2658 /*NumArgs=*/1,
2659 /*OptArgs=*/0,
2660 /*NumArgMembers=*/1,
2661 /*HasCustomParsing=*/0,
2662 /*AcceptsExprPack=*/0,
2663 /*IsTargetSpecific=*/0,
2664 /*IsType=*/0,
2665 /*IsStmt=*/0,
2666 /*IsKnownToGCC=*/0,
2667 /*IsSupportedByPragmaAttribute=*/1,
2668 /*Spellings=*/BuiltinAliasSpellings,
2669 /*ArgNames=*/BuiltinAliasArgNames) {}
2670bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2671 if (!isa<FunctionDecl>(Val: D)) {
2672 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
2673 << Attr << Attr.isRegularKeywordAttribute() << "functions";
2674 return false;
2675 }
2676 return true;
2677}
2678
2679bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2680 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2681 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2682 return false;
2683}
2684
2685unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
2686 enum Spelling {
2687 CXX11_clang_builtin_alias = 0,
2688 C23_clang_builtin_alias = 1,
2689 GNU_clang_builtin_alias = 2,
2690 SpellingNotCalculated = 15
2691
2692 };
2693
2694 unsigned Idx = Attr.getAttributeSpellingListIndex();
2695 switch (Idx) {
2696 default: llvm_unreachable("Unknown spelling list index");
2697 case 0: return CXX11_clang_builtin_alias;
2698 case 1: return C23_clang_builtin_alias;
2699 case 2: return GNU_clang_builtin_alias;
2700 }
2701}
2702
2703void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2704 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
2705}
2706
2707bool isParamExpr(size_t N) const override {
2708 return false;
2709}
2710
2711static const ParsedAttrInfoBuiltinAlias Instance;
2712};
2713const ParsedAttrInfoBuiltinAlias ParsedAttrInfoBuiltinAlias::Instance;
2714static constexpr ParsedAttrInfo::Spelling CDeclSpellings[] = {
2715 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cdecl"},
2716 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::cdecl"},
2717 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::cdecl"},
2718 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__cdecl"},
2719 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_cdecl"},
2720};
2721struct ParsedAttrInfoCDecl final : public ParsedAttrInfo {
2722 constexpr ParsedAttrInfoCDecl() : ParsedAttrInfo(
2723 /*AttrKind=*/ParsedAttr::AT_CDecl,
2724 /*NumArgs=*/0,
2725 /*OptArgs=*/0,
2726 /*NumArgMembers=*/0,
2727 /*HasCustomParsing=*/0,
2728 /*AcceptsExprPack=*/0,
2729 /*IsTargetSpecific=*/0,
2730 /*IsType=*/1,
2731 /*IsStmt=*/0,
2732 /*IsKnownToGCC=*/1,
2733 /*IsSupportedByPragmaAttribute=*/0,
2734 /*Spellings=*/CDeclSpellings,
2735 /*ArgNames=*/{}) {}
2736bool isParamExpr(size_t N) const override {
2737 return false;
2738}
2739
2740static const ParsedAttrInfoCDecl Instance;
2741};
2742const ParsedAttrInfoCDecl ParsedAttrInfoCDecl::Instance;
2743static constexpr ParsedAttrInfo::Spelling CFAuditedTransferSpellings[] = {
2744 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cf_audited_transfer"},
2745 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::cf_audited_transfer"},
2746 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::cf_audited_transfer"},
2747};
2748struct ParsedAttrInfoCFAuditedTransfer final : public ParsedAttrInfo {
2749 constexpr ParsedAttrInfoCFAuditedTransfer() : ParsedAttrInfo(
2750 /*AttrKind=*/ParsedAttr::AT_CFAuditedTransfer,
2751 /*NumArgs=*/0,
2752 /*OptArgs=*/0,
2753 /*NumArgMembers=*/0,
2754 /*HasCustomParsing=*/0,
2755 /*AcceptsExprPack=*/0,
2756 /*IsTargetSpecific=*/0,
2757 /*IsType=*/0,
2758 /*IsStmt=*/0,
2759 /*IsKnownToGCC=*/0,
2760 /*IsSupportedByPragmaAttribute=*/1,
2761 /*Spellings=*/CFAuditedTransferSpellings,
2762 /*ArgNames=*/{}) {}
2763bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2764 if (!isa<FunctionDecl>(Val: D)) {
2765 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
2766 << Attr << Attr.isRegularKeywordAttribute() << "functions";
2767 return false;
2768 }
2769 return true;
2770}
2771
2772bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2773 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2774 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2775 return false;
2776}
2777
2778 using ParsedAttrInfo::diagMutualExclusion;
2779
2780 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
2781 if (const auto *A = D->getAttr<CFUnknownTransferAttr>()) {
2782 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
2783 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
2784return false;
2785 }
2786 return true;
2787 }
2788
2789void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2790 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
2791}
2792
2793AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
2794 D->addAttr(A: ::new (S.Context) CFAuditedTransferAttr(S.Context, Attr));
2795 return AttributeApplied;
2796}
2797
2798bool isParamExpr(size_t N) const override {
2799 return false;
2800}
2801
2802static const ParsedAttrInfoCFAuditedTransfer Instance;
2803};
2804const ParsedAttrInfoCFAuditedTransfer ParsedAttrInfoCFAuditedTransfer::Instance;
2805static constexpr ParsedAttrInfo::Spelling CFConsumedSpellings[] = {
2806 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cf_consumed"},
2807 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::cf_consumed"},
2808 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::cf_consumed"},
2809};
2810struct ParsedAttrInfoCFConsumed final : public ParsedAttrInfo {
2811 constexpr ParsedAttrInfoCFConsumed() : ParsedAttrInfo(
2812 /*AttrKind=*/ParsedAttr::AT_CFConsumed,
2813 /*NumArgs=*/0,
2814 /*OptArgs=*/0,
2815 /*NumArgMembers=*/0,
2816 /*HasCustomParsing=*/0,
2817 /*AcceptsExprPack=*/0,
2818 /*IsTargetSpecific=*/0,
2819 /*IsType=*/0,
2820 /*IsStmt=*/0,
2821 /*IsKnownToGCC=*/0,
2822 /*IsSupportedByPragmaAttribute=*/1,
2823 /*Spellings=*/CFConsumedSpellings,
2824 /*ArgNames=*/{}) {}
2825bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2826 if (!isa<ParmVarDecl>(Val: D)) {
2827 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
2828 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
2829 return false;
2830 }
2831 return true;
2832}
2833
2834bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2835 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2836 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2837 return false;
2838}
2839
2840void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2841 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
2842}
2843
2844bool isParamExpr(size_t N) const override {
2845 return false;
2846}
2847
2848static const ParsedAttrInfoCFConsumed Instance;
2849};
2850const ParsedAttrInfoCFConsumed ParsedAttrInfoCFConsumed::Instance;
2851static constexpr ParsedAttrInfo::Spelling CFGuardSpellings[] = {
2852 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "guard"},
2853 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "guard"},
2854 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::guard"},
2855 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::guard"},
2856};
2857static constexpr const char *CFGuardArgNames[] = {
2858"Guard",};
2859struct ParsedAttrInfoCFGuard final : public ParsedAttrInfo {
2860 constexpr ParsedAttrInfoCFGuard() : ParsedAttrInfo(
2861 /*AttrKind=*/ParsedAttr::AT_CFGuard,
2862 /*NumArgs=*/1,
2863 /*OptArgs=*/0,
2864 /*NumArgMembers=*/1,
2865 /*HasCustomParsing=*/0,
2866 /*AcceptsExprPack=*/0,
2867 /*IsTargetSpecific=*/1,
2868 /*IsType=*/0,
2869 /*IsStmt=*/0,
2870 /*IsKnownToGCC=*/0,
2871 /*IsSupportedByPragmaAttribute=*/1,
2872 /*Spellings=*/CFGuardSpellings,
2873 /*ArgNames=*/CFGuardArgNames) {}
2874bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2875 if (!isa<FunctionDecl>(Val: D)) {
2876 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
2877 << Attr << Attr.isRegularKeywordAttribute() << "functions";
2878 return false;
2879 }
2880 return true;
2881}
2882
2883bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2884 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2885 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2886 return false;
2887}
2888
2889bool existsInTarget(const TargetInfo &Target) const override {
2890 const llvm::Triple &T = Target.getTriple(); (void)T;
2891 return true && (T.getOS() == llvm::Triple::Win32);
2892}
2893
2894void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2895 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
2896}
2897
2898bool isParamExpr(size_t N) const override {
2899 return false;
2900}
2901
2902static const ParsedAttrInfoCFGuard Instance;
2903};
2904const ParsedAttrInfoCFGuard ParsedAttrInfoCFGuard::Instance;
2905static constexpr ParsedAttrInfo::Spelling CFICanonicalJumpTableSpellings[] = {
2906 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cfi_canonical_jump_table"},
2907 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::cfi_canonical_jump_table"},
2908 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::cfi_canonical_jump_table"},
2909};
2910struct ParsedAttrInfoCFICanonicalJumpTable final : public ParsedAttrInfo {
2911 constexpr ParsedAttrInfoCFICanonicalJumpTable() : ParsedAttrInfo(
2912 /*AttrKind=*/ParsedAttr::AT_CFICanonicalJumpTable,
2913 /*NumArgs=*/0,
2914 /*OptArgs=*/0,
2915 /*NumArgMembers=*/0,
2916 /*HasCustomParsing=*/0,
2917 /*AcceptsExprPack=*/0,
2918 /*IsTargetSpecific=*/0,
2919 /*IsType=*/0,
2920 /*IsStmt=*/0,
2921 /*IsKnownToGCC=*/0,
2922 /*IsSupportedByPragmaAttribute=*/1,
2923 /*Spellings=*/CFICanonicalJumpTableSpellings,
2924 /*ArgNames=*/{}) {}
2925bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
2926 if (!isa<FunctionDecl>(Val: D)) {
2927 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
2928 << Attr << Attr.isRegularKeywordAttribute() << "functions";
2929 return false;
2930 }
2931 return true;
2932}
2933
2934bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
2935 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
2936 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
2937 return false;
2938}
2939
2940void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
2941 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
2942}
2943
2944AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
2945 D->addAttr(A: ::new (S.Context) CFICanonicalJumpTableAttr(S.Context, Attr));
2946 return AttributeApplied;
2947}
2948
2949bool isParamExpr(size_t N) const override {
2950 return false;
2951}
2952
2953static const ParsedAttrInfoCFICanonicalJumpTable Instance;
2954};
2955const ParsedAttrInfoCFICanonicalJumpTable ParsedAttrInfoCFICanonicalJumpTable::Instance;
2956static constexpr ParsedAttrInfo::Spelling CFReturnsNotRetainedSpellings[] = {
2957 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cf_returns_not_retained"},
2958 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::cf_returns_not_retained"},
2959 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::cf_returns_not_retained"},
2960};
2961struct ParsedAttrInfoCFReturnsNotRetained final : public ParsedAttrInfo {
2962 constexpr ParsedAttrInfoCFReturnsNotRetained() : ParsedAttrInfo(
2963 /*AttrKind=*/ParsedAttr::AT_CFReturnsNotRetained,
2964 /*NumArgs=*/0,
2965 /*OptArgs=*/0,
2966 /*NumArgMembers=*/0,
2967 /*HasCustomParsing=*/0,
2968 /*AcceptsExprPack=*/0,
2969 /*IsTargetSpecific=*/0,
2970 /*IsType=*/0,
2971 /*IsStmt=*/0,
2972 /*IsKnownToGCC=*/0,
2973 /*IsSupportedByPragmaAttribute=*/0,
2974 /*Spellings=*/CFReturnsNotRetainedSpellings,
2975 /*ArgNames=*/{}) {}
2976bool isParamExpr(size_t N) const override {
2977 return false;
2978}
2979
2980static const ParsedAttrInfoCFReturnsNotRetained Instance;
2981};
2982const ParsedAttrInfoCFReturnsNotRetained ParsedAttrInfoCFReturnsNotRetained::Instance;
2983static constexpr ParsedAttrInfo::Spelling CFReturnsRetainedSpellings[] = {
2984 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cf_returns_retained"},
2985 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::cf_returns_retained"},
2986 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::cf_returns_retained"},
2987};
2988struct ParsedAttrInfoCFReturnsRetained final : public ParsedAttrInfo {
2989 constexpr ParsedAttrInfoCFReturnsRetained() : ParsedAttrInfo(
2990 /*AttrKind=*/ParsedAttr::AT_CFReturnsRetained,
2991 /*NumArgs=*/0,
2992 /*OptArgs=*/0,
2993 /*NumArgMembers=*/0,
2994 /*HasCustomParsing=*/0,
2995 /*AcceptsExprPack=*/0,
2996 /*IsTargetSpecific=*/0,
2997 /*IsType=*/0,
2998 /*IsStmt=*/0,
2999 /*IsKnownToGCC=*/0,
3000 /*IsSupportedByPragmaAttribute=*/0,
3001 /*Spellings=*/CFReturnsRetainedSpellings,
3002 /*ArgNames=*/{}) {}
3003bool isParamExpr(size_t N) const override {
3004 return false;
3005}
3006
3007static const ParsedAttrInfoCFReturnsRetained Instance;
3008};
3009const ParsedAttrInfoCFReturnsRetained ParsedAttrInfoCFReturnsRetained::Instance;
3010static constexpr ParsedAttrInfo::Spelling CFUnknownTransferSpellings[] = {
3011 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cf_unknown_transfer"},
3012 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::cf_unknown_transfer"},
3013 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::cf_unknown_transfer"},
3014};
3015struct ParsedAttrInfoCFUnknownTransfer final : public ParsedAttrInfo {
3016 constexpr ParsedAttrInfoCFUnknownTransfer() : ParsedAttrInfo(
3017 /*AttrKind=*/ParsedAttr::AT_CFUnknownTransfer,
3018 /*NumArgs=*/0,
3019 /*OptArgs=*/0,
3020 /*NumArgMembers=*/0,
3021 /*HasCustomParsing=*/0,
3022 /*AcceptsExprPack=*/0,
3023 /*IsTargetSpecific=*/0,
3024 /*IsType=*/0,
3025 /*IsStmt=*/0,
3026 /*IsKnownToGCC=*/0,
3027 /*IsSupportedByPragmaAttribute=*/1,
3028 /*Spellings=*/CFUnknownTransferSpellings,
3029 /*ArgNames=*/{}) {}
3030bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3031 if (!isa<FunctionDecl>(Val: D)) {
3032 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
3033 << Attr << Attr.isRegularKeywordAttribute() << "functions";
3034 return false;
3035 }
3036 return true;
3037}
3038
3039bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3040 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3041 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3042 return false;
3043}
3044
3045 using ParsedAttrInfo::diagMutualExclusion;
3046
3047 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3048 if (const auto *A = D->getAttr<CFAuditedTransferAttr>()) {
3049 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3050 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3051return false;
3052 }
3053 return true;
3054 }
3055
3056void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3057 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
3058}
3059
3060AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
3061 D->addAttr(A: ::new (S.Context) CFUnknownTransferAttr(S.Context, Attr));
3062 return AttributeApplied;
3063}
3064
3065bool isParamExpr(size_t N) const override {
3066 return false;
3067}
3068
3069static const ParsedAttrInfoCFUnknownTransfer Instance;
3070};
3071const ParsedAttrInfoCFUnknownTransfer ParsedAttrInfoCFUnknownTransfer::Instance;
3072static constexpr ParsedAttrInfo::Spelling CPUDispatchSpellings[] = {
3073 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cpu_dispatch"},
3074 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::cpu_dispatch"},
3075 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::cpu_dispatch"},
3076 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "cpu_dispatch"},
3077};
3078static constexpr const char *CPUDispatchArgNames[] = {
3079"Cpus...",};
3080struct ParsedAttrInfoCPUDispatch final : public ParsedAttrInfo {
3081 constexpr ParsedAttrInfoCPUDispatch() : ParsedAttrInfo(
3082 /*AttrKind=*/ParsedAttr::AT_CPUDispatch,
3083 /*NumArgs=*/0,
3084 /*OptArgs=*/15,
3085 /*NumArgMembers=*/1,
3086 /*HasCustomParsing=*/0,
3087 /*AcceptsExprPack=*/0,
3088 /*IsTargetSpecific=*/0,
3089 /*IsType=*/0,
3090 /*IsStmt=*/0,
3091 /*IsKnownToGCC=*/0,
3092 /*IsSupportedByPragmaAttribute=*/1,
3093 /*Spellings=*/CPUDispatchSpellings,
3094 /*ArgNames=*/CPUDispatchArgNames) {}
3095bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3096 if (!isa<FunctionDecl>(Val: D)) {
3097 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3098 << Attr << Attr.isRegularKeywordAttribute() << "functions";
3099 return false;
3100 }
3101 return true;
3102}
3103
3104bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3105 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3106 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3107 return false;
3108}
3109
3110 using ParsedAttrInfo::diagMutualExclusion;
3111
3112 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3113 if (const auto *A = D->getAttr<TargetClonesAttr>()) {
3114 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3115 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3116return false;
3117 }
3118 if (const auto *A = D->getAttr<TargetVersionAttr>()) {
3119 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3120 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3121return false;
3122 }
3123 if (const auto *A = D->getAttr<TargetAttr>()) {
3124 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3125 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3126return false;
3127 }
3128 if (const auto *A = D->getAttr<CPUSpecificAttr>()) {
3129 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3130 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3131return false;
3132 }
3133 return true;
3134 }
3135
3136void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3137 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
3138}
3139
3140bool isParamExpr(size_t N) const override {
3141 return false;
3142}
3143
3144static const ParsedAttrInfoCPUDispatch Instance;
3145};
3146const ParsedAttrInfoCPUDispatch ParsedAttrInfoCPUDispatch::Instance;
3147static constexpr ParsedAttrInfo::Spelling CPUSpecificSpellings[] = {
3148 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cpu_specific"},
3149 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::cpu_specific"},
3150 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::cpu_specific"},
3151 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "cpu_specific"},
3152};
3153static constexpr const char *CPUSpecificArgNames[] = {
3154"Cpus...",};
3155struct ParsedAttrInfoCPUSpecific final : public ParsedAttrInfo {
3156 constexpr ParsedAttrInfoCPUSpecific() : ParsedAttrInfo(
3157 /*AttrKind=*/ParsedAttr::AT_CPUSpecific,
3158 /*NumArgs=*/0,
3159 /*OptArgs=*/15,
3160 /*NumArgMembers=*/1,
3161 /*HasCustomParsing=*/0,
3162 /*AcceptsExprPack=*/0,
3163 /*IsTargetSpecific=*/0,
3164 /*IsType=*/0,
3165 /*IsStmt=*/0,
3166 /*IsKnownToGCC=*/0,
3167 /*IsSupportedByPragmaAttribute=*/1,
3168 /*Spellings=*/CPUSpecificSpellings,
3169 /*ArgNames=*/CPUSpecificArgNames) {}
3170bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3171 if (!isa<FunctionDecl>(Val: D)) {
3172 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3173 << Attr << Attr.isRegularKeywordAttribute() << "functions";
3174 return false;
3175 }
3176 return true;
3177}
3178
3179bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3180 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3181 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3182 return false;
3183}
3184
3185 using ParsedAttrInfo::diagMutualExclusion;
3186
3187 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3188 if (const auto *A = D->getAttr<TargetClonesAttr>()) {
3189 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3190 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3191return false;
3192 }
3193 if (const auto *A = D->getAttr<TargetVersionAttr>()) {
3194 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3195 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3196return false;
3197 }
3198 if (const auto *A = D->getAttr<TargetAttr>()) {
3199 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3200 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3201return false;
3202 }
3203 if (const auto *A = D->getAttr<CPUDispatchAttr>()) {
3204 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3205 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3206return false;
3207 }
3208 return true;
3209 }
3210
3211void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3212 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
3213}
3214
3215bool isParamExpr(size_t N) const override {
3216 return false;
3217}
3218
3219static const ParsedAttrInfoCPUSpecific Instance;
3220};
3221const ParsedAttrInfoCPUSpecific ParsedAttrInfoCPUSpecific::Instance;
3222static constexpr ParsedAttrInfo::Spelling CUDAConstantSpellings[] = {
3223 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "constant"},
3224 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "__constant__"},
3225};
3226struct ParsedAttrInfoCUDAConstant final : public ParsedAttrInfo {
3227 constexpr ParsedAttrInfoCUDAConstant() : ParsedAttrInfo(
3228 /*AttrKind=*/ParsedAttr::AT_CUDAConstant,
3229 /*NumArgs=*/0,
3230 /*OptArgs=*/0,
3231 /*NumArgMembers=*/0,
3232 /*HasCustomParsing=*/0,
3233 /*AcceptsExprPack=*/0,
3234 /*IsTargetSpecific=*/0,
3235 /*IsType=*/0,
3236 /*IsStmt=*/0,
3237 /*IsKnownToGCC=*/0,
3238 /*IsSupportedByPragmaAttribute=*/1,
3239 /*Spellings=*/CUDAConstantSpellings,
3240 /*ArgNames=*/{}) {}
3241bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3242 if (!isa<VarDecl>(Val: D)) {
3243 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3244 << Attr << Attr.isRegularKeywordAttribute() << "variables";
3245 return false;
3246 }
3247 return true;
3248}
3249
3250bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3251 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3252 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3253 return false;
3254}
3255
3256 using ParsedAttrInfo::diagMutualExclusion;
3257
3258 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3259 if (const auto *A = D->getAttr<CUDASharedAttr>()) {
3260 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3261 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3262return false;
3263 }
3264 if (const auto *A = D->getAttr<HIPManagedAttr>()) {
3265 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3266 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3267return false;
3268 }
3269 return true;
3270 }
3271
3272bool acceptsLangOpts(const LangOptions &LangOpts) const override {
3273 return LangOpts.CUDA;
3274}
3275
3276void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3277 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
3278}
3279
3280bool isParamExpr(size_t N) const override {
3281 return false;
3282}
3283
3284static const ParsedAttrInfoCUDAConstant Instance;
3285};
3286const ParsedAttrInfoCUDAConstant ParsedAttrInfoCUDAConstant::Instance;
3287static constexpr ParsedAttrInfo::Spelling CUDADeviceSpellings[] = {
3288 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "device"},
3289 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "__device__"},
3290};
3291struct ParsedAttrInfoCUDADevice final : public ParsedAttrInfo {
3292 constexpr ParsedAttrInfoCUDADevice() : ParsedAttrInfo(
3293 /*AttrKind=*/ParsedAttr::AT_CUDADevice,
3294 /*NumArgs=*/0,
3295 /*OptArgs=*/0,
3296 /*NumArgMembers=*/0,
3297 /*HasCustomParsing=*/0,
3298 /*AcceptsExprPack=*/0,
3299 /*IsTargetSpecific=*/0,
3300 /*IsType=*/0,
3301 /*IsStmt=*/0,
3302 /*IsKnownToGCC=*/0,
3303 /*IsSupportedByPragmaAttribute=*/1,
3304 /*Spellings=*/CUDADeviceSpellings,
3305 /*ArgNames=*/{}) {}
3306bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3307 if (!isa<FunctionDecl>(Val: D) && !isa<VarDecl>(Val: D)) {
3308 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3309 << Attr << Attr.isRegularKeywordAttribute() << "functions and variables";
3310 return false;
3311 }
3312 return true;
3313}
3314
3315bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3316 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3317 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3318 return false;
3319}
3320
3321 using ParsedAttrInfo::diagMutualExclusion;
3322
3323 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3324 if (const auto *A = D->getAttr<CUDAGlobalAttr>()) {
3325 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3326 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3327return false;
3328 }
3329 return true;
3330 }
3331
3332bool acceptsLangOpts(const LangOptions &LangOpts) const override {
3333 return LangOpts.CUDA;
3334}
3335
3336void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3337 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
3338 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
3339}
3340
3341bool isParamExpr(size_t N) const override {
3342 return false;
3343}
3344
3345static const ParsedAttrInfoCUDADevice Instance;
3346};
3347const ParsedAttrInfoCUDADevice ParsedAttrInfoCUDADevice::Instance;
3348static constexpr ParsedAttrInfo::Spelling CUDADeviceBuiltinSurfaceTypeSpellings[] = {
3349 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "device_builtin_surface_type"},
3350 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "__device_builtin_surface_type__"},
3351};
3352struct ParsedAttrInfoCUDADeviceBuiltinSurfaceType final : public ParsedAttrInfo {
3353 constexpr ParsedAttrInfoCUDADeviceBuiltinSurfaceType() : ParsedAttrInfo(
3354 /*AttrKind=*/ParsedAttr::AT_CUDADeviceBuiltinSurfaceType,
3355 /*NumArgs=*/0,
3356 /*OptArgs=*/0,
3357 /*NumArgMembers=*/0,
3358 /*HasCustomParsing=*/0,
3359 /*AcceptsExprPack=*/0,
3360 /*IsTargetSpecific=*/0,
3361 /*IsType=*/0,
3362 /*IsStmt=*/0,
3363 /*IsKnownToGCC=*/0,
3364 /*IsSupportedByPragmaAttribute=*/1,
3365 /*Spellings=*/CUDADeviceBuiltinSurfaceTypeSpellings,
3366 /*ArgNames=*/{}) {}
3367bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3368 if (!isa<CXXRecordDecl>(Val: D)) {
3369 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3370 << Attr << Attr.isRegularKeywordAttribute() << "classes";
3371 return false;
3372 }
3373 return true;
3374}
3375
3376bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3377 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3378 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3379 return false;
3380}
3381
3382 using ParsedAttrInfo::diagMutualExclusion;
3383
3384 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3385 if (const auto *A = D->getAttr<CUDADeviceBuiltinTextureTypeAttr>()) {
3386 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3387 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3388return false;
3389 }
3390 return true;
3391 }
3392
3393bool acceptsLangOpts(const LangOptions &LangOpts) const override {
3394 return LangOpts.CUDA;
3395}
3396
3397void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3398 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
3399}
3400
3401AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
3402 D->addAttr(A: ::new (S.Context) CUDADeviceBuiltinSurfaceTypeAttr(S.Context, Attr));
3403 return AttributeApplied;
3404}
3405
3406bool isParamExpr(size_t N) const override {
3407 return false;
3408}
3409
3410static const ParsedAttrInfoCUDADeviceBuiltinSurfaceType Instance;
3411};
3412const ParsedAttrInfoCUDADeviceBuiltinSurfaceType ParsedAttrInfoCUDADeviceBuiltinSurfaceType::Instance;
3413static constexpr ParsedAttrInfo::Spelling CUDADeviceBuiltinTextureTypeSpellings[] = {
3414 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "device_builtin_texture_type"},
3415 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "__device_builtin_texture_type__"},
3416};
3417struct ParsedAttrInfoCUDADeviceBuiltinTextureType final : public ParsedAttrInfo {
3418 constexpr ParsedAttrInfoCUDADeviceBuiltinTextureType() : ParsedAttrInfo(
3419 /*AttrKind=*/ParsedAttr::AT_CUDADeviceBuiltinTextureType,
3420 /*NumArgs=*/0,
3421 /*OptArgs=*/0,
3422 /*NumArgMembers=*/0,
3423 /*HasCustomParsing=*/0,
3424 /*AcceptsExprPack=*/0,
3425 /*IsTargetSpecific=*/0,
3426 /*IsType=*/0,
3427 /*IsStmt=*/0,
3428 /*IsKnownToGCC=*/0,
3429 /*IsSupportedByPragmaAttribute=*/1,
3430 /*Spellings=*/CUDADeviceBuiltinTextureTypeSpellings,
3431 /*ArgNames=*/{}) {}
3432bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3433 if (!isa<CXXRecordDecl>(Val: D)) {
3434 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3435 << Attr << Attr.isRegularKeywordAttribute() << "classes";
3436 return false;
3437 }
3438 return true;
3439}
3440
3441bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3442 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3443 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3444 return false;
3445}
3446
3447 using ParsedAttrInfo::diagMutualExclusion;
3448
3449 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3450 if (const auto *A = D->getAttr<CUDADeviceBuiltinSurfaceTypeAttr>()) {
3451 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3452 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3453return false;
3454 }
3455 return true;
3456 }
3457
3458bool acceptsLangOpts(const LangOptions &LangOpts) const override {
3459 return LangOpts.CUDA;
3460}
3461
3462void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3463 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
3464}
3465
3466AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
3467 D->addAttr(A: ::new (S.Context) CUDADeviceBuiltinTextureTypeAttr(S.Context, Attr));
3468 return AttributeApplied;
3469}
3470
3471bool isParamExpr(size_t N) const override {
3472 return false;
3473}
3474
3475static const ParsedAttrInfoCUDADeviceBuiltinTextureType Instance;
3476};
3477const ParsedAttrInfoCUDADeviceBuiltinTextureType ParsedAttrInfoCUDADeviceBuiltinTextureType::Instance;
3478static constexpr ParsedAttrInfo::Spelling CUDAGlobalSpellings[] = {
3479 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "global"},
3480 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "__global__"},
3481};
3482struct ParsedAttrInfoCUDAGlobal final : public ParsedAttrInfo {
3483 constexpr ParsedAttrInfoCUDAGlobal() : ParsedAttrInfo(
3484 /*AttrKind=*/ParsedAttr::AT_CUDAGlobal,
3485 /*NumArgs=*/0,
3486 /*OptArgs=*/0,
3487 /*NumArgMembers=*/0,
3488 /*HasCustomParsing=*/0,
3489 /*AcceptsExprPack=*/0,
3490 /*IsTargetSpecific=*/0,
3491 /*IsType=*/0,
3492 /*IsStmt=*/0,
3493 /*IsKnownToGCC=*/0,
3494 /*IsSupportedByPragmaAttribute=*/1,
3495 /*Spellings=*/CUDAGlobalSpellings,
3496 /*ArgNames=*/{}) {}
3497bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3498 if (!isa<FunctionDecl>(Val: D)) {
3499 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3500 << Attr << Attr.isRegularKeywordAttribute() << "functions";
3501 return false;
3502 }
3503 return true;
3504}
3505
3506bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3507 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3508 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3509 return false;
3510}
3511
3512 using ParsedAttrInfo::diagMutualExclusion;
3513
3514 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3515 if (const auto *A = D->getAttr<CUDADeviceAttr>()) {
3516 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3517 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3518return false;
3519 }
3520 if (const auto *A = D->getAttr<CUDAHostAttr>()) {
3521 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3522 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3523return false;
3524 }
3525 return true;
3526 }
3527
3528bool acceptsLangOpts(const LangOptions &LangOpts) const override {
3529 return LangOpts.CUDA;
3530}
3531
3532void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3533 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
3534}
3535
3536bool isParamExpr(size_t N) const override {
3537 return false;
3538}
3539
3540static const ParsedAttrInfoCUDAGlobal Instance;
3541};
3542const ParsedAttrInfoCUDAGlobal ParsedAttrInfoCUDAGlobal::Instance;
3543static constexpr ParsedAttrInfo::Spelling CUDAHostSpellings[] = {
3544 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "host"},
3545 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "__host__"},
3546};
3547struct ParsedAttrInfoCUDAHost final : public ParsedAttrInfo {
3548 constexpr ParsedAttrInfoCUDAHost() : ParsedAttrInfo(
3549 /*AttrKind=*/ParsedAttr::AT_CUDAHost,
3550 /*NumArgs=*/0,
3551 /*OptArgs=*/0,
3552 /*NumArgMembers=*/0,
3553 /*HasCustomParsing=*/0,
3554 /*AcceptsExprPack=*/0,
3555 /*IsTargetSpecific=*/0,
3556 /*IsType=*/0,
3557 /*IsStmt=*/0,
3558 /*IsKnownToGCC=*/0,
3559 /*IsSupportedByPragmaAttribute=*/1,
3560 /*Spellings=*/CUDAHostSpellings,
3561 /*ArgNames=*/{}) {}
3562bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3563 if (!isa<FunctionDecl>(Val: D)) {
3564 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3565 << Attr << Attr.isRegularKeywordAttribute() << "functions";
3566 return false;
3567 }
3568 return true;
3569}
3570
3571bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3572 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3573 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3574 return false;
3575}
3576
3577 using ParsedAttrInfo::diagMutualExclusion;
3578
3579 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3580 if (const auto *A = D->getAttr<CUDAGlobalAttr>()) {
3581 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3582 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3583return false;
3584 }
3585 return true;
3586 }
3587
3588bool acceptsLangOpts(const LangOptions &LangOpts) const override {
3589 return LangOpts.CUDA;
3590}
3591
3592void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3593 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
3594}
3595
3596AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
3597 D->addAttr(A: ::new (S.Context) CUDAHostAttr(S.Context, Attr));
3598 return AttributeApplied;
3599}
3600
3601bool isParamExpr(size_t N) const override {
3602 return false;
3603}
3604
3605static const ParsedAttrInfoCUDAHost Instance;
3606};
3607const ParsedAttrInfoCUDAHost ParsedAttrInfoCUDAHost::Instance;
3608struct ParsedAttrInfoCUDAInvalidTarget final : public ParsedAttrInfo {
3609 constexpr ParsedAttrInfoCUDAInvalidTarget() : ParsedAttrInfo(
3610 /*AttrKind=*/ParsedAttr::AT_CUDAInvalidTarget,
3611 /*NumArgs=*/0,
3612 /*OptArgs=*/0,
3613 /*NumArgMembers=*/0,
3614 /*HasCustomParsing=*/0,
3615 /*AcceptsExprPack=*/0,
3616 /*IsTargetSpecific=*/0,
3617 /*IsType=*/0,
3618 /*IsStmt=*/0,
3619 /*IsKnownToGCC=*/0,
3620 /*IsSupportedByPragmaAttribute=*/0,
3621 /*Spellings=*/{},
3622 /*ArgNames=*/{}) {}
3623bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3624 if (!isa<FunctionDecl>(Val: D)) {
3625 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3626 << Attr << Attr.isRegularKeywordAttribute() << "functions";
3627 return false;
3628 }
3629 return true;
3630}
3631
3632bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3633 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3634 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3635 return false;
3636}
3637
3638bool acceptsLangOpts(const LangOptions &LangOpts) const override {
3639 return LangOpts.CUDA;
3640}
3641
3642bool isParamExpr(size_t N) const override {
3643 return false;
3644}
3645
3646static const ParsedAttrInfoCUDAInvalidTarget Instance;
3647};
3648const ParsedAttrInfoCUDAInvalidTarget ParsedAttrInfoCUDAInvalidTarget::Instance;
3649static constexpr ParsedAttrInfo::Spelling CUDALaunchBoundsSpellings[] = {
3650 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "launch_bounds"},
3651 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "__launch_bounds__"},
3652};
3653static constexpr const char *CUDALaunchBoundsArgNames[] = {
3654"MaxThreads","MinBlocks","MaxBlocks",};
3655struct ParsedAttrInfoCUDALaunchBounds final : public ParsedAttrInfo {
3656 constexpr ParsedAttrInfoCUDALaunchBounds() : ParsedAttrInfo(
3657 /*AttrKind=*/ParsedAttr::AT_CUDALaunchBounds,
3658 /*NumArgs=*/1,
3659 /*OptArgs=*/2,
3660 /*NumArgMembers=*/3,
3661 /*HasCustomParsing=*/0,
3662 /*AcceptsExprPack=*/0,
3663 /*IsTargetSpecific=*/0,
3664 /*IsType=*/0,
3665 /*IsStmt=*/0,
3666 /*IsKnownToGCC=*/0,
3667 /*IsSupportedByPragmaAttribute=*/1,
3668 /*Spellings=*/CUDALaunchBoundsSpellings,
3669 /*ArgNames=*/CUDALaunchBoundsArgNames) {}
3670bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3671 if (!isa<ObjCMethodDecl>(Val: D) && !isFunctionLike(D)) {
3672 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3673 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods, functions, and function pointers";
3674 return false;
3675 }
3676 return true;
3677}
3678
3679bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3680 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3681 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3682 return false;
3683}
3684
3685bool acceptsLangOpts(const LangOptions &LangOpts) const override {
3686 return LangOpts.CUDA;
3687}
3688
3689void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3690 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
3691 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/y: true));
3692}
3693
3694bool isParamExpr(size_t N) const override {
3695 return (N == 0) || (N == 1) || (N == 2) || false;
3696}
3697
3698static const ParsedAttrInfoCUDALaunchBounds Instance;
3699};
3700const ParsedAttrInfoCUDALaunchBounds ParsedAttrInfoCUDALaunchBounds::Instance;
3701static constexpr ParsedAttrInfo::Spelling CUDASharedSpellings[] = {
3702 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "shared"},
3703 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "__shared__"},
3704};
3705struct ParsedAttrInfoCUDAShared final : public ParsedAttrInfo {
3706 constexpr ParsedAttrInfoCUDAShared() : ParsedAttrInfo(
3707 /*AttrKind=*/ParsedAttr::AT_CUDAShared,
3708 /*NumArgs=*/0,
3709 /*OptArgs=*/0,
3710 /*NumArgMembers=*/0,
3711 /*HasCustomParsing=*/0,
3712 /*AcceptsExprPack=*/0,
3713 /*IsTargetSpecific=*/0,
3714 /*IsType=*/0,
3715 /*IsStmt=*/0,
3716 /*IsKnownToGCC=*/0,
3717 /*IsSupportedByPragmaAttribute=*/1,
3718 /*Spellings=*/CUDASharedSpellings,
3719 /*ArgNames=*/{}) {}
3720bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3721 if (!isa<VarDecl>(Val: D)) {
3722 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3723 << Attr << Attr.isRegularKeywordAttribute() << "variables";
3724 return false;
3725 }
3726 return true;
3727}
3728
3729bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3730 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3731 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3732 return false;
3733}
3734
3735 using ParsedAttrInfo::diagMutualExclusion;
3736
3737 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3738 if (const auto *A = D->getAttr<CUDAConstantAttr>()) {
3739 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3740 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3741return false;
3742 }
3743 if (const auto *A = D->getAttr<HIPManagedAttr>()) {
3744 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
3745 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
3746return false;
3747 }
3748 return true;
3749 }
3750
3751bool acceptsLangOpts(const LangOptions &LangOpts) const override {
3752 return LangOpts.CUDA;
3753}
3754
3755void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3756 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
3757}
3758
3759bool isParamExpr(size_t N) const override {
3760 return false;
3761}
3762
3763static const ParsedAttrInfoCUDAShared Instance;
3764};
3765const ParsedAttrInfoCUDAShared ParsedAttrInfoCUDAShared::Instance;
3766static constexpr ParsedAttrInfo::Spelling CXX11NoReturnSpellings[] = {
3767 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "noreturn"},
3768 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "noreturn"},
3769 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "_Noreturn"},
3770};
3771struct ParsedAttrInfoCXX11NoReturn final : public ParsedAttrInfo {
3772 constexpr ParsedAttrInfoCXX11NoReturn() : ParsedAttrInfo(
3773 /*AttrKind=*/ParsedAttr::AT_CXX11NoReturn,
3774 /*NumArgs=*/0,
3775 /*OptArgs=*/0,
3776 /*NumArgMembers=*/0,
3777 /*HasCustomParsing=*/0,
3778 /*AcceptsExprPack=*/0,
3779 /*IsTargetSpecific=*/0,
3780 /*IsType=*/0,
3781 /*IsStmt=*/0,
3782 /*IsKnownToGCC=*/0,
3783 /*IsSupportedByPragmaAttribute=*/1,
3784 /*Spellings=*/CXX11NoReturnSpellings,
3785 /*ArgNames=*/{}) {}
3786bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3787 if (!isa<FunctionDecl>(Val: D)) {
3788 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
3789 << Attr << Attr.isRegularKeywordAttribute() << "functions";
3790 return false;
3791 }
3792 return true;
3793}
3794
3795bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3796 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3797 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3798 return false;
3799}
3800
3801unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
3802 enum Spelling {
3803 CXX11_noreturn = 0,
3804 C23_noreturn = 1,
3805 C23_Noreturn = 2,
3806 SpellingNotCalculated = 15
3807
3808 };
3809
3810 unsigned Idx = Attr.getAttributeSpellingListIndex();
3811 switch (Idx) {
3812 default: llvm_unreachable("Unknown spelling list index");
3813 case 0: return CXX11_noreturn;
3814 case 1: return C23_noreturn;
3815 case 2: return C23_Noreturn;
3816 }
3817}
3818
3819void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3820 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
3821}
3822
3823bool isParamExpr(size_t N) const override {
3824 return false;
3825}
3826
3827static const ParsedAttrInfoCXX11NoReturn Instance;
3828};
3829const ParsedAttrInfoCXX11NoReturn ParsedAttrInfoCXX11NoReturn::Instance;
3830static constexpr ParsedAttrInfo::Spelling CXXAssumeSpellings[] = {
3831 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "assume"},
3832 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "assume"},
3833 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::assume"},
3834 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::assume"},
3835};
3836static constexpr const char *CXXAssumeArgNames[] = {
3837"Assumption",};
3838struct ParsedAttrInfoCXXAssume final : public ParsedAttrInfo {
3839 constexpr ParsedAttrInfoCXXAssume() : ParsedAttrInfo(
3840 /*AttrKind=*/ParsedAttr::AT_CXXAssume,
3841 /*NumArgs=*/1,
3842 /*OptArgs=*/0,
3843 /*NumArgMembers=*/1,
3844 /*HasCustomParsing=*/1,
3845 /*AcceptsExprPack=*/0,
3846 /*IsTargetSpecific=*/0,
3847 /*IsType=*/0,
3848 /*IsStmt=*/1,
3849 /*IsKnownToGCC=*/0,
3850 /*IsSupportedByPragmaAttribute=*/0,
3851 /*Spellings=*/CXXAssumeSpellings,
3852 /*ArgNames=*/CXXAssumeArgNames) {}
3853bool diagAppertainsToDecl(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
3854 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attribute_invalid_on_decl)
3855 << AL << AL.isRegularKeywordAttribute() << D->getLocation();
3856 return false;
3857}
3858
3859bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
3860 if (!isa<NullStmt>(Val: St)) {
3861 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
3862 << Attr << Attr.isRegularKeywordAttribute() << "empty statements";
3863 return false;
3864 }
3865 return true;
3866}
3867
3868bool isParamExpr(size_t N) const override {
3869 return (N == 0) || false;
3870}
3871
3872static const ParsedAttrInfoCXXAssume Instance;
3873};
3874const ParsedAttrInfoCXXAssume ParsedAttrInfoCXXAssume::Instance;
3875static constexpr ParsedAttrInfo::Spelling CallableWhenSpellings[] = {
3876 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "callable_when"},
3877 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::callable_when"},
3878};
3879static constexpr const char *CallableWhenArgNames[] = {
3880"CallableStates...",};
3881struct ParsedAttrInfoCallableWhen final : public ParsedAttrInfo {
3882 constexpr ParsedAttrInfoCallableWhen() : ParsedAttrInfo(
3883 /*AttrKind=*/ParsedAttr::AT_CallableWhen,
3884 /*NumArgs=*/0,
3885 /*OptArgs=*/15,
3886 /*NumArgMembers=*/1,
3887 /*HasCustomParsing=*/0,
3888 /*AcceptsExprPack=*/0,
3889 /*IsTargetSpecific=*/0,
3890 /*IsType=*/0,
3891 /*IsStmt=*/0,
3892 /*IsKnownToGCC=*/0,
3893 /*IsSupportedByPragmaAttribute=*/1,
3894 /*Spellings=*/CallableWhenSpellings,
3895 /*ArgNames=*/CallableWhenArgNames) {}
3896bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3897 if (!isa<CXXMethodDecl>(Val: D)) {
3898 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3899 << Attr << Attr.isRegularKeywordAttribute() << "functions";
3900 return false;
3901 }
3902 return true;
3903}
3904
3905bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3906 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3907 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3908 return false;
3909}
3910
3911void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3912 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function_is_member, /*IsSupported=*/y: LangOpts.CPlusPlus));
3913}
3914
3915bool isParamExpr(size_t N) const override {
3916 return false;
3917}
3918
3919static const ParsedAttrInfoCallableWhen Instance;
3920};
3921const ParsedAttrInfoCallableWhen ParsedAttrInfoCallableWhen::Instance;
3922static constexpr ParsedAttrInfo::Spelling CallbackSpellings[] = {
3923 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "callback"},
3924 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::callback"},
3925 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::callback"},
3926};
3927static constexpr const char *CallbackArgNames[] = {
3928"Encoding...",};
3929struct ParsedAttrInfoCallback final : public ParsedAttrInfo {
3930 constexpr ParsedAttrInfoCallback() : ParsedAttrInfo(
3931 /*AttrKind=*/ParsedAttr::AT_Callback,
3932 /*NumArgs=*/0,
3933 /*OptArgs=*/15,
3934 /*NumArgMembers=*/1,
3935 /*HasCustomParsing=*/0,
3936 /*AcceptsExprPack=*/0,
3937 /*IsTargetSpecific=*/0,
3938 /*IsType=*/0,
3939 /*IsStmt=*/0,
3940 /*IsKnownToGCC=*/0,
3941 /*IsSupportedByPragmaAttribute=*/1,
3942 /*Spellings=*/CallbackSpellings,
3943 /*ArgNames=*/CallbackArgNames) {}
3944bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3945 if (!isa<FunctionDecl>(Val: D)) {
3946 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3947 << Attr << Attr.isRegularKeywordAttribute() << "functions";
3948 return false;
3949 }
3950 return true;
3951}
3952
3953bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
3954 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
3955 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
3956 return false;
3957}
3958
3959void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
3960 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
3961}
3962
3963bool isParamExpr(size_t N) const override {
3964 return false;
3965}
3966
3967static const ParsedAttrInfoCallback Instance;
3968};
3969const ParsedAttrInfoCallback ParsedAttrInfoCallback::Instance;
3970static constexpr ParsedAttrInfo::Spelling CalledOnceSpellings[] = {
3971 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "called_once"},
3972 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::called_once"},
3973 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::called_once"},
3974};
3975struct ParsedAttrInfoCalledOnce final : public ParsedAttrInfo {
3976 constexpr ParsedAttrInfoCalledOnce() : ParsedAttrInfo(
3977 /*AttrKind=*/ParsedAttr::AT_CalledOnce,
3978 /*NumArgs=*/0,
3979 /*OptArgs=*/0,
3980 /*NumArgMembers=*/0,
3981 /*HasCustomParsing=*/0,
3982 /*AcceptsExprPack=*/0,
3983 /*IsTargetSpecific=*/0,
3984 /*IsType=*/0,
3985 /*IsStmt=*/0,
3986 /*IsKnownToGCC=*/0,
3987 /*IsSupportedByPragmaAttribute=*/1,
3988 /*Spellings=*/CalledOnceSpellings,
3989 /*ArgNames=*/{}) {}
3990bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
3991 if (!isa<ParmVarDecl>(Val: D)) {
3992 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
3993 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
3994 return false;
3995 }
3996 return true;
3997}
3998
3999bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4000 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4001 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4002 return false;
4003}
4004
4005bool acceptsLangOpts(const LangOptions &LangOpts) const override {
4006 return LangOpts.ObjC;
4007}
4008
4009void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4010 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
4011}
4012
4013bool isParamExpr(size_t N) const override {
4014 return false;
4015}
4016
4017static const ParsedAttrInfoCalledOnce Instance;
4018};
4019const ParsedAttrInfoCalledOnce ParsedAttrInfoCalledOnce::Instance;
4020static constexpr ParsedAttrInfo::Spelling CapabilitySpellings[] = {
4021 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "capability"},
4022 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::capability"},
4023 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "shared_capability"},
4024 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::shared_capability"},
4025};
4026static constexpr const char *CapabilityArgNames[] = {
4027"Name",};
4028struct ParsedAttrInfoCapability final : public ParsedAttrInfo {
4029 constexpr ParsedAttrInfoCapability() : ParsedAttrInfo(
4030 /*AttrKind=*/ParsedAttr::AT_Capability,
4031 /*NumArgs=*/1,
4032 /*OptArgs=*/0,
4033 /*NumArgMembers=*/1,
4034 /*HasCustomParsing=*/0,
4035 /*AcceptsExprPack=*/0,
4036 /*IsTargetSpecific=*/0,
4037 /*IsType=*/0,
4038 /*IsStmt=*/0,
4039 /*IsKnownToGCC=*/0,
4040 /*IsSupportedByPragmaAttribute=*/1,
4041 /*Spellings=*/CapabilitySpellings,
4042 /*ArgNames=*/CapabilityArgNames) {}
4043bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4044 if (!isa<RecordDecl>(Val: D) && !isa<TypedefNameDecl>(Val: D)) {
4045 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
4046 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, classes, and typedefs";
4047 return false;
4048 }
4049 return true;
4050}
4051
4052bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4053 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4054 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4055 return false;
4056}
4057
4058unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
4059 enum Spelling {
4060 GNU_capability = 0,
4061 CXX11_clang_capability = 1,
4062 GNU_shared_capability = 2,
4063 CXX11_clang_shared_capability = 3,
4064 SpellingNotCalculated = 15
4065
4066 };
4067
4068 unsigned Idx = Attr.getAttributeSpellingListIndex();
4069 switch (Idx) {
4070 default: llvm_unreachable("Unknown spelling list index");
4071 case 0: return GNU_capability;
4072 case 1: return CXX11_clang_capability;
4073 case 2: return GNU_shared_capability;
4074 case 3: return CXX11_clang_shared_capability;
4075 }
4076}
4077
4078void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4079 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
4080 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
4081}
4082
4083bool isParamExpr(size_t N) const override {
4084 return false;
4085}
4086
4087static const ParsedAttrInfoCapability Instance;
4088};
4089const ParsedAttrInfoCapability ParsedAttrInfoCapability::Instance;
4090static constexpr ParsedAttrInfo::Spelling CarriesDependencySpellings[] = {
4091 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "carries_dependency"},
4092 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "carries_dependency"},
4093};
4094struct ParsedAttrInfoCarriesDependency final : public ParsedAttrInfo {
4095 constexpr ParsedAttrInfoCarriesDependency() : ParsedAttrInfo(
4096 /*AttrKind=*/ParsedAttr::AT_CarriesDependency,
4097 /*NumArgs=*/0,
4098 /*OptArgs=*/0,
4099 /*NumArgMembers=*/0,
4100 /*HasCustomParsing=*/0,
4101 /*AcceptsExprPack=*/0,
4102 /*IsTargetSpecific=*/0,
4103 /*IsType=*/0,
4104 /*IsStmt=*/0,
4105 /*IsKnownToGCC=*/0,
4106 /*IsSupportedByPragmaAttribute=*/1,
4107 /*Spellings=*/CarriesDependencySpellings,
4108 /*ArgNames=*/{}) {}
4109bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4110 if (!isa<ParmVarDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D) && !isa<FunctionDecl>(Val: D)) {
4111 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
4112 << Attr << Attr.isRegularKeywordAttribute() << "parameters, Objective-C methods, and functions";
4113 return false;
4114 }
4115 return true;
4116}
4117
4118bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4119 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4120 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4121 return false;
4122}
4123
4124void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4125 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
4126 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
4127 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
4128}
4129
4130bool isParamExpr(size_t N) const override {
4131 return false;
4132}
4133
4134static const ParsedAttrInfoCarriesDependency Instance;
4135};
4136const ParsedAttrInfoCarriesDependency ParsedAttrInfoCarriesDependency::Instance;
4137static constexpr ParsedAttrInfo::Spelling CleanupSpellings[] = {
4138 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cleanup"},
4139 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::cleanup"},
4140 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::cleanup"},
4141};
4142static constexpr const char *CleanupArgNames[] = {
4143"FunctionDecl",};
4144struct ParsedAttrInfoCleanup final : public ParsedAttrInfo {
4145 constexpr ParsedAttrInfoCleanup() : ParsedAttrInfo(
4146 /*AttrKind=*/ParsedAttr::AT_Cleanup,
4147 /*NumArgs=*/1,
4148 /*OptArgs=*/0,
4149 /*NumArgMembers=*/1,
4150 /*HasCustomParsing=*/0,
4151 /*AcceptsExprPack=*/0,
4152 /*IsTargetSpecific=*/0,
4153 /*IsType=*/0,
4154 /*IsStmt=*/0,
4155 /*IsKnownToGCC=*/1,
4156 /*IsSupportedByPragmaAttribute=*/1,
4157 /*Spellings=*/CleanupSpellings,
4158 /*ArgNames=*/CleanupArgNames) {}
4159bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4160 if (!isLocalVar(D)) {
4161 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4162 << Attr << Attr.isRegularKeywordAttribute() << "local variables";
4163 return false;
4164 }
4165 return true;
4166}
4167
4168bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4169 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4170 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4171 return false;
4172}
4173
4174void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4175 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_local, /*IsSupported=*/y: true));
4176}
4177
4178bool isParamExpr(size_t N) const override {
4179 return false;
4180}
4181
4182static const ParsedAttrInfoCleanup Instance;
4183};
4184const ParsedAttrInfoCleanup ParsedAttrInfoCleanup::Instance;
4185static constexpr ParsedAttrInfo::Spelling ClspvLibclcBuiltinSpellings[] = {
4186 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "clspv_libclc_builtin"},
4187 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::clspv_libclc_builtin"},
4188 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::clspv_libclc_builtin"},
4189};
4190struct ParsedAttrInfoClspvLibclcBuiltin final : public ParsedAttrInfo {
4191 constexpr ParsedAttrInfoClspvLibclcBuiltin() : ParsedAttrInfo(
4192 /*AttrKind=*/ParsedAttr::AT_ClspvLibclcBuiltin,
4193 /*NumArgs=*/0,
4194 /*OptArgs=*/0,
4195 /*NumArgMembers=*/0,
4196 /*HasCustomParsing=*/0,
4197 /*AcceptsExprPack=*/0,
4198 /*IsTargetSpecific=*/0,
4199 /*IsType=*/0,
4200 /*IsStmt=*/0,
4201 /*IsKnownToGCC=*/0,
4202 /*IsSupportedByPragmaAttribute=*/1,
4203 /*Spellings=*/ClspvLibclcBuiltinSpellings,
4204 /*ArgNames=*/{}) {}
4205bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4206 if (!isa<FunctionDecl>(Val: D)) {
4207 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4208 << Attr << Attr.isRegularKeywordAttribute() << "functions";
4209 return false;
4210 }
4211 return true;
4212}
4213
4214bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4215 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4216 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4217 return false;
4218}
4219
4220void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4221 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
4222}
4223
4224AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
4225 D->addAttr(A: ::new (S.Context) ClspvLibclcBuiltinAttr(S.Context, Attr));
4226 return AttributeApplied;
4227}
4228
4229bool isParamExpr(size_t N) const override {
4230 return false;
4231}
4232
4233static const ParsedAttrInfoClspvLibclcBuiltin Instance;
4234};
4235const ParsedAttrInfoClspvLibclcBuiltin ParsedAttrInfoClspvLibclcBuiltin::Instance;
4236static constexpr ParsedAttrInfo::Spelling CmseNSCallSpellings[] = {
4237 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cmse_nonsecure_call"},
4238};
4239struct ParsedAttrInfoCmseNSCall final : public ParsedAttrInfo {
4240 constexpr ParsedAttrInfoCmseNSCall() : ParsedAttrInfo(
4241 /*AttrKind=*/ParsedAttr::AT_CmseNSCall,
4242 /*NumArgs=*/0,
4243 /*OptArgs=*/0,
4244 /*NumArgMembers=*/0,
4245 /*HasCustomParsing=*/0,
4246 /*AcceptsExprPack=*/0,
4247 /*IsTargetSpecific=*/1,
4248 /*IsType=*/1,
4249 /*IsStmt=*/0,
4250 /*IsKnownToGCC=*/0,
4251 /*IsSupportedByPragmaAttribute=*/0,
4252 /*Spellings=*/CmseNSCallSpellings,
4253 /*ArgNames=*/{}) {}
4254bool acceptsLangOpts(const LangOptions &LangOpts) const override {
4255 return LangOpts.Cmse;
4256}
4257
4258bool existsInTarget(const TargetInfo &Target) const override {
4259 const llvm::Triple &T = Target.getTriple(); (void)T;
4260 return true && (T.getArch() == llvm::Triple::arm || T.getArch() == llvm::Triple::thumb || T.getArch() == llvm::Triple::armeb || T.getArch() == llvm::Triple::thumbeb);
4261}
4262
4263bool isParamExpr(size_t N) const override {
4264 return false;
4265}
4266
4267static const ParsedAttrInfoCmseNSCall Instance;
4268};
4269const ParsedAttrInfoCmseNSCall ParsedAttrInfoCmseNSCall::Instance;
4270static constexpr ParsedAttrInfo::Spelling CmseNSEntrySpellings[] = {
4271 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cmse_nonsecure_entry"},
4272};
4273struct ParsedAttrInfoCmseNSEntry final : public ParsedAttrInfo {
4274 constexpr ParsedAttrInfoCmseNSEntry() : ParsedAttrInfo(
4275 /*AttrKind=*/ParsedAttr::AT_CmseNSEntry,
4276 /*NumArgs=*/0,
4277 /*OptArgs=*/0,
4278 /*NumArgMembers=*/0,
4279 /*HasCustomParsing=*/0,
4280 /*AcceptsExprPack=*/0,
4281 /*IsTargetSpecific=*/1,
4282 /*IsType=*/0,
4283 /*IsStmt=*/0,
4284 /*IsKnownToGCC=*/0,
4285 /*IsSupportedByPragmaAttribute=*/1,
4286 /*Spellings=*/CmseNSEntrySpellings,
4287 /*ArgNames=*/{}) {}
4288bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4289 if (!isa<FunctionDecl>(Val: D)) {
4290 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4291 << Attr << Attr.isRegularKeywordAttribute() << "functions";
4292 return false;
4293 }
4294 return true;
4295}
4296
4297bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4298 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4299 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4300 return false;
4301}
4302
4303bool acceptsLangOpts(const LangOptions &LangOpts) const override {
4304 return LangOpts.Cmse;
4305}
4306
4307bool existsInTarget(const TargetInfo &Target) const override {
4308 const llvm::Triple &T = Target.getTriple(); (void)T;
4309 return true && (T.getArch() == llvm::Triple::arm || T.getArch() == llvm::Triple::thumb || T.getArch() == llvm::Triple::armeb || T.getArch() == llvm::Triple::thumbeb);
4310}
4311
4312void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4313 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
4314}
4315
4316bool isParamExpr(size_t N) const override {
4317 return false;
4318}
4319
4320static const ParsedAttrInfoCmseNSEntry Instance;
4321};
4322const ParsedAttrInfoCmseNSEntry ParsedAttrInfoCmseNSEntry::Instance;
4323static constexpr ParsedAttrInfo::Spelling CodeAlignSpellings[] = {
4324 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "code_align"},
4325 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::code_align"},
4326 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::code_align"},
4327};
4328static constexpr const char *CodeAlignArgNames[] = {
4329"Alignment",};
4330struct ParsedAttrInfoCodeAlign final : public ParsedAttrInfo {
4331 constexpr ParsedAttrInfoCodeAlign() : ParsedAttrInfo(
4332 /*AttrKind=*/ParsedAttr::AT_CodeAlign,
4333 /*NumArgs=*/1,
4334 /*OptArgs=*/0,
4335 /*NumArgMembers=*/1,
4336 /*HasCustomParsing=*/0,
4337 /*AcceptsExprPack=*/0,
4338 /*IsTargetSpecific=*/0,
4339 /*IsType=*/0,
4340 /*IsStmt=*/1,
4341 /*IsKnownToGCC=*/0,
4342 /*IsSupportedByPragmaAttribute=*/0,
4343 /*Spellings=*/CodeAlignSpellings,
4344 /*ArgNames=*/CodeAlignArgNames) {}
4345bool diagAppertainsToDecl(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
4346 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attribute_invalid_on_decl)
4347 << AL << AL.isRegularKeywordAttribute() << D->getLocation();
4348 return false;
4349}
4350
4351bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
4352 if (!isa<ForStmt>(Val: St) && !isa<CXXForRangeStmt>(Val: St) && !isa<WhileStmt>(Val: St) && !isa<DoStmt>(Val: St)) {
4353 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
4354 << Attr << Attr.isRegularKeywordAttribute() << "'for', 'while', and 'do' statements";
4355 return false;
4356 }
4357 return true;
4358}
4359
4360bool isParamExpr(size_t N) const override {
4361 return (N == 0) || false;
4362}
4363
4364static const ParsedAttrInfoCodeAlign Instance;
4365};
4366const ParsedAttrInfoCodeAlign ParsedAttrInfoCodeAlign::Instance;
4367static constexpr ParsedAttrInfo::Spelling CodeModelSpellings[] = {
4368 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "model"},
4369 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::model"},
4370 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::model"},
4371};
4372static constexpr const char *CodeModelArgNames[] = {
4373"Model",};
4374struct ParsedAttrInfoCodeModel final : public ParsedAttrInfo {
4375 constexpr ParsedAttrInfoCodeModel() : ParsedAttrInfo(
4376 /*AttrKind=*/ParsedAttr::AT_CodeModel,
4377 /*NumArgs=*/1,
4378 /*OptArgs=*/0,
4379 /*NumArgMembers=*/1,
4380 /*HasCustomParsing=*/0,
4381 /*AcceptsExprPack=*/0,
4382 /*IsTargetSpecific=*/1,
4383 /*IsType=*/0,
4384 /*IsStmt=*/0,
4385 /*IsKnownToGCC=*/1,
4386 /*IsSupportedByPragmaAttribute=*/0,
4387 /*Spellings=*/CodeModelSpellings,
4388 /*ArgNames=*/CodeModelArgNames) {}
4389bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4390 if (!isNonTLSGlobalVar(D)) {
4391 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
4392 << Attr << Attr.isRegularKeywordAttribute() << "non-TLS global variables";
4393 return false;
4394 }
4395 return true;
4396}
4397
4398bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4399 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4400 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4401 return false;
4402}
4403
4404bool existsInTarget(const TargetInfo &Target) const override {
4405 const llvm::Triple &T = Target.getTriple(); (void)T;
4406 return true && (T.getArch() == llvm::Triple::loongarch32 || T.getArch() == llvm::Triple::loongarch64);
4407}
4408
4409bool isParamExpr(size_t N) const override {
4410 return false;
4411}
4412
4413static const ParsedAttrInfoCodeModel Instance;
4414};
4415const ParsedAttrInfoCodeModel ParsedAttrInfoCodeModel::Instance;
4416static constexpr ParsedAttrInfo::Spelling CodeSegSpellings[] = {
4417 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "code_seg"},
4418};
4419static constexpr const char *CodeSegArgNames[] = {
4420"Name",};
4421struct ParsedAttrInfoCodeSeg final : public ParsedAttrInfo {
4422 constexpr ParsedAttrInfoCodeSeg() : ParsedAttrInfo(
4423 /*AttrKind=*/ParsedAttr::AT_CodeSeg,
4424 /*NumArgs=*/1,
4425 /*OptArgs=*/0,
4426 /*NumArgMembers=*/1,
4427 /*HasCustomParsing=*/0,
4428 /*AcceptsExprPack=*/0,
4429 /*IsTargetSpecific=*/0,
4430 /*IsType=*/0,
4431 /*IsStmt=*/0,
4432 /*IsKnownToGCC=*/0,
4433 /*IsSupportedByPragmaAttribute=*/0,
4434 /*Spellings=*/CodeSegSpellings,
4435 /*ArgNames=*/CodeSegArgNames) {}
4436bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4437 if (!isa<FunctionDecl>(Val: D) && !isa<CXXRecordDecl>(Val: D)) {
4438 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
4439 << Attr << Attr.isRegularKeywordAttribute() << "functions and classes";
4440 return false;
4441 }
4442 return true;
4443}
4444
4445bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4446 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4447 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4448 return false;
4449}
4450
4451bool isParamExpr(size_t N) const override {
4452 return false;
4453}
4454
4455static const ParsedAttrInfoCodeSeg Instance;
4456};
4457const ParsedAttrInfoCodeSeg ParsedAttrInfoCodeSeg::Instance;
4458static constexpr ParsedAttrInfo::Spelling ColdSpellings[] = {
4459 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "cold"},
4460 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::cold"},
4461 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::cold"},
4462};
4463struct ParsedAttrInfoCold final : public ParsedAttrInfo {
4464 constexpr ParsedAttrInfoCold() : ParsedAttrInfo(
4465 /*AttrKind=*/ParsedAttr::AT_Cold,
4466 /*NumArgs=*/0,
4467 /*OptArgs=*/0,
4468 /*NumArgMembers=*/0,
4469 /*HasCustomParsing=*/0,
4470 /*AcceptsExprPack=*/0,
4471 /*IsTargetSpecific=*/0,
4472 /*IsType=*/0,
4473 /*IsStmt=*/0,
4474 /*IsKnownToGCC=*/1,
4475 /*IsSupportedByPragmaAttribute=*/1,
4476 /*Spellings=*/ColdSpellings,
4477 /*ArgNames=*/{}) {}
4478bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4479 if (!isa<FunctionDecl>(Val: D)) {
4480 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4481 << Attr << Attr.isRegularKeywordAttribute() << "functions";
4482 return false;
4483 }
4484 return true;
4485}
4486
4487bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4488 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4489 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4490 return false;
4491}
4492
4493 using ParsedAttrInfo::diagMutualExclusion;
4494
4495 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
4496 if (const auto *A = D->getAttr<HotAttr>()) {
4497 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
4498 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
4499return false;
4500 }
4501 return true;
4502 }
4503
4504void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4505 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
4506}
4507
4508AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
4509 D->addAttr(A: ::new (S.Context) ColdAttr(S.Context, Attr));
4510 return AttributeApplied;
4511}
4512
4513bool isParamExpr(size_t N) const override {
4514 return false;
4515}
4516
4517static const ParsedAttrInfoCold Instance;
4518};
4519const ParsedAttrInfoCold ParsedAttrInfoCold::Instance;
4520static constexpr ParsedAttrInfo::Spelling CommonSpellings[] = {
4521 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "common"},
4522 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::common"},
4523 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::common"},
4524};
4525struct ParsedAttrInfoCommon final : public ParsedAttrInfo {
4526 constexpr ParsedAttrInfoCommon() : ParsedAttrInfo(
4527 /*AttrKind=*/ParsedAttr::AT_Common,
4528 /*NumArgs=*/0,
4529 /*OptArgs=*/0,
4530 /*NumArgMembers=*/0,
4531 /*HasCustomParsing=*/0,
4532 /*AcceptsExprPack=*/0,
4533 /*IsTargetSpecific=*/0,
4534 /*IsType=*/0,
4535 /*IsStmt=*/0,
4536 /*IsKnownToGCC=*/1,
4537 /*IsSupportedByPragmaAttribute=*/1,
4538 /*Spellings=*/CommonSpellings,
4539 /*ArgNames=*/{}) {}
4540bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4541 if (!isa<VarDecl>(Val: D)) {
4542 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4543 << Attr << Attr.isRegularKeywordAttribute() << "variables";
4544 return false;
4545 }
4546 return true;
4547}
4548
4549bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4550 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4551 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4552 return false;
4553}
4554
4555 using ParsedAttrInfo::diagMutualExclusion;
4556
4557 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
4558 if (const auto *A = D->getAttr<InternalLinkageAttr>()) {
4559 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
4560 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
4561return false;
4562 }
4563 return true;
4564 }
4565
4566void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4567 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
4568}
4569
4570bool isParamExpr(size_t N) const override {
4571 return false;
4572}
4573
4574static const ParsedAttrInfoCommon Instance;
4575};
4576const ParsedAttrInfoCommon ParsedAttrInfoCommon::Instance;
4577static constexpr ParsedAttrInfo::Spelling ConstSpellings[] = {
4578 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "const"},
4579 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::const"},
4580 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::const"},
4581 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "__const"},
4582 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::__const"},
4583 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::__const"},
4584};
4585struct ParsedAttrInfoConst final : public ParsedAttrInfo {
4586 constexpr ParsedAttrInfoConst() : ParsedAttrInfo(
4587 /*AttrKind=*/ParsedAttr::AT_Const,
4588 /*NumArgs=*/0,
4589 /*OptArgs=*/0,
4590 /*NumArgMembers=*/0,
4591 /*HasCustomParsing=*/0,
4592 /*AcceptsExprPack=*/0,
4593 /*IsTargetSpecific=*/0,
4594 /*IsType=*/0,
4595 /*IsStmt=*/0,
4596 /*IsKnownToGCC=*/1,
4597 /*IsSupportedByPragmaAttribute=*/0,
4598 /*Spellings=*/ConstSpellings,
4599 /*ArgNames=*/{}) {}
4600AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
4601 D->addAttr(A: ::new (S.Context) ConstAttr(S.Context, Attr));
4602 return AttributeApplied;
4603}
4604
4605bool isParamExpr(size_t N) const override {
4606 return false;
4607}
4608
4609static const ParsedAttrInfoConst Instance;
4610};
4611const ParsedAttrInfoConst ParsedAttrInfoConst::Instance;
4612static constexpr ParsedAttrInfo::Spelling ConstInitSpellings[] = {
4613 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "constinit"},
4614 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "require_constant_initialization"},
4615 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::require_constant_initialization"},
4616};
4617struct ParsedAttrInfoConstInit final : public ParsedAttrInfo {
4618 constexpr ParsedAttrInfoConstInit() : ParsedAttrInfo(
4619 /*AttrKind=*/ParsedAttr::AT_ConstInit,
4620 /*NumArgs=*/0,
4621 /*OptArgs=*/0,
4622 /*NumArgMembers=*/0,
4623 /*HasCustomParsing=*/0,
4624 /*AcceptsExprPack=*/0,
4625 /*IsTargetSpecific=*/0,
4626 /*IsType=*/0,
4627 /*IsStmt=*/0,
4628 /*IsKnownToGCC=*/0,
4629 /*IsSupportedByPragmaAttribute=*/1,
4630 /*Spellings=*/ConstInitSpellings,
4631 /*ArgNames=*/{}) {}
4632bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4633 if (!isGlobalVar(D)) {
4634 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
4635 << Attr << Attr.isRegularKeywordAttribute() << "global variables";
4636 return false;
4637 }
4638 return true;
4639}
4640
4641bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4642 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4643 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4644 return false;
4645}
4646
4647bool acceptsLangOpts(const LangOptions &LangOpts) const override {
4648 return LangOpts.CPlusPlus;
4649}
4650
4651unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
4652 enum Spelling {
4653 Keyword_constinit = 0,
4654 GNU_require_constant_initialization = 1,
4655 CXX11_clang_require_constant_initialization = 2,
4656 SpellingNotCalculated = 15
4657
4658 };
4659
4660 unsigned Idx = Attr.getAttributeSpellingListIndex();
4661 switch (Idx) {
4662 default: llvm_unreachable("Unknown spelling list index");
4663 case 0: return Keyword_constinit;
4664 case 1: return GNU_require_constant_initialization;
4665 case 2: return CXX11_clang_require_constant_initialization;
4666 }
4667}
4668
4669void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4670 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/y: true));
4671}
4672
4673AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
4674 D->addAttr(A: ::new (S.Context) ConstInitAttr(S.Context, Attr));
4675 return AttributeApplied;
4676}
4677
4678bool isParamExpr(size_t N) const override {
4679 return false;
4680}
4681
4682static const ParsedAttrInfoConstInit Instance;
4683};
4684const ParsedAttrInfoConstInit ParsedAttrInfoConstInit::Instance;
4685static constexpr ParsedAttrInfo::Spelling ConstructorSpellings[] = {
4686 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "constructor"},
4687 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::constructor"},
4688 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::constructor"},
4689};
4690static constexpr const char *ConstructorArgNames[] = {
4691"Priority",};
4692struct ParsedAttrInfoConstructor final : public ParsedAttrInfo {
4693 constexpr ParsedAttrInfoConstructor() : ParsedAttrInfo(
4694 /*AttrKind=*/ParsedAttr::AT_Constructor,
4695 /*NumArgs=*/0,
4696 /*OptArgs=*/1,
4697 /*NumArgMembers=*/1,
4698 /*HasCustomParsing=*/0,
4699 /*AcceptsExprPack=*/0,
4700 /*IsTargetSpecific=*/0,
4701 /*IsType=*/0,
4702 /*IsStmt=*/0,
4703 /*IsKnownToGCC=*/1,
4704 /*IsSupportedByPragmaAttribute=*/1,
4705 /*Spellings=*/ConstructorSpellings,
4706 /*ArgNames=*/ConstructorArgNames) {}
4707bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4708 if (!isa<FunctionDecl>(Val: D)) {
4709 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4710 << Attr << Attr.isRegularKeywordAttribute() << "functions";
4711 return false;
4712 }
4713 return true;
4714}
4715
4716bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4717 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4718 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4719 return false;
4720}
4721
4722void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4723 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
4724}
4725
4726bool isParamExpr(size_t N) const override {
4727 return false;
4728}
4729
4730static const ParsedAttrInfoConstructor Instance;
4731};
4732const ParsedAttrInfoConstructor ParsedAttrInfoConstructor::Instance;
4733static constexpr ParsedAttrInfo::Spelling ConsumableSpellings[] = {
4734 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "consumable"},
4735 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::consumable"},
4736};
4737static constexpr const char *ConsumableArgNames[] = {
4738"DefaultState",};
4739struct ParsedAttrInfoConsumable final : public ParsedAttrInfo {
4740 constexpr ParsedAttrInfoConsumable() : ParsedAttrInfo(
4741 /*AttrKind=*/ParsedAttr::AT_Consumable,
4742 /*NumArgs=*/1,
4743 /*OptArgs=*/0,
4744 /*NumArgMembers=*/1,
4745 /*HasCustomParsing=*/0,
4746 /*AcceptsExprPack=*/0,
4747 /*IsTargetSpecific=*/0,
4748 /*IsType=*/0,
4749 /*IsStmt=*/0,
4750 /*IsKnownToGCC=*/0,
4751 /*IsSupportedByPragmaAttribute=*/1,
4752 /*Spellings=*/ConsumableSpellings,
4753 /*ArgNames=*/ConsumableArgNames) {}
4754bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4755 if (!isa<CXXRecordDecl>(Val: D)) {
4756 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4757 << Attr << Attr.isRegularKeywordAttribute() << "classes";
4758 return false;
4759 }
4760 return true;
4761}
4762
4763bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4764 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4765 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4766 return false;
4767}
4768
4769void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4770 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
4771}
4772
4773bool isParamExpr(size_t N) const override {
4774 return false;
4775}
4776
4777static const ParsedAttrInfoConsumable Instance;
4778};
4779const ParsedAttrInfoConsumable ParsedAttrInfoConsumable::Instance;
4780static constexpr ParsedAttrInfo::Spelling ConsumableAutoCastSpellings[] = {
4781 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "consumable_auto_cast_state"},
4782 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::consumable_auto_cast_state"},
4783};
4784struct ParsedAttrInfoConsumableAutoCast final : public ParsedAttrInfo {
4785 constexpr ParsedAttrInfoConsumableAutoCast() : ParsedAttrInfo(
4786 /*AttrKind=*/ParsedAttr::AT_ConsumableAutoCast,
4787 /*NumArgs=*/0,
4788 /*OptArgs=*/0,
4789 /*NumArgMembers=*/0,
4790 /*HasCustomParsing=*/0,
4791 /*AcceptsExprPack=*/0,
4792 /*IsTargetSpecific=*/0,
4793 /*IsType=*/0,
4794 /*IsStmt=*/0,
4795 /*IsKnownToGCC=*/0,
4796 /*IsSupportedByPragmaAttribute=*/1,
4797 /*Spellings=*/ConsumableAutoCastSpellings,
4798 /*ArgNames=*/{}) {}
4799bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4800 if (!isa<CXXRecordDecl>(Val: D)) {
4801 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4802 << Attr << Attr.isRegularKeywordAttribute() << "classes";
4803 return false;
4804 }
4805 return true;
4806}
4807
4808bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4809 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4810 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4811 return false;
4812}
4813
4814void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4815 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
4816}
4817
4818AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
4819 D->addAttr(A: ::new (S.Context) ConsumableAutoCastAttr(S.Context, Attr));
4820 return AttributeApplied;
4821}
4822
4823bool isParamExpr(size_t N) const override {
4824 return false;
4825}
4826
4827static const ParsedAttrInfoConsumableAutoCast Instance;
4828};
4829const ParsedAttrInfoConsumableAutoCast ParsedAttrInfoConsumableAutoCast::Instance;
4830static constexpr ParsedAttrInfo::Spelling ConsumableSetOnReadSpellings[] = {
4831 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "consumable_set_state_on_read"},
4832 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::consumable_set_state_on_read"},
4833};
4834struct ParsedAttrInfoConsumableSetOnRead final : public ParsedAttrInfo {
4835 constexpr ParsedAttrInfoConsumableSetOnRead() : ParsedAttrInfo(
4836 /*AttrKind=*/ParsedAttr::AT_ConsumableSetOnRead,
4837 /*NumArgs=*/0,
4838 /*OptArgs=*/0,
4839 /*NumArgMembers=*/0,
4840 /*HasCustomParsing=*/0,
4841 /*AcceptsExprPack=*/0,
4842 /*IsTargetSpecific=*/0,
4843 /*IsType=*/0,
4844 /*IsStmt=*/0,
4845 /*IsKnownToGCC=*/0,
4846 /*IsSupportedByPragmaAttribute=*/1,
4847 /*Spellings=*/ConsumableSetOnReadSpellings,
4848 /*ArgNames=*/{}) {}
4849bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4850 if (!isa<CXXRecordDecl>(Val: D)) {
4851 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4852 << Attr << Attr.isRegularKeywordAttribute() << "classes";
4853 return false;
4854 }
4855 return true;
4856}
4857
4858bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4859 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4860 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4861 return false;
4862}
4863
4864void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4865 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
4866}
4867
4868AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
4869 D->addAttr(A: ::new (S.Context) ConsumableSetOnReadAttr(S.Context, Attr));
4870 return AttributeApplied;
4871}
4872
4873bool isParamExpr(size_t N) const override {
4874 return false;
4875}
4876
4877static const ParsedAttrInfoConsumableSetOnRead Instance;
4878};
4879const ParsedAttrInfoConsumableSetOnRead ParsedAttrInfoConsumableSetOnRead::Instance;
4880static constexpr ParsedAttrInfo::Spelling ConvergentSpellings[] = {
4881 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "convergent"},
4882 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::convergent"},
4883 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::convergent"},
4884};
4885struct ParsedAttrInfoConvergent final : public ParsedAttrInfo {
4886 constexpr ParsedAttrInfoConvergent() : ParsedAttrInfo(
4887 /*AttrKind=*/ParsedAttr::AT_Convergent,
4888 /*NumArgs=*/0,
4889 /*OptArgs=*/0,
4890 /*NumArgMembers=*/0,
4891 /*HasCustomParsing=*/0,
4892 /*AcceptsExprPack=*/0,
4893 /*IsTargetSpecific=*/0,
4894 /*IsType=*/0,
4895 /*IsStmt=*/0,
4896 /*IsKnownToGCC=*/0,
4897 /*IsSupportedByPragmaAttribute=*/1,
4898 /*Spellings=*/ConvergentSpellings,
4899 /*ArgNames=*/{}) {}
4900bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4901 if (!isa<FunctionDecl>(Val: D)) {
4902 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4903 << Attr << Attr.isRegularKeywordAttribute() << "functions";
4904 return false;
4905 }
4906 return true;
4907}
4908
4909bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4910 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4911 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4912 return false;
4913}
4914
4915void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4916 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
4917}
4918
4919AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
4920 D->addAttr(A: ::new (S.Context) ConvergentAttr(S.Context, Attr));
4921 return AttributeApplied;
4922}
4923
4924bool isParamExpr(size_t N) const override {
4925 return false;
4926}
4927
4928static const ParsedAttrInfoConvergent Instance;
4929};
4930const ParsedAttrInfoConvergent ParsedAttrInfoConvergent::Instance;
4931static constexpr ParsedAttrInfo::Spelling CoroDisableLifetimeBoundSpellings[] = {
4932 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "coro_disable_lifetimebound"},
4933 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::coro_disable_lifetimebound"},
4934 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::coro_disable_lifetimebound"},
4935};
4936struct ParsedAttrInfoCoroDisableLifetimeBound final : public ParsedAttrInfo {
4937 constexpr ParsedAttrInfoCoroDisableLifetimeBound() : ParsedAttrInfo(
4938 /*AttrKind=*/ParsedAttr::AT_CoroDisableLifetimeBound,
4939 /*NumArgs=*/0,
4940 /*OptArgs=*/0,
4941 /*NumArgMembers=*/0,
4942 /*HasCustomParsing=*/0,
4943 /*AcceptsExprPack=*/0,
4944 /*IsTargetSpecific=*/0,
4945 /*IsType=*/0,
4946 /*IsStmt=*/0,
4947 /*IsKnownToGCC=*/0,
4948 /*IsSupportedByPragmaAttribute=*/1,
4949 /*Spellings=*/CoroDisableLifetimeBoundSpellings,
4950 /*ArgNames=*/{}) {}
4951bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
4952 if (!isa<FunctionDecl>(Val: D)) {
4953 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
4954 << Attr << Attr.isRegularKeywordAttribute() << "functions";
4955 return false;
4956 }
4957 return true;
4958}
4959
4960bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
4961 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
4962 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
4963 return false;
4964}
4965
4966bool acceptsLangOpts(const LangOptions &LangOpts) const override {
4967 return LangOpts.CPlusPlus;
4968}
4969
4970void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
4971 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
4972}
4973
4974AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
4975 D->addAttr(A: ::new (S.Context) CoroDisableLifetimeBoundAttr(S.Context, Attr));
4976 return AttributeApplied;
4977}
4978
4979bool isParamExpr(size_t N) const override {
4980 return false;
4981}
4982
4983static const ParsedAttrInfoCoroDisableLifetimeBound Instance;
4984};
4985const ParsedAttrInfoCoroDisableLifetimeBound ParsedAttrInfoCoroDisableLifetimeBound::Instance;
4986static constexpr ParsedAttrInfo::Spelling CoroLifetimeBoundSpellings[] = {
4987 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "coro_lifetimebound"},
4988 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::coro_lifetimebound"},
4989 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::coro_lifetimebound"},
4990};
4991struct ParsedAttrInfoCoroLifetimeBound final : public ParsedAttrInfo {
4992 constexpr ParsedAttrInfoCoroLifetimeBound() : ParsedAttrInfo(
4993 /*AttrKind=*/ParsedAttr::AT_CoroLifetimeBound,
4994 /*NumArgs=*/0,
4995 /*OptArgs=*/0,
4996 /*NumArgMembers=*/0,
4997 /*HasCustomParsing=*/0,
4998 /*AcceptsExprPack=*/0,
4999 /*IsTargetSpecific=*/0,
5000 /*IsType=*/0,
5001 /*IsStmt=*/0,
5002 /*IsKnownToGCC=*/0,
5003 /*IsSupportedByPragmaAttribute=*/1,
5004 /*Spellings=*/CoroLifetimeBoundSpellings,
5005 /*ArgNames=*/{}) {}
5006bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5007 if (!isa<CXXRecordDecl>(Val: D)) {
5008 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5009 << Attr << Attr.isRegularKeywordAttribute() << "classes";
5010 return false;
5011 }
5012 return true;
5013}
5014
5015bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5016 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5017 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5018 return false;
5019}
5020
5021bool acceptsLangOpts(const LangOptions &LangOpts) const override {
5022 return LangOpts.CPlusPlus;
5023}
5024
5025void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5026 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
5027}
5028
5029AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
5030 D->addAttr(A: ::new (S.Context) CoroLifetimeBoundAttr(S.Context, Attr));
5031 return AttributeApplied;
5032}
5033
5034bool isParamExpr(size_t N) const override {
5035 return false;
5036}
5037
5038static const ParsedAttrInfoCoroLifetimeBound Instance;
5039};
5040const ParsedAttrInfoCoroLifetimeBound ParsedAttrInfoCoroLifetimeBound::Instance;
5041static constexpr ParsedAttrInfo::Spelling CoroOnlyDestroyWhenCompleteSpellings[] = {
5042 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "coro_only_destroy_when_complete"},
5043 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::coro_only_destroy_when_complete"},
5044 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::coro_only_destroy_when_complete"},
5045};
5046struct ParsedAttrInfoCoroOnlyDestroyWhenComplete final : public ParsedAttrInfo {
5047 constexpr ParsedAttrInfoCoroOnlyDestroyWhenComplete() : ParsedAttrInfo(
5048 /*AttrKind=*/ParsedAttr::AT_CoroOnlyDestroyWhenComplete,
5049 /*NumArgs=*/0,
5050 /*OptArgs=*/0,
5051 /*NumArgMembers=*/0,
5052 /*HasCustomParsing=*/0,
5053 /*AcceptsExprPack=*/0,
5054 /*IsTargetSpecific=*/0,
5055 /*IsType=*/0,
5056 /*IsStmt=*/0,
5057 /*IsKnownToGCC=*/0,
5058 /*IsSupportedByPragmaAttribute=*/1,
5059 /*Spellings=*/CoroOnlyDestroyWhenCompleteSpellings,
5060 /*ArgNames=*/{}) {}
5061bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5062 if (!isa<CXXRecordDecl>(Val: D)) {
5063 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5064 << Attr << Attr.isRegularKeywordAttribute() << "classes";
5065 return false;
5066 }
5067 return true;
5068}
5069
5070bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5071 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5072 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5073 return false;
5074}
5075
5076bool acceptsLangOpts(const LangOptions &LangOpts) const override {
5077 return LangOpts.CPlusPlus;
5078}
5079
5080void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5081 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
5082}
5083
5084AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
5085 D->addAttr(A: ::new (S.Context) CoroOnlyDestroyWhenCompleteAttr(S.Context, Attr));
5086 return AttributeApplied;
5087}
5088
5089bool isParamExpr(size_t N) const override {
5090 return false;
5091}
5092
5093static const ParsedAttrInfoCoroOnlyDestroyWhenComplete Instance;
5094};
5095const ParsedAttrInfoCoroOnlyDestroyWhenComplete ParsedAttrInfoCoroOnlyDestroyWhenComplete::Instance;
5096static constexpr ParsedAttrInfo::Spelling CoroReturnTypeSpellings[] = {
5097 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "coro_return_type"},
5098 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::coro_return_type"},
5099 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::coro_return_type"},
5100};
5101struct ParsedAttrInfoCoroReturnType final : public ParsedAttrInfo {
5102 constexpr ParsedAttrInfoCoroReturnType() : ParsedAttrInfo(
5103 /*AttrKind=*/ParsedAttr::AT_CoroReturnType,
5104 /*NumArgs=*/0,
5105 /*OptArgs=*/0,
5106 /*NumArgMembers=*/0,
5107 /*HasCustomParsing=*/0,
5108 /*AcceptsExprPack=*/0,
5109 /*IsTargetSpecific=*/0,
5110 /*IsType=*/0,
5111 /*IsStmt=*/0,
5112 /*IsKnownToGCC=*/0,
5113 /*IsSupportedByPragmaAttribute=*/1,
5114 /*Spellings=*/CoroReturnTypeSpellings,
5115 /*ArgNames=*/{}) {}
5116bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5117 if (!isa<CXXRecordDecl>(Val: D)) {
5118 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5119 << Attr << Attr.isRegularKeywordAttribute() << "classes";
5120 return false;
5121 }
5122 return true;
5123}
5124
5125bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5126 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5127 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5128 return false;
5129}
5130
5131bool acceptsLangOpts(const LangOptions &LangOpts) const override {
5132 return LangOpts.CPlusPlus;
5133}
5134
5135void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5136 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
5137}
5138
5139AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
5140 D->addAttr(A: ::new (S.Context) CoroReturnTypeAttr(S.Context, Attr));
5141 return AttributeApplied;
5142}
5143
5144bool isParamExpr(size_t N) const override {
5145 return false;
5146}
5147
5148static const ParsedAttrInfoCoroReturnType Instance;
5149};
5150const ParsedAttrInfoCoroReturnType ParsedAttrInfoCoroReturnType::Instance;
5151static constexpr ParsedAttrInfo::Spelling CoroWrapperSpellings[] = {
5152 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "coro_wrapper"},
5153 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::coro_wrapper"},
5154 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::coro_wrapper"},
5155};
5156struct ParsedAttrInfoCoroWrapper final : public ParsedAttrInfo {
5157 constexpr ParsedAttrInfoCoroWrapper() : ParsedAttrInfo(
5158 /*AttrKind=*/ParsedAttr::AT_CoroWrapper,
5159 /*NumArgs=*/0,
5160 /*OptArgs=*/0,
5161 /*NumArgMembers=*/0,
5162 /*HasCustomParsing=*/0,
5163 /*AcceptsExprPack=*/0,
5164 /*IsTargetSpecific=*/0,
5165 /*IsType=*/0,
5166 /*IsStmt=*/0,
5167 /*IsKnownToGCC=*/0,
5168 /*IsSupportedByPragmaAttribute=*/1,
5169 /*Spellings=*/CoroWrapperSpellings,
5170 /*ArgNames=*/{}) {}
5171bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5172 if (!isa<FunctionDecl>(Val: D)) {
5173 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5174 << Attr << Attr.isRegularKeywordAttribute() << "functions";
5175 return false;
5176 }
5177 return true;
5178}
5179
5180bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5181 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5182 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5183 return false;
5184}
5185
5186bool acceptsLangOpts(const LangOptions &LangOpts) const override {
5187 return LangOpts.CPlusPlus;
5188}
5189
5190void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5191 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
5192}
5193
5194AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
5195 D->addAttr(A: ::new (S.Context) CoroWrapperAttr(S.Context, Attr));
5196 return AttributeApplied;
5197}
5198
5199bool isParamExpr(size_t N) const override {
5200 return false;
5201}
5202
5203static const ParsedAttrInfoCoroWrapper Instance;
5204};
5205const ParsedAttrInfoCoroWrapper ParsedAttrInfoCoroWrapper::Instance;
5206static constexpr ParsedAttrInfo::Spelling CountedBySpellings[] = {
5207 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "counted_by"},
5208 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::counted_by"},
5209 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::counted_by"},
5210};
5211static constexpr const char *CountedByArgNames[] = {
5212"Count","NestedLevel",};
5213struct ParsedAttrInfoCountedBy final : public ParsedAttrInfo {
5214 constexpr ParsedAttrInfoCountedBy() : ParsedAttrInfo(
5215 /*AttrKind=*/ParsedAttr::AT_CountedBy,
5216 /*NumArgs=*/1,
5217 /*OptArgs=*/1,
5218 /*NumArgMembers=*/2,
5219 /*HasCustomParsing=*/0,
5220 /*AcceptsExprPack=*/0,
5221 /*IsTargetSpecific=*/0,
5222 /*IsType=*/1,
5223 /*IsStmt=*/0,
5224 /*IsKnownToGCC=*/0,
5225 /*IsSupportedByPragmaAttribute=*/0,
5226 /*Spellings=*/CountedBySpellings,
5227 /*ArgNames=*/CountedByArgNames) {}
5228bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5229 if (!isa<FieldDecl>(Val: D)) {
5230 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
5231 << Attr << Attr.isRegularKeywordAttribute() << "non-static data members";
5232 return false;
5233 }
5234 return true;
5235}
5236
5237bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5238 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5239 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5240 return false;
5241}
5242
5243bool acceptsLangOpts(const LangOptions &LangOpts) const override {
5244 return (!LangOpts.CPlusPlus);
5245}
5246
5247bool isParamExpr(size_t N) const override {
5248 return (N == 0) || false;
5249}
5250
5251static const ParsedAttrInfoCountedBy Instance;
5252};
5253const ParsedAttrInfoCountedBy ParsedAttrInfoCountedBy::Instance;
5254static constexpr ParsedAttrInfo::Spelling CountedByOrNullSpellings[] = {
5255 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "counted_by_or_null"},
5256 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::counted_by_or_null"},
5257 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::counted_by_or_null"},
5258};
5259static constexpr const char *CountedByOrNullArgNames[] = {
5260"Count","NestedLevel",};
5261struct ParsedAttrInfoCountedByOrNull final : public ParsedAttrInfo {
5262 constexpr ParsedAttrInfoCountedByOrNull() : ParsedAttrInfo(
5263 /*AttrKind=*/ParsedAttr::AT_CountedByOrNull,
5264 /*NumArgs=*/1,
5265 /*OptArgs=*/1,
5266 /*NumArgMembers=*/2,
5267 /*HasCustomParsing=*/0,
5268 /*AcceptsExprPack=*/0,
5269 /*IsTargetSpecific=*/0,
5270 /*IsType=*/1,
5271 /*IsStmt=*/0,
5272 /*IsKnownToGCC=*/0,
5273 /*IsSupportedByPragmaAttribute=*/0,
5274 /*Spellings=*/CountedByOrNullSpellings,
5275 /*ArgNames=*/CountedByOrNullArgNames) {}
5276bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5277 if (!isa<FieldDecl>(Val: D)) {
5278 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
5279 << Attr << Attr.isRegularKeywordAttribute() << "non-static data members";
5280 return false;
5281 }
5282 return true;
5283}
5284
5285bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5286 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5287 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5288 return false;
5289}
5290
5291bool acceptsLangOpts(const LangOptions &LangOpts) const override {
5292 return (!LangOpts.CPlusPlus);
5293}
5294
5295bool isParamExpr(size_t N) const override {
5296 return (N == 0) || false;
5297}
5298
5299static const ParsedAttrInfoCountedByOrNull Instance;
5300};
5301const ParsedAttrInfoCountedByOrNull ParsedAttrInfoCountedByOrNull::Instance;
5302static constexpr ParsedAttrInfo::Spelling DLLExportSpellings[] = {
5303 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "dllexport"},
5304 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "dllexport"},
5305 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::dllexport"},
5306 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::dllexport"},
5307};
5308struct ParsedAttrInfoDLLExport final : public ParsedAttrInfo {
5309 constexpr ParsedAttrInfoDLLExport() : ParsedAttrInfo(
5310 /*AttrKind=*/ParsedAttr::AT_DLLExport,
5311 /*NumArgs=*/0,
5312 /*OptArgs=*/0,
5313 /*NumArgMembers=*/0,
5314 /*HasCustomParsing=*/0,
5315 /*AcceptsExprPack=*/0,
5316 /*IsTargetSpecific=*/1,
5317 /*IsType=*/0,
5318 /*IsStmt=*/0,
5319 /*IsKnownToGCC=*/1,
5320 /*IsSupportedByPragmaAttribute=*/1,
5321 /*Spellings=*/DLLExportSpellings,
5322 /*ArgNames=*/{}) {}
5323bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5324 if (!isa<FunctionDecl>(Val: D) && !isa<VarDecl>(Val: D) && !isa<CXXRecordDecl>(Val: D) && !isa<ObjCInterfaceDecl>(Val: D)) {
5325 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5326 << Attr << Attr.isRegularKeywordAttribute() << "functions, variables, classes, and Objective-C interfaces";
5327 return false;
5328 }
5329 return true;
5330}
5331
5332bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5333 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5334 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5335 return false;
5336}
5337
5338bool existsInTarget(const TargetInfo &Target) const override {
5339 const llvm::Triple &T = Target.getTriple(); (void)T;
5340 return true && ( Target.getTriple().hasDLLImportExport() );
5341}
5342
5343void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5344 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
5345 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
5346 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
5347 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
5348}
5349
5350bool isParamExpr(size_t N) const override {
5351 return false;
5352}
5353
5354static const ParsedAttrInfoDLLExport Instance;
5355};
5356const ParsedAttrInfoDLLExport ParsedAttrInfoDLLExport::Instance;
5357struct ParsedAttrInfoDLLExportStaticLocal final : public ParsedAttrInfo {
5358 constexpr ParsedAttrInfoDLLExportStaticLocal() : ParsedAttrInfo(
5359 /*AttrKind=*/ParsedAttr::AT_DLLExportStaticLocal,
5360 /*NumArgs=*/0,
5361 /*OptArgs=*/0,
5362 /*NumArgMembers=*/0,
5363 /*HasCustomParsing=*/0,
5364 /*AcceptsExprPack=*/0,
5365 /*IsTargetSpecific=*/1,
5366 /*IsType=*/0,
5367 /*IsStmt=*/0,
5368 /*IsKnownToGCC=*/0,
5369 /*IsSupportedByPragmaAttribute=*/0,
5370 /*Spellings=*/{},
5371 /*ArgNames=*/{}) {}
5372bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5373 if (!isa<FunctionDecl>(Val: D)) {
5374 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5375 << Attr << Attr.isRegularKeywordAttribute() << "functions";
5376 return false;
5377 }
5378 return true;
5379}
5380
5381bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5382 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5383 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5384 return false;
5385}
5386
5387bool existsInTarget(const TargetInfo &Target) const override {
5388 const llvm::Triple &T = Target.getTriple(); (void)T;
5389 return true && ( Target.getTriple().hasDLLImportExport() );
5390}
5391
5392bool isParamExpr(size_t N) const override {
5393 return false;
5394}
5395
5396static const ParsedAttrInfoDLLExportStaticLocal Instance;
5397};
5398const ParsedAttrInfoDLLExportStaticLocal ParsedAttrInfoDLLExportStaticLocal::Instance;
5399static constexpr ParsedAttrInfo::Spelling DLLImportSpellings[] = {
5400 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "dllimport"},
5401 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "dllimport"},
5402 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::dllimport"},
5403 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::dllimport"},
5404};
5405struct ParsedAttrInfoDLLImport final : public ParsedAttrInfo {
5406 constexpr ParsedAttrInfoDLLImport() : ParsedAttrInfo(
5407 /*AttrKind=*/ParsedAttr::AT_DLLImport,
5408 /*NumArgs=*/0,
5409 /*OptArgs=*/0,
5410 /*NumArgMembers=*/0,
5411 /*HasCustomParsing=*/0,
5412 /*AcceptsExprPack=*/0,
5413 /*IsTargetSpecific=*/1,
5414 /*IsType=*/0,
5415 /*IsStmt=*/0,
5416 /*IsKnownToGCC=*/1,
5417 /*IsSupportedByPragmaAttribute=*/1,
5418 /*Spellings=*/DLLImportSpellings,
5419 /*ArgNames=*/{}) {}
5420bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5421 if (!isa<FunctionDecl>(Val: D) && !isa<VarDecl>(Val: D) && !isa<CXXRecordDecl>(Val: D) && !isa<ObjCInterfaceDecl>(Val: D)) {
5422 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5423 << Attr << Attr.isRegularKeywordAttribute() << "functions, variables, classes, and Objective-C interfaces";
5424 return false;
5425 }
5426 return true;
5427}
5428
5429bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5430 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5431 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5432 return false;
5433}
5434
5435bool existsInTarget(const TargetInfo &Target) const override {
5436 const llvm::Triple &T = Target.getTriple(); (void)T;
5437 return true && ( Target.getTriple().hasDLLImportExport() );
5438}
5439
5440void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5441 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
5442 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
5443 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
5444 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
5445}
5446
5447bool isParamExpr(size_t N) const override {
5448 return false;
5449}
5450
5451static const ParsedAttrInfoDLLImport Instance;
5452};
5453const ParsedAttrInfoDLLImport ParsedAttrInfoDLLImport::Instance;
5454struct ParsedAttrInfoDLLImportStaticLocal final : public ParsedAttrInfo {
5455 constexpr ParsedAttrInfoDLLImportStaticLocal() : ParsedAttrInfo(
5456 /*AttrKind=*/ParsedAttr::AT_DLLImportStaticLocal,
5457 /*NumArgs=*/0,
5458 /*OptArgs=*/0,
5459 /*NumArgMembers=*/0,
5460 /*HasCustomParsing=*/0,
5461 /*AcceptsExprPack=*/0,
5462 /*IsTargetSpecific=*/1,
5463 /*IsType=*/0,
5464 /*IsStmt=*/0,
5465 /*IsKnownToGCC=*/0,
5466 /*IsSupportedByPragmaAttribute=*/0,
5467 /*Spellings=*/{},
5468 /*ArgNames=*/{}) {}
5469bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5470 if (!isa<FunctionDecl>(Val: D)) {
5471 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5472 << Attr << Attr.isRegularKeywordAttribute() << "functions";
5473 return false;
5474 }
5475 return true;
5476}
5477
5478bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5479 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5480 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5481 return false;
5482}
5483
5484bool existsInTarget(const TargetInfo &Target) const override {
5485 const llvm::Triple &T = Target.getTriple(); (void)T;
5486 return true && ( Target.getTriple().hasDLLImportExport() );
5487}
5488
5489bool isParamExpr(size_t N) const override {
5490 return false;
5491}
5492
5493static const ParsedAttrInfoDLLImportStaticLocal Instance;
5494};
5495const ParsedAttrInfoDLLImportStaticLocal ParsedAttrInfoDLLImportStaticLocal::Instance;
5496static constexpr ParsedAttrInfo::Spelling DeprecatedSpellings[] = {
5497 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "deprecated"},
5498 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::deprecated"},
5499 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::deprecated"},
5500 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "deprecated"},
5501 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "deprecated"},
5502 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "deprecated"},
5503};
5504static constexpr const char *DeprecatedArgNames[] = {
5505"Message","Replacement",};
5506struct ParsedAttrInfoDeprecated final : public ParsedAttrInfo {
5507 constexpr ParsedAttrInfoDeprecated() : ParsedAttrInfo(
5508 /*AttrKind=*/ParsedAttr::AT_Deprecated,
5509 /*NumArgs=*/0,
5510 /*OptArgs=*/2,
5511 /*NumArgMembers=*/2,
5512 /*HasCustomParsing=*/0,
5513 /*AcceptsExprPack=*/0,
5514 /*IsTargetSpecific=*/0,
5515 /*IsType=*/0,
5516 /*IsStmt=*/0,
5517 /*IsKnownToGCC=*/1,
5518 /*IsSupportedByPragmaAttribute=*/0,
5519 /*Spellings=*/DeprecatedSpellings,
5520 /*ArgNames=*/DeprecatedArgNames) {}
5521bool isParamExpr(size_t N) const override {
5522 return false;
5523}
5524
5525static const ParsedAttrInfoDeprecated Instance;
5526};
5527const ParsedAttrInfoDeprecated ParsedAttrInfoDeprecated::Instance;
5528static constexpr ParsedAttrInfo::Spelling DestructorSpellings[] = {
5529 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "destructor"},
5530 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::destructor"},
5531 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::destructor"},
5532};
5533static constexpr const char *DestructorArgNames[] = {
5534"Priority",};
5535struct ParsedAttrInfoDestructor final : public ParsedAttrInfo {
5536 constexpr ParsedAttrInfoDestructor() : ParsedAttrInfo(
5537 /*AttrKind=*/ParsedAttr::AT_Destructor,
5538 /*NumArgs=*/0,
5539 /*OptArgs=*/1,
5540 /*NumArgMembers=*/1,
5541 /*HasCustomParsing=*/0,
5542 /*AcceptsExprPack=*/0,
5543 /*IsTargetSpecific=*/0,
5544 /*IsType=*/0,
5545 /*IsStmt=*/0,
5546 /*IsKnownToGCC=*/1,
5547 /*IsSupportedByPragmaAttribute=*/1,
5548 /*Spellings=*/DestructorSpellings,
5549 /*ArgNames=*/DestructorArgNames) {}
5550bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5551 if (!isa<FunctionDecl>(Val: D)) {
5552 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5553 << Attr << Attr.isRegularKeywordAttribute() << "functions";
5554 return false;
5555 }
5556 return true;
5557}
5558
5559bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5560 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5561 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5562 return false;
5563}
5564
5565void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5566 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
5567}
5568
5569bool isParamExpr(size_t N) const override {
5570 return false;
5571}
5572
5573static const ParsedAttrInfoDestructor Instance;
5574};
5575const ParsedAttrInfoDestructor ParsedAttrInfoDestructor::Instance;
5576static constexpr ParsedAttrInfo::Spelling DiagnoseAsBuiltinSpellings[] = {
5577 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "diagnose_as_builtin"},
5578 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::diagnose_as_builtin"},
5579 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::diagnose_as_builtin"},
5580};
5581static constexpr const char *DiagnoseAsBuiltinArgNames[] = {
5582"Function","ArgIndices...",};
5583struct ParsedAttrInfoDiagnoseAsBuiltin final : public ParsedAttrInfo {
5584 constexpr ParsedAttrInfoDiagnoseAsBuiltin() : ParsedAttrInfo(
5585 /*AttrKind=*/ParsedAttr::AT_DiagnoseAsBuiltin,
5586 /*NumArgs=*/1,
5587 /*OptArgs=*/15,
5588 /*NumArgMembers=*/2,
5589 /*HasCustomParsing=*/0,
5590 /*AcceptsExprPack=*/0,
5591 /*IsTargetSpecific=*/0,
5592 /*IsType=*/0,
5593 /*IsStmt=*/0,
5594 /*IsKnownToGCC=*/0,
5595 /*IsSupportedByPragmaAttribute=*/1,
5596 /*Spellings=*/DiagnoseAsBuiltinSpellings,
5597 /*ArgNames=*/DiagnoseAsBuiltinArgNames) {}
5598bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5599 if (!isa<FunctionDecl>(Val: D)) {
5600 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5601 << Attr << Attr.isRegularKeywordAttribute() << "functions";
5602 return false;
5603 }
5604 return true;
5605}
5606
5607bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5608 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5609 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5610 return false;
5611}
5612
5613void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5614 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
5615}
5616
5617bool isParamExpr(size_t N) const override {
5618 return false;
5619}
5620
5621static const ParsedAttrInfoDiagnoseAsBuiltin Instance;
5622};
5623const ParsedAttrInfoDiagnoseAsBuiltin ParsedAttrInfoDiagnoseAsBuiltin::Instance;
5624static constexpr ParsedAttrInfo::Spelling DiagnoseIfSpellings[] = {
5625 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "diagnose_if"},
5626};
5627static constexpr const char *DiagnoseIfArgNames[] = {
5628"Cond","Message","DiagnosticType",};
5629struct ParsedAttrInfoDiagnoseIf final : public ParsedAttrInfo {
5630 constexpr ParsedAttrInfoDiagnoseIf() : ParsedAttrInfo(
5631 /*AttrKind=*/ParsedAttr::AT_DiagnoseIf,
5632 /*NumArgs=*/3,
5633 /*OptArgs=*/0,
5634 /*NumArgMembers=*/3,
5635 /*HasCustomParsing=*/0,
5636 /*AcceptsExprPack=*/0,
5637 /*IsTargetSpecific=*/0,
5638 /*IsType=*/0,
5639 /*IsStmt=*/0,
5640 /*IsKnownToGCC=*/0,
5641 /*IsSupportedByPragmaAttribute=*/0,
5642 /*Spellings=*/DiagnoseIfSpellings,
5643 /*ArgNames=*/DiagnoseIfArgNames) {}
5644bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5645 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D) && !isa<ObjCPropertyDecl>(Val: D)) {
5646 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5647 << Attr << Attr.isRegularKeywordAttribute() << "functions, Objective-C methods, and Objective-C properties";
5648 return false;
5649 }
5650 return true;
5651}
5652
5653bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5654 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5655 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5656 return false;
5657}
5658
5659bool isParamExpr(size_t N) const override {
5660 return (N == 0) || false;
5661}
5662
5663static const ParsedAttrInfoDiagnoseIf Instance;
5664};
5665const ParsedAttrInfoDiagnoseIf ParsedAttrInfoDiagnoseIf::Instance;
5666static constexpr ParsedAttrInfo::Spelling DisableSanitizerInstrumentationSpellings[] = {
5667 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "disable_sanitizer_instrumentation"},
5668 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::disable_sanitizer_instrumentation"},
5669 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::disable_sanitizer_instrumentation"},
5670};
5671struct ParsedAttrInfoDisableSanitizerInstrumentation final : public ParsedAttrInfo {
5672 constexpr ParsedAttrInfoDisableSanitizerInstrumentation() : ParsedAttrInfo(
5673 /*AttrKind=*/ParsedAttr::AT_DisableSanitizerInstrumentation,
5674 /*NumArgs=*/0,
5675 /*OptArgs=*/0,
5676 /*NumArgMembers=*/0,
5677 /*HasCustomParsing=*/0,
5678 /*AcceptsExprPack=*/0,
5679 /*IsTargetSpecific=*/0,
5680 /*IsType=*/0,
5681 /*IsStmt=*/0,
5682 /*IsKnownToGCC=*/0,
5683 /*IsSupportedByPragmaAttribute=*/1,
5684 /*Spellings=*/DisableSanitizerInstrumentationSpellings,
5685 /*ArgNames=*/{}) {}
5686bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5687 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D) && !isGlobalVar(D)) {
5688 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5689 << Attr << Attr.isRegularKeywordAttribute() << "functions, Objective-C methods, and global variables";
5690 return false;
5691 }
5692 return true;
5693}
5694
5695bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5696 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5697 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5698 return false;
5699}
5700
5701void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5702 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
5703 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
5704 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/y: true));
5705}
5706
5707AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
5708 D->addAttr(A: ::new (S.Context) DisableSanitizerInstrumentationAttr(S.Context, Attr));
5709 return AttributeApplied;
5710}
5711
5712bool isParamExpr(size_t N) const override {
5713 return false;
5714}
5715
5716static const ParsedAttrInfoDisableSanitizerInstrumentation Instance;
5717};
5718const ParsedAttrInfoDisableSanitizerInstrumentation ParsedAttrInfoDisableSanitizerInstrumentation::Instance;
5719static constexpr ParsedAttrInfo::Spelling DisableTailCallsSpellings[] = {
5720 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "disable_tail_calls"},
5721 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::disable_tail_calls"},
5722 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::disable_tail_calls"},
5723};
5724struct ParsedAttrInfoDisableTailCalls final : public ParsedAttrInfo {
5725 constexpr ParsedAttrInfoDisableTailCalls() : ParsedAttrInfo(
5726 /*AttrKind=*/ParsedAttr::AT_DisableTailCalls,
5727 /*NumArgs=*/0,
5728 /*OptArgs=*/0,
5729 /*NumArgMembers=*/0,
5730 /*HasCustomParsing=*/0,
5731 /*AcceptsExprPack=*/0,
5732 /*IsTargetSpecific=*/0,
5733 /*IsType=*/0,
5734 /*IsStmt=*/0,
5735 /*IsKnownToGCC=*/0,
5736 /*IsSupportedByPragmaAttribute=*/1,
5737 /*Spellings=*/DisableTailCallsSpellings,
5738 /*ArgNames=*/{}) {}
5739bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5740 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
5741 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5742 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
5743 return false;
5744 }
5745 return true;
5746}
5747
5748bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5749 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5750 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5751 return false;
5752}
5753
5754 using ParsedAttrInfo::diagMutualExclusion;
5755
5756 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
5757 if (const auto *A = D->getAttr<NakedAttr>()) {
5758 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
5759 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
5760return false;
5761 }
5762 return true;
5763 }
5764
5765void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5766 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
5767 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
5768}
5769
5770AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
5771 D->addAttr(A: ::new (S.Context) DisableTailCallsAttr(S.Context, Attr));
5772 return AttributeApplied;
5773}
5774
5775bool isParamExpr(size_t N) const override {
5776 return false;
5777}
5778
5779static const ParsedAttrInfoDisableTailCalls Instance;
5780};
5781const ParsedAttrInfoDisableTailCalls ParsedAttrInfoDisableTailCalls::Instance;
5782static constexpr ParsedAttrInfo::Spelling EmptyBasesSpellings[] = {
5783 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "empty_bases"},
5784};
5785struct ParsedAttrInfoEmptyBases final : public ParsedAttrInfo {
5786 constexpr ParsedAttrInfoEmptyBases() : ParsedAttrInfo(
5787 /*AttrKind=*/ParsedAttr::AT_EmptyBases,
5788 /*NumArgs=*/0,
5789 /*OptArgs=*/0,
5790 /*NumArgMembers=*/0,
5791 /*HasCustomParsing=*/0,
5792 /*AcceptsExprPack=*/0,
5793 /*IsTargetSpecific=*/1,
5794 /*IsType=*/0,
5795 /*IsStmt=*/0,
5796 /*IsKnownToGCC=*/0,
5797 /*IsSupportedByPragmaAttribute=*/0,
5798 /*Spellings=*/EmptyBasesSpellings,
5799 /*ArgNames=*/{}) {}
5800bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5801 if (!isa<CXXRecordDecl>(Val: D)) {
5802 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5803 << Attr << Attr.isRegularKeywordAttribute() << "classes";
5804 return false;
5805 }
5806 return true;
5807}
5808
5809bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5810 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5811 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5812 return false;
5813}
5814
5815bool existsInTarget(const TargetInfo &Target) const override {
5816 const llvm::Triple &T = Target.getTriple(); (void)T;
5817 return true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64 || T.getArch() == llvm::Triple::arm || T.getArch() == llvm::Triple::thumb || T.getArch() == llvm::Triple::aarch64) && ( Target.getCXXABI().isMicrosoft() );
5818}
5819
5820AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
5821 D->addAttr(A: ::new (S.Context) EmptyBasesAttr(S.Context, Attr));
5822 return AttributeApplied;
5823}
5824
5825bool isParamExpr(size_t N) const override {
5826 return false;
5827}
5828
5829static const ParsedAttrInfoEmptyBases Instance;
5830};
5831const ParsedAttrInfoEmptyBases ParsedAttrInfoEmptyBases::Instance;
5832static constexpr ParsedAttrInfo::Spelling EnableIfSpellings[] = {
5833 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "enable_if"},
5834};
5835static constexpr const char *EnableIfArgNames[] = {
5836"Cond","Message",};
5837struct ParsedAttrInfoEnableIf final : public ParsedAttrInfo {
5838 constexpr ParsedAttrInfoEnableIf() : ParsedAttrInfo(
5839 /*AttrKind=*/ParsedAttr::AT_EnableIf,
5840 /*NumArgs=*/2,
5841 /*OptArgs=*/0,
5842 /*NumArgMembers=*/2,
5843 /*HasCustomParsing=*/0,
5844 /*AcceptsExprPack=*/0,
5845 /*IsTargetSpecific=*/0,
5846 /*IsType=*/0,
5847 /*IsStmt=*/0,
5848 /*IsKnownToGCC=*/0,
5849 /*IsSupportedByPragmaAttribute=*/1,
5850 /*Spellings=*/EnableIfSpellings,
5851 /*ArgNames=*/EnableIfArgNames) {}
5852bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5853 if (!isa<FunctionDecl>(Val: D)) {
5854 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5855 << Attr << Attr.isRegularKeywordAttribute() << "functions";
5856 return false;
5857 }
5858 return true;
5859}
5860
5861bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5862 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5863 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5864 return false;
5865}
5866
5867void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5868 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
5869}
5870
5871bool isParamExpr(size_t N) const override {
5872 return (N == 0) || false;
5873}
5874
5875static const ParsedAttrInfoEnableIf Instance;
5876};
5877const ParsedAttrInfoEnableIf ParsedAttrInfoEnableIf::Instance;
5878static constexpr ParsedAttrInfo::Spelling EnforceTCBSpellings[] = {
5879 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "enforce_tcb"},
5880 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::enforce_tcb"},
5881 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::enforce_tcb"},
5882};
5883static constexpr const char *EnforceTCBArgNames[] = {
5884"TCBName",};
5885struct ParsedAttrInfoEnforceTCB final : public ParsedAttrInfo {
5886 constexpr ParsedAttrInfoEnforceTCB() : ParsedAttrInfo(
5887 /*AttrKind=*/ParsedAttr::AT_EnforceTCB,
5888 /*NumArgs=*/1,
5889 /*OptArgs=*/0,
5890 /*NumArgMembers=*/1,
5891 /*HasCustomParsing=*/0,
5892 /*AcceptsExprPack=*/0,
5893 /*IsTargetSpecific=*/0,
5894 /*IsType=*/0,
5895 /*IsStmt=*/0,
5896 /*IsKnownToGCC=*/0,
5897 /*IsSupportedByPragmaAttribute=*/1,
5898 /*Spellings=*/EnforceTCBSpellings,
5899 /*ArgNames=*/EnforceTCBArgNames) {}
5900bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5901 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
5902 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5903 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
5904 return false;
5905 }
5906 return true;
5907}
5908
5909bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5910 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5911 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5912 return false;
5913}
5914
5915void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5916 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
5917 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
5918}
5919
5920bool isParamExpr(size_t N) const override {
5921 return false;
5922}
5923
5924static const ParsedAttrInfoEnforceTCB Instance;
5925};
5926const ParsedAttrInfoEnforceTCB ParsedAttrInfoEnforceTCB::Instance;
5927static constexpr ParsedAttrInfo::Spelling EnforceTCBLeafSpellings[] = {
5928 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "enforce_tcb_leaf"},
5929 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::enforce_tcb_leaf"},
5930 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::enforce_tcb_leaf"},
5931};
5932static constexpr const char *EnforceTCBLeafArgNames[] = {
5933"TCBName",};
5934struct ParsedAttrInfoEnforceTCBLeaf final : public ParsedAttrInfo {
5935 constexpr ParsedAttrInfoEnforceTCBLeaf() : ParsedAttrInfo(
5936 /*AttrKind=*/ParsedAttr::AT_EnforceTCBLeaf,
5937 /*NumArgs=*/1,
5938 /*OptArgs=*/0,
5939 /*NumArgMembers=*/1,
5940 /*HasCustomParsing=*/0,
5941 /*AcceptsExprPack=*/0,
5942 /*IsTargetSpecific=*/0,
5943 /*IsType=*/0,
5944 /*IsStmt=*/0,
5945 /*IsKnownToGCC=*/0,
5946 /*IsSupportedByPragmaAttribute=*/1,
5947 /*Spellings=*/EnforceTCBLeafSpellings,
5948 /*ArgNames=*/EnforceTCBLeafArgNames) {}
5949bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5950 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
5951 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
5952 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
5953 return false;
5954 }
5955 return true;
5956}
5957
5958bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
5959 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
5960 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
5961 return false;
5962}
5963
5964void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
5965 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
5966 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
5967}
5968
5969bool isParamExpr(size_t N) const override {
5970 return false;
5971}
5972
5973static const ParsedAttrInfoEnforceTCBLeaf Instance;
5974};
5975const ParsedAttrInfoEnforceTCBLeaf ParsedAttrInfoEnforceTCBLeaf::Instance;
5976static constexpr ParsedAttrInfo::Spelling EnumExtensibilitySpellings[] = {
5977 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "enum_extensibility"},
5978 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::enum_extensibility"},
5979 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::enum_extensibility"},
5980};
5981static constexpr const char *EnumExtensibilityArgNames[] = {
5982"Extensibility",};
5983struct ParsedAttrInfoEnumExtensibility final : public ParsedAttrInfo {
5984 constexpr ParsedAttrInfoEnumExtensibility() : ParsedAttrInfo(
5985 /*AttrKind=*/ParsedAttr::AT_EnumExtensibility,
5986 /*NumArgs=*/1,
5987 /*OptArgs=*/0,
5988 /*NumArgMembers=*/1,
5989 /*HasCustomParsing=*/0,
5990 /*AcceptsExprPack=*/0,
5991 /*IsTargetSpecific=*/0,
5992 /*IsType=*/0,
5993 /*IsStmt=*/0,
5994 /*IsKnownToGCC=*/0,
5995 /*IsSupportedByPragmaAttribute=*/1,
5996 /*Spellings=*/EnumExtensibilitySpellings,
5997 /*ArgNames=*/EnumExtensibilityArgNames) {}
5998bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
5999 if (!isa<EnumDecl>(Val: D)) {
6000 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6001 << Attr << Attr.isRegularKeywordAttribute() << "enums";
6002 return false;
6003 }
6004 return true;
6005}
6006
6007bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6008 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6009 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6010 return false;
6011}
6012
6013void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
6014 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_enum, /*IsSupported=*/y: true));
6015}
6016
6017bool isParamExpr(size_t N) const override {
6018 return false;
6019}
6020
6021static const ParsedAttrInfoEnumExtensibility Instance;
6022};
6023const ParsedAttrInfoEnumExtensibility ParsedAttrInfoEnumExtensibility::Instance;
6024static constexpr ParsedAttrInfo::Spelling ErrorSpellings[] = {
6025 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "error"},
6026 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::error"},
6027 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::error"},
6028 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "warning"},
6029 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::warning"},
6030 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::warning"},
6031};
6032static constexpr const char *ErrorArgNames[] = {
6033"UserDiagnostic",};
6034struct ParsedAttrInfoError final : public ParsedAttrInfo {
6035 constexpr ParsedAttrInfoError() : ParsedAttrInfo(
6036 /*AttrKind=*/ParsedAttr::AT_Error,
6037 /*NumArgs=*/1,
6038 /*OptArgs=*/0,
6039 /*NumArgMembers=*/1,
6040 /*HasCustomParsing=*/0,
6041 /*AcceptsExprPack=*/0,
6042 /*IsTargetSpecific=*/0,
6043 /*IsType=*/0,
6044 /*IsStmt=*/0,
6045 /*IsKnownToGCC=*/1,
6046 /*IsSupportedByPragmaAttribute=*/1,
6047 /*Spellings=*/ErrorSpellings,
6048 /*ArgNames=*/ErrorArgNames) {}
6049bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6050 if (!isa<FunctionDecl>(Val: D)) {
6051 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
6052 << Attr << Attr.isRegularKeywordAttribute() << "functions";
6053 return false;
6054 }
6055 return true;
6056}
6057
6058bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6059 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6060 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6061 return false;
6062}
6063
6064unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
6065 enum Spelling {
6066 GNU_error = 0,
6067 CXX11_gnu_error = 1,
6068 C23_gnu_error = 2,
6069 GNU_warning = 3,
6070 CXX11_gnu_warning = 4,
6071 C23_gnu_warning = 5,
6072 SpellingNotCalculated = 15
6073
6074 };
6075
6076 unsigned Idx = Attr.getAttributeSpellingListIndex();
6077 switch (Idx) {
6078 default: llvm_unreachable("Unknown spelling list index");
6079 case 0: return GNU_error;
6080 case 1: return CXX11_gnu_error;
6081 case 2: return C23_gnu_error;
6082 case 3: return GNU_warning;
6083 case 4: return CXX11_gnu_warning;
6084 case 5: return C23_gnu_warning;
6085 }
6086}
6087
6088void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
6089 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
6090}
6091
6092bool isParamExpr(size_t N) const override {
6093 return false;
6094}
6095
6096static const ParsedAttrInfoError Instance;
6097};
6098const ParsedAttrInfoError ParsedAttrInfoError::Instance;
6099static constexpr ParsedAttrInfo::Spelling ExcludeFromExplicitInstantiationSpellings[] = {
6100 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "exclude_from_explicit_instantiation"},
6101 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::exclude_from_explicit_instantiation"},
6102 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::exclude_from_explicit_instantiation"},
6103};
6104struct ParsedAttrInfoExcludeFromExplicitInstantiation final : public ParsedAttrInfo {
6105 constexpr ParsedAttrInfoExcludeFromExplicitInstantiation() : ParsedAttrInfo(
6106 /*AttrKind=*/ParsedAttr::AT_ExcludeFromExplicitInstantiation,
6107 /*NumArgs=*/0,
6108 /*OptArgs=*/0,
6109 /*NumArgMembers=*/0,
6110 /*HasCustomParsing=*/0,
6111 /*AcceptsExprPack=*/0,
6112 /*IsTargetSpecific=*/0,
6113 /*IsType=*/0,
6114 /*IsStmt=*/0,
6115 /*IsKnownToGCC=*/0,
6116 /*IsSupportedByPragmaAttribute=*/1,
6117 /*Spellings=*/ExcludeFromExplicitInstantiationSpellings,
6118 /*ArgNames=*/{}) {}
6119bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6120 if (!isa<VarDecl>(Val: D) && !isa<FunctionDecl>(Val: D) && !isa<CXXRecordDecl>(Val: D)) {
6121 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6122 << Attr << Attr.isRegularKeywordAttribute() << "variables, functions, and classes";
6123 return false;
6124 }
6125 return true;
6126}
6127
6128bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6129 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6130 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6131 return false;
6132}
6133
6134void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
6135 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
6136 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
6137 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
6138}
6139
6140AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
6141 D->addAttr(A: ::new (S.Context) ExcludeFromExplicitInstantiationAttr(S.Context, Attr));
6142 return AttributeApplied;
6143}
6144
6145bool isParamExpr(size_t N) const override {
6146 return false;
6147}
6148
6149static const ParsedAttrInfoExcludeFromExplicitInstantiation Instance;
6150};
6151const ParsedAttrInfoExcludeFromExplicitInstantiation ParsedAttrInfoExcludeFromExplicitInstantiation::Instance;
6152static constexpr ParsedAttrInfo::Spelling ExclusiveTrylockFunctionSpellings[] = {
6153 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "exclusive_trylock_function"},
6154};
6155static constexpr const char *ExclusiveTrylockFunctionArgNames[] = {
6156"SuccessValue","Args...",};
6157struct ParsedAttrInfoExclusiveTrylockFunction final : public ParsedAttrInfo {
6158 constexpr ParsedAttrInfoExclusiveTrylockFunction() : ParsedAttrInfo(
6159 /*AttrKind=*/ParsedAttr::AT_ExclusiveTrylockFunction,
6160 /*NumArgs=*/1,
6161 /*OptArgs=*/15,
6162 /*NumArgMembers=*/2,
6163 /*HasCustomParsing=*/0,
6164 /*AcceptsExprPack=*/0,
6165 /*IsTargetSpecific=*/0,
6166 /*IsType=*/0,
6167 /*IsStmt=*/0,
6168 /*IsKnownToGCC=*/0,
6169 /*IsSupportedByPragmaAttribute=*/0,
6170 /*Spellings=*/ExclusiveTrylockFunctionSpellings,
6171 /*ArgNames=*/ExclusiveTrylockFunctionArgNames) {}
6172bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6173 if (!isa<FunctionDecl>(Val: D)) {
6174 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6175 << Attr << Attr.isRegularKeywordAttribute() << "functions";
6176 return false;
6177 }
6178 return true;
6179}
6180
6181bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6182 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6183 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6184 return false;
6185}
6186
6187bool isParamExpr(size_t N) const override {
6188 return (N == 0) || (N == 1) || false;
6189}
6190
6191static const ParsedAttrInfoExclusiveTrylockFunction Instance;
6192};
6193const ParsedAttrInfoExclusiveTrylockFunction ParsedAttrInfoExclusiveTrylockFunction::Instance;
6194static constexpr ParsedAttrInfo::Spelling ExtVectorTypeSpellings[] = {
6195 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ext_vector_type"},
6196};
6197static constexpr const char *ExtVectorTypeArgNames[] = {
6198"NumElements",};
6199struct ParsedAttrInfoExtVectorType final : public ParsedAttrInfo {
6200 constexpr ParsedAttrInfoExtVectorType() : ParsedAttrInfo(
6201 /*AttrKind=*/ParsedAttr::AT_ExtVectorType,
6202 /*NumArgs=*/1,
6203 /*OptArgs=*/0,
6204 /*NumArgMembers=*/1,
6205 /*HasCustomParsing=*/0,
6206 /*AcceptsExprPack=*/0,
6207 /*IsTargetSpecific=*/0,
6208 /*IsType=*/0,
6209 /*IsStmt=*/0,
6210 /*IsKnownToGCC=*/0,
6211 /*IsSupportedByPragmaAttribute=*/0,
6212 /*Spellings=*/ExtVectorTypeSpellings,
6213 /*ArgNames=*/ExtVectorTypeArgNames) {}
6214bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6215 if (!isa<TypedefNameDecl>(Val: D)) {
6216 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
6217 << Attr << Attr.isRegularKeywordAttribute() << "typedefs";
6218 return false;
6219 }
6220 return true;
6221}
6222
6223bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6224 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6225 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6226 return false;
6227}
6228
6229bool isParamExpr(size_t N) const override {
6230 return (N == 0) || false;
6231}
6232
6233static const ParsedAttrInfoExtVectorType Instance;
6234};
6235const ParsedAttrInfoExtVectorType ParsedAttrInfoExtVectorType::Instance;
6236static constexpr ParsedAttrInfo::Spelling ExternalSourceSymbolSpellings[] = {
6237 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "external_source_symbol"},
6238 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::external_source_symbol"},
6239 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::external_source_symbol"},
6240};
6241static constexpr const char *ExternalSourceSymbolArgNames[] = {
6242"language","definedIn","generatedDeclaration","USR",};
6243struct ParsedAttrInfoExternalSourceSymbol final : public ParsedAttrInfo {
6244 constexpr ParsedAttrInfoExternalSourceSymbol() : ParsedAttrInfo(
6245 /*AttrKind=*/ParsedAttr::AT_ExternalSourceSymbol,
6246 /*NumArgs=*/0,
6247 /*OptArgs=*/4,
6248 /*NumArgMembers=*/4,
6249 /*HasCustomParsing=*/1,
6250 /*AcceptsExprPack=*/0,
6251 /*IsTargetSpecific=*/0,
6252 /*IsType=*/0,
6253 /*IsStmt=*/0,
6254 /*IsKnownToGCC=*/0,
6255 /*IsSupportedByPragmaAttribute=*/1,
6256 /*Spellings=*/ExternalSourceSymbolSpellings,
6257 /*ArgNames=*/ExternalSourceSymbolArgNames) {}
6258bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6259 if (!isa<NamedDecl>(Val: D)) {
6260 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6261 << Attr << Attr.isRegularKeywordAttribute() << "named declarations";
6262 return false;
6263 }
6264 return true;
6265}
6266
6267bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6268 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6269 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6270 return false;
6271}
6272
6273void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
6274 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
6275 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_enum, /*IsSupported=*/y: true));
6276 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_enum_constant, /*IsSupported=*/y: true));
6277 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_field, /*IsSupported=*/y: true));
6278 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
6279 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_namespace, /*IsSupported=*/y: LangOpts.CPlusPlus));
6280 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_category, /*IsSupported=*/y: LangOpts.ObjC));
6281 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_implementation, /*IsSupported=*/y: LangOpts.ObjC));
6282 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
6283 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
6284 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_property, /*IsSupported=*/y: LangOpts.ObjC));
6285 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_protocol, /*IsSupported=*/y: LangOpts.ObjC));
6286 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
6287 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
6288 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
6289}
6290
6291bool isParamExpr(size_t N) const override {
6292 return false;
6293}
6294
6295static const ParsedAttrInfoExternalSourceSymbol Instance;
6296};
6297const ParsedAttrInfoExternalSourceSymbol ParsedAttrInfoExternalSourceSymbol::Instance;
6298static constexpr ParsedAttrInfo::Spelling FallThroughSpellings[] = {
6299 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "fallthrough"},
6300 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "fallthrough"},
6301 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::fallthrough"},
6302 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "fallthrough"},
6303 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::fallthrough"},
6304 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::fallthrough"},
6305};
6306struct ParsedAttrInfoFallThrough final : public ParsedAttrInfo {
6307 constexpr ParsedAttrInfoFallThrough() : ParsedAttrInfo(
6308 /*AttrKind=*/ParsedAttr::AT_FallThrough,
6309 /*NumArgs=*/0,
6310 /*OptArgs=*/0,
6311 /*NumArgMembers=*/0,
6312 /*HasCustomParsing=*/0,
6313 /*AcceptsExprPack=*/0,
6314 /*IsTargetSpecific=*/0,
6315 /*IsType=*/0,
6316 /*IsStmt=*/1,
6317 /*IsKnownToGCC=*/1,
6318 /*IsSupportedByPragmaAttribute=*/0,
6319 /*Spellings=*/FallThroughSpellings,
6320 /*ArgNames=*/{}) {}
6321bool diagAppertainsToDecl(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
6322 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attribute_invalid_on_decl)
6323 << AL << AL.isRegularKeywordAttribute() << D->getLocation();
6324 return false;
6325}
6326
6327bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
6328 if (!isa<NullStmt>(Val: St) && !isa<SwitchCase>(Val: St)) {
6329 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
6330 << Attr << Attr.isRegularKeywordAttribute() << "empty statements";
6331 return false;
6332 }
6333 return true;
6334}
6335
6336bool isParamExpr(size_t N) const override {
6337 return false;
6338}
6339
6340static const ParsedAttrInfoFallThrough Instance;
6341};
6342const ParsedAttrInfoFallThrough ParsedAttrInfoFallThrough::Instance;
6343static constexpr ParsedAttrInfo::Spelling FastCallSpellings[] = {
6344 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "fastcall"},
6345 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::fastcall"},
6346 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::fastcall"},
6347 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__fastcall"},
6348 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_fastcall"},
6349};
6350struct ParsedAttrInfoFastCall final : public ParsedAttrInfo {
6351 constexpr ParsedAttrInfoFastCall() : ParsedAttrInfo(
6352 /*AttrKind=*/ParsedAttr::AT_FastCall,
6353 /*NumArgs=*/0,
6354 /*OptArgs=*/0,
6355 /*NumArgMembers=*/0,
6356 /*HasCustomParsing=*/0,
6357 /*AcceptsExprPack=*/0,
6358 /*IsTargetSpecific=*/0,
6359 /*IsType=*/1,
6360 /*IsStmt=*/0,
6361 /*IsKnownToGCC=*/1,
6362 /*IsSupportedByPragmaAttribute=*/0,
6363 /*Spellings=*/FastCallSpellings,
6364 /*ArgNames=*/{}) {}
6365bool isParamExpr(size_t N) const override {
6366 return false;
6367}
6368
6369static const ParsedAttrInfoFastCall Instance;
6370};
6371const ParsedAttrInfoFastCall ParsedAttrInfoFastCall::Instance;
6372static constexpr ParsedAttrInfo::Spelling FlagEnumSpellings[] = {
6373 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "flag_enum"},
6374 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::flag_enum"},
6375 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::flag_enum"},
6376};
6377struct ParsedAttrInfoFlagEnum final : public ParsedAttrInfo {
6378 constexpr ParsedAttrInfoFlagEnum() : ParsedAttrInfo(
6379 /*AttrKind=*/ParsedAttr::AT_FlagEnum,
6380 /*NumArgs=*/0,
6381 /*OptArgs=*/0,
6382 /*NumArgMembers=*/0,
6383 /*HasCustomParsing=*/0,
6384 /*AcceptsExprPack=*/0,
6385 /*IsTargetSpecific=*/0,
6386 /*IsType=*/0,
6387 /*IsStmt=*/0,
6388 /*IsKnownToGCC=*/0,
6389 /*IsSupportedByPragmaAttribute=*/1,
6390 /*Spellings=*/FlagEnumSpellings,
6391 /*ArgNames=*/{}) {}
6392bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6393 if (!isa<EnumDecl>(Val: D)) {
6394 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6395 << Attr << Attr.isRegularKeywordAttribute() << "enums";
6396 return false;
6397 }
6398 return true;
6399}
6400
6401bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6402 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6403 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6404 return false;
6405}
6406
6407void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
6408 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_enum, /*IsSupported=*/y: true));
6409}
6410
6411AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
6412 D->addAttr(A: ::new (S.Context) FlagEnumAttr(S.Context, Attr));
6413 return AttributeApplied;
6414}
6415
6416bool isParamExpr(size_t N) const override {
6417 return false;
6418}
6419
6420static const ParsedAttrInfoFlagEnum Instance;
6421};
6422const ParsedAttrInfoFlagEnum ParsedAttrInfoFlagEnum::Instance;
6423static constexpr ParsedAttrInfo::Spelling FlattenSpellings[] = {
6424 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "flatten"},
6425 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::flatten"},
6426 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::flatten"},
6427};
6428struct ParsedAttrInfoFlatten final : public ParsedAttrInfo {
6429 constexpr ParsedAttrInfoFlatten() : ParsedAttrInfo(
6430 /*AttrKind=*/ParsedAttr::AT_Flatten,
6431 /*NumArgs=*/0,
6432 /*OptArgs=*/0,
6433 /*NumArgMembers=*/0,
6434 /*HasCustomParsing=*/0,
6435 /*AcceptsExprPack=*/0,
6436 /*IsTargetSpecific=*/0,
6437 /*IsType=*/0,
6438 /*IsStmt=*/0,
6439 /*IsKnownToGCC=*/1,
6440 /*IsSupportedByPragmaAttribute=*/1,
6441 /*Spellings=*/FlattenSpellings,
6442 /*ArgNames=*/{}) {}
6443bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6444 if (!isa<FunctionDecl>(Val: D)) {
6445 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
6446 << Attr << Attr.isRegularKeywordAttribute() << "functions";
6447 return false;
6448 }
6449 return true;
6450}
6451
6452bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6453 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6454 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6455 return false;
6456}
6457
6458void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
6459 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
6460}
6461
6462AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
6463 D->addAttr(A: ::new (S.Context) FlattenAttr(S.Context, Attr));
6464 return AttributeApplied;
6465}
6466
6467bool isParamExpr(size_t N) const override {
6468 return false;
6469}
6470
6471static const ParsedAttrInfoFlatten Instance;
6472};
6473const ParsedAttrInfoFlatten ParsedAttrInfoFlatten::Instance;
6474static constexpr ParsedAttrInfo::Spelling FormatSpellings[] = {
6475 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "format"},
6476 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::format"},
6477 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::format"},
6478};
6479static constexpr const char *FormatArgNames[] = {
6480"Type","FormatIdx","FirstArg",};
6481struct ParsedAttrInfoFormat final : public ParsedAttrInfo {
6482 constexpr ParsedAttrInfoFormat() : ParsedAttrInfo(
6483 /*AttrKind=*/ParsedAttr::AT_Format,
6484 /*NumArgs=*/3,
6485 /*OptArgs=*/0,
6486 /*NumArgMembers=*/3,
6487 /*HasCustomParsing=*/0,
6488 /*AcceptsExprPack=*/0,
6489 /*IsTargetSpecific=*/0,
6490 /*IsType=*/0,
6491 /*IsStmt=*/0,
6492 /*IsKnownToGCC=*/1,
6493 /*IsSupportedByPragmaAttribute=*/0,
6494 /*Spellings=*/FormatSpellings,
6495 /*ArgNames=*/FormatArgNames) {}
6496bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6497 if (!isa<ObjCMethodDecl>(Val: D) && !isa<BlockDecl>(Val: D) && !isHasFunctionProto(D)) {
6498 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6499 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods, blocks, and non-K&R-style functions";
6500 return false;
6501 }
6502 return true;
6503}
6504
6505bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6506 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6507 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6508 return false;
6509}
6510
6511bool isParamExpr(size_t N) const override {
6512 return false;
6513}
6514
6515static const ParsedAttrInfoFormat Instance;
6516};
6517const ParsedAttrInfoFormat ParsedAttrInfoFormat::Instance;
6518static constexpr ParsedAttrInfo::Spelling FormatArgSpellings[] = {
6519 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "format_arg"},
6520 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::format_arg"},
6521 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::format_arg"},
6522};
6523static constexpr const char *FormatArgArgNames[] = {
6524"FormatIdx",};
6525struct ParsedAttrInfoFormatArg final : public ParsedAttrInfo {
6526 constexpr ParsedAttrInfoFormatArg() : ParsedAttrInfo(
6527 /*AttrKind=*/ParsedAttr::AT_FormatArg,
6528 /*NumArgs=*/1,
6529 /*OptArgs=*/0,
6530 /*NumArgMembers=*/1,
6531 /*HasCustomParsing=*/0,
6532 /*AcceptsExprPack=*/0,
6533 /*IsTargetSpecific=*/0,
6534 /*IsType=*/0,
6535 /*IsStmt=*/0,
6536 /*IsKnownToGCC=*/1,
6537 /*IsSupportedByPragmaAttribute=*/0,
6538 /*Spellings=*/FormatArgSpellings,
6539 /*ArgNames=*/FormatArgArgNames) {}
6540bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6541 if (!isa<ObjCMethodDecl>(Val: D) && !isHasFunctionProto(D)) {
6542 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6543 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods and non-K&R-style functions";
6544 return false;
6545 }
6546 return true;
6547}
6548
6549bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6550 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6551 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6552 return false;
6553}
6554
6555bool isParamExpr(size_t N) const override {
6556 return false;
6557}
6558
6559static const ParsedAttrInfoFormatArg Instance;
6560};
6561const ParsedAttrInfoFormatArg ParsedAttrInfoFormatArg::Instance;
6562static constexpr ParsedAttrInfo::Spelling FunctionReturnThunksSpellings[] = {
6563 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "function_return"},
6564 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::function_return"},
6565 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::function_return"},
6566};
6567static constexpr const char *FunctionReturnThunksArgNames[] = {
6568"ThunkType",};
6569struct ParsedAttrInfoFunctionReturnThunks final : public ParsedAttrInfo {
6570 constexpr ParsedAttrInfoFunctionReturnThunks() : ParsedAttrInfo(
6571 /*AttrKind=*/ParsedAttr::AT_FunctionReturnThunks,
6572 /*NumArgs=*/1,
6573 /*OptArgs=*/0,
6574 /*NumArgMembers=*/1,
6575 /*HasCustomParsing=*/0,
6576 /*AcceptsExprPack=*/0,
6577 /*IsTargetSpecific=*/1,
6578 /*IsType=*/0,
6579 /*IsStmt=*/0,
6580 /*IsKnownToGCC=*/1,
6581 /*IsSupportedByPragmaAttribute=*/1,
6582 /*Spellings=*/FunctionReturnThunksSpellings,
6583 /*ArgNames=*/FunctionReturnThunksArgNames) {}
6584bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6585 if (!isa<FunctionDecl>(Val: D)) {
6586 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6587 << Attr << Attr.isRegularKeywordAttribute() << "functions";
6588 return false;
6589 }
6590 return true;
6591}
6592
6593bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6594 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6595 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6596 return false;
6597}
6598
6599bool existsInTarget(const TargetInfo &Target) const override {
6600 const llvm::Triple &T = Target.getTriple(); (void)T;
6601 return true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64);
6602}
6603
6604void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
6605 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
6606}
6607
6608bool isParamExpr(size_t N) const override {
6609 return false;
6610}
6611
6612static const ParsedAttrInfoFunctionReturnThunks Instance;
6613};
6614const ParsedAttrInfoFunctionReturnThunks ParsedAttrInfoFunctionReturnThunks::Instance;
6615static constexpr ParsedAttrInfo::Spelling GNUInlineSpellings[] = {
6616 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "gnu_inline"},
6617 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::gnu_inline"},
6618 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::gnu_inline"},
6619};
6620struct ParsedAttrInfoGNUInline final : public ParsedAttrInfo {
6621 constexpr ParsedAttrInfoGNUInline() : ParsedAttrInfo(
6622 /*AttrKind=*/ParsedAttr::AT_GNUInline,
6623 /*NumArgs=*/0,
6624 /*OptArgs=*/0,
6625 /*NumArgMembers=*/0,
6626 /*HasCustomParsing=*/0,
6627 /*AcceptsExprPack=*/0,
6628 /*IsTargetSpecific=*/0,
6629 /*IsType=*/0,
6630 /*IsStmt=*/0,
6631 /*IsKnownToGCC=*/1,
6632 /*IsSupportedByPragmaAttribute=*/1,
6633 /*Spellings=*/GNUInlineSpellings,
6634 /*ArgNames=*/{}) {}
6635bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6636 if (!isa<FunctionDecl>(Val: D)) {
6637 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6638 << Attr << Attr.isRegularKeywordAttribute() << "functions";
6639 return false;
6640 }
6641 return true;
6642}
6643
6644bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6645 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6646 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6647 return false;
6648}
6649
6650void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
6651 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
6652}
6653
6654bool isParamExpr(size_t N) const override {
6655 return false;
6656}
6657
6658static const ParsedAttrInfoGNUInline Instance;
6659};
6660const ParsedAttrInfoGNUInline ParsedAttrInfoGNUInline::Instance;
6661static constexpr ParsedAttrInfo::Spelling GuardedBySpellings[] = {
6662 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "guarded_by"},
6663};
6664static constexpr const char *GuardedByArgNames[] = {
6665"Arg",};
6666struct ParsedAttrInfoGuardedBy final : public ParsedAttrInfo {
6667 constexpr ParsedAttrInfoGuardedBy() : ParsedAttrInfo(
6668 /*AttrKind=*/ParsedAttr::AT_GuardedBy,
6669 /*NumArgs=*/1,
6670 /*OptArgs=*/0,
6671 /*NumArgMembers=*/1,
6672 /*HasCustomParsing=*/0,
6673 /*AcceptsExprPack=*/0,
6674 /*IsTargetSpecific=*/0,
6675 /*IsType=*/0,
6676 /*IsStmt=*/0,
6677 /*IsKnownToGCC=*/0,
6678 /*IsSupportedByPragmaAttribute=*/0,
6679 /*Spellings=*/GuardedBySpellings,
6680 /*ArgNames=*/GuardedByArgNames) {}
6681bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6682 if (!isa<FieldDecl>(Val: D) && !isSharedVar(D)) {
6683 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6684 << Attr << Attr.isRegularKeywordAttribute() << "non-static data members and global variables";
6685 return false;
6686 }
6687 return true;
6688}
6689
6690bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6691 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6692 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6693 return false;
6694}
6695
6696bool isParamExpr(size_t N) const override {
6697 return (N == 0) || false;
6698}
6699
6700static const ParsedAttrInfoGuardedBy Instance;
6701};
6702const ParsedAttrInfoGuardedBy ParsedAttrInfoGuardedBy::Instance;
6703static constexpr ParsedAttrInfo::Spelling GuardedVarSpellings[] = {
6704 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "guarded_var"},
6705 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::guarded_var"},
6706};
6707struct ParsedAttrInfoGuardedVar final : public ParsedAttrInfo {
6708 constexpr ParsedAttrInfoGuardedVar() : ParsedAttrInfo(
6709 /*AttrKind=*/ParsedAttr::AT_GuardedVar,
6710 /*NumArgs=*/0,
6711 /*OptArgs=*/0,
6712 /*NumArgMembers=*/0,
6713 /*HasCustomParsing=*/0,
6714 /*AcceptsExprPack=*/0,
6715 /*IsTargetSpecific=*/0,
6716 /*IsType=*/0,
6717 /*IsStmt=*/0,
6718 /*IsKnownToGCC=*/0,
6719 /*IsSupportedByPragmaAttribute=*/0,
6720 /*Spellings=*/GuardedVarSpellings,
6721 /*ArgNames=*/{}) {}
6722bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6723 if (!isa<FieldDecl>(Val: D) && !isSharedVar(D)) {
6724 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6725 << Attr << Attr.isRegularKeywordAttribute() << "non-static data members and global variables";
6726 return false;
6727 }
6728 return true;
6729}
6730
6731bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6732 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6733 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6734 return false;
6735}
6736
6737AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
6738 D->addAttr(A: ::new (S.Context) GuardedVarAttr(S.Context, Attr));
6739 return AttributeApplied;
6740}
6741
6742bool isParamExpr(size_t N) const override {
6743 return false;
6744}
6745
6746static const ParsedAttrInfoGuardedVar Instance;
6747};
6748const ParsedAttrInfoGuardedVar ParsedAttrInfoGuardedVar::Instance;
6749static constexpr ParsedAttrInfo::Spelling HIPManagedSpellings[] = {
6750 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "managed"},
6751 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "__managed__"},
6752};
6753struct ParsedAttrInfoHIPManaged final : public ParsedAttrInfo {
6754 constexpr ParsedAttrInfoHIPManaged() : ParsedAttrInfo(
6755 /*AttrKind=*/ParsedAttr::AT_HIPManaged,
6756 /*NumArgs=*/0,
6757 /*OptArgs=*/0,
6758 /*NumArgMembers=*/0,
6759 /*HasCustomParsing=*/0,
6760 /*AcceptsExprPack=*/0,
6761 /*IsTargetSpecific=*/0,
6762 /*IsType=*/0,
6763 /*IsStmt=*/0,
6764 /*IsKnownToGCC=*/0,
6765 /*IsSupportedByPragmaAttribute=*/1,
6766 /*Spellings=*/HIPManagedSpellings,
6767 /*ArgNames=*/{}) {}
6768bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6769 if (!isa<VarDecl>(Val: D)) {
6770 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6771 << Attr << Attr.isRegularKeywordAttribute() << "variables";
6772 return false;
6773 }
6774 return true;
6775}
6776
6777bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6778 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6779 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6780 return false;
6781}
6782
6783 using ParsedAttrInfo::diagMutualExclusion;
6784
6785 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
6786 if (const auto *A = D->getAttr<CUDAConstantAttr>()) {
6787 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
6788 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
6789return false;
6790 }
6791 if (const auto *A = D->getAttr<CUDASharedAttr>()) {
6792 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
6793 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
6794return false;
6795 }
6796 return true;
6797 }
6798
6799bool acceptsLangOpts(const LangOptions &LangOpts) const override {
6800 return LangOpts.HIP;
6801}
6802
6803void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
6804 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
6805}
6806
6807bool isParamExpr(size_t N) const override {
6808 return false;
6809}
6810
6811static const ParsedAttrInfoHIPManaged Instance;
6812};
6813const ParsedAttrInfoHIPManaged ParsedAttrInfoHIPManaged::Instance;
6814static constexpr ParsedAttrInfo::Spelling HLSLGroupSharedAddressSpaceSpellings[] = {
6815 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "groupshared"},
6816};
6817struct ParsedAttrInfoHLSLGroupSharedAddressSpace final : public ParsedAttrInfo {
6818 constexpr ParsedAttrInfoHLSLGroupSharedAddressSpace() : ParsedAttrInfo(
6819 /*AttrKind=*/ParsedAttr::AT_HLSLGroupSharedAddressSpace,
6820 /*NumArgs=*/0,
6821 /*OptArgs=*/0,
6822 /*NumArgMembers=*/0,
6823 /*HasCustomParsing=*/0,
6824 /*AcceptsExprPack=*/0,
6825 /*IsTargetSpecific=*/0,
6826 /*IsType=*/1,
6827 /*IsStmt=*/0,
6828 /*IsKnownToGCC=*/0,
6829 /*IsSupportedByPragmaAttribute=*/0,
6830 /*Spellings=*/HLSLGroupSharedAddressSpaceSpellings,
6831 /*ArgNames=*/{}) {}
6832bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6833 if (!isa<VarDecl>(Val: D)) {
6834 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6835 << Attr << Attr.isRegularKeywordAttribute() << "variables";
6836 return false;
6837 }
6838 return true;
6839}
6840
6841bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6842 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6843 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6844 return false;
6845}
6846
6847bool isParamExpr(size_t N) const override {
6848 return false;
6849}
6850
6851static const ParsedAttrInfoHLSLGroupSharedAddressSpace Instance;
6852};
6853const ParsedAttrInfoHLSLGroupSharedAddressSpace ParsedAttrInfoHLSLGroupSharedAddressSpace::Instance;
6854static constexpr ParsedAttrInfo::Spelling HLSLLoopHintSpellings[] = {
6855 {.Syntax: AttributeCommonInfo::AS_Microsoft, .NormalizedFullName: "unroll"},
6856 {.Syntax: AttributeCommonInfo::AS_Microsoft, .NormalizedFullName: "loop"},
6857};
6858static constexpr const char *HLSLLoopHintArgNames[] = {
6859"directive",};
6860struct ParsedAttrInfoHLSLLoopHint final : public ParsedAttrInfo {
6861 constexpr ParsedAttrInfoHLSLLoopHint() : ParsedAttrInfo(
6862 /*AttrKind=*/ParsedAttr::AT_HLSLLoopHint,
6863 /*NumArgs=*/0,
6864 /*OptArgs=*/1,
6865 /*NumArgMembers=*/1,
6866 /*HasCustomParsing=*/0,
6867 /*AcceptsExprPack=*/0,
6868 /*IsTargetSpecific=*/0,
6869 /*IsType=*/0,
6870 /*IsStmt=*/1,
6871 /*IsKnownToGCC=*/0,
6872 /*IsSupportedByPragmaAttribute=*/0,
6873 /*Spellings=*/HLSLLoopHintSpellings,
6874 /*ArgNames=*/HLSLLoopHintArgNames) {}
6875bool diagAppertainsToDecl(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
6876 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attribute_invalid_on_decl)
6877 << AL << AL.isRegularKeywordAttribute() << D->getLocation();
6878 return false;
6879}
6880
6881bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
6882 if (!isa<ForStmt>(Val: St) && !isa<WhileStmt>(Val: St) && !isa<DoStmt>(Val: St)) {
6883 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
6884 << Attr << Attr.isRegularKeywordAttribute() << "'for', 'while', and 'do' statements";
6885 return false;
6886 }
6887 return true;
6888}
6889
6890bool acceptsLangOpts(const LangOptions &LangOpts) const override {
6891 return LangOpts.HLSL;
6892}
6893
6894unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
6895 enum Spelling {
6896 Microsoft_unroll = 0,
6897 Microsoft_loop = 1,
6898 SpellingNotCalculated = 15
6899
6900 };
6901
6902 unsigned Idx = Attr.getAttributeSpellingListIndex();
6903 switch (Idx) {
6904 default: llvm_unreachable("Unknown spelling list index");
6905 case 0: return Microsoft_unroll;
6906 case 1: return Microsoft_loop;
6907 }
6908}
6909
6910bool isParamExpr(size_t N) const override {
6911 return false;
6912}
6913
6914static const ParsedAttrInfoHLSLLoopHint Instance;
6915};
6916const ParsedAttrInfoHLSLLoopHint ParsedAttrInfoHLSLLoopHint::Instance;
6917static constexpr ParsedAttrInfo::Spelling HLSLNumThreadsSpellings[] = {
6918 {.Syntax: AttributeCommonInfo::AS_Microsoft, .NormalizedFullName: "numthreads"},
6919};
6920static constexpr const char *HLSLNumThreadsArgNames[] = {
6921"X","Y","Z",};
6922struct ParsedAttrInfoHLSLNumThreads final : public ParsedAttrInfo {
6923 constexpr ParsedAttrInfoHLSLNumThreads() : ParsedAttrInfo(
6924 /*AttrKind=*/ParsedAttr::AT_HLSLNumThreads,
6925 /*NumArgs=*/3,
6926 /*OptArgs=*/0,
6927 /*NumArgMembers=*/3,
6928 /*HasCustomParsing=*/0,
6929 /*AcceptsExprPack=*/0,
6930 /*IsTargetSpecific=*/0,
6931 /*IsType=*/0,
6932 /*IsStmt=*/0,
6933 /*IsKnownToGCC=*/0,
6934 /*IsSupportedByPragmaAttribute=*/0,
6935 /*Spellings=*/HLSLNumThreadsSpellings,
6936 /*ArgNames=*/HLSLNumThreadsArgNames) {}
6937bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
6938 if (!isHLSLEntry(D)) {
6939 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
6940 << Attr << Attr.isRegularKeywordAttribute() << "global functions";
6941 return false;
6942 }
6943 return true;
6944}
6945
6946bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
6947 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
6948 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
6949 return false;
6950}
6951
6952bool acceptsLangOpts(const LangOptions &LangOpts) const override {
6953 return LangOpts.HLSL;
6954}
6955
6956bool isParamExpr(size_t N) const override {
6957 return false;
6958}
6959
6960static const ParsedAttrInfoHLSLNumThreads Instance;
6961};
6962const ParsedAttrInfoHLSLNumThreads ParsedAttrInfoHLSLNumThreads::Instance;
6963static constexpr ParsedAttrInfo::Spelling HLSLPackOffsetSpellings[] = {
6964 {.Syntax: AttributeCommonInfo::AS_HLSLAnnotation, .NormalizedFullName: "packoffset"},
6965};
6966static constexpr const char *HLSLPackOffsetArgNames[] = {
6967"Subcomponent","Component",};
6968struct ParsedAttrInfoHLSLPackOffset final : public ParsedAttrInfo {
6969 constexpr ParsedAttrInfoHLSLPackOffset() : ParsedAttrInfo(
6970 /*AttrKind=*/ParsedAttr::AT_HLSLPackOffset,
6971 /*NumArgs=*/2,
6972 /*OptArgs=*/0,
6973 /*NumArgMembers=*/2,
6974 /*HasCustomParsing=*/0,
6975 /*AcceptsExprPack=*/0,
6976 /*IsTargetSpecific=*/0,
6977 /*IsType=*/0,
6978 /*IsStmt=*/0,
6979 /*IsKnownToGCC=*/0,
6980 /*IsSupportedByPragmaAttribute=*/0,
6981 /*Spellings=*/HLSLPackOffsetSpellings,
6982 /*ArgNames=*/HLSLPackOffsetArgNames) {}
6983bool acceptsLangOpts(const LangOptions &LangOpts) const override {
6984 return LangOpts.HLSL;
6985}
6986
6987bool isParamExpr(size_t N) const override {
6988 return false;
6989}
6990
6991static const ParsedAttrInfoHLSLPackOffset Instance;
6992};
6993const ParsedAttrInfoHLSLPackOffset ParsedAttrInfoHLSLPackOffset::Instance;
6994static constexpr ParsedAttrInfo::Spelling HLSLParamModifierSpellings[] = {
6995 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "in"},
6996 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "inout"},
6997 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "out"},
6998};
6999struct ParsedAttrInfoHLSLParamModifier final : public ParsedAttrInfo {
7000 constexpr ParsedAttrInfoHLSLParamModifier() : ParsedAttrInfo(
7001 /*AttrKind=*/ParsedAttr::AT_HLSLParamModifier,
7002 /*NumArgs=*/0,
7003 /*OptArgs=*/0,
7004 /*NumArgMembers=*/0,
7005 /*HasCustomParsing=*/0,
7006 /*AcceptsExprPack=*/0,
7007 /*IsTargetSpecific=*/0,
7008 /*IsType=*/1,
7009 /*IsStmt=*/0,
7010 /*IsKnownToGCC=*/0,
7011 /*IsSupportedByPragmaAttribute=*/0,
7012 /*Spellings=*/HLSLParamModifierSpellings,
7013 /*ArgNames=*/{}) {}
7014bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7015 if (!isa<ParmVarDecl>(Val: D)) {
7016 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7017 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
7018 return false;
7019 }
7020 return true;
7021}
7022
7023bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7024 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7025 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7026 return false;
7027}
7028
7029unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
7030 enum Spelling {
7031 Keyword_in = 0,
7032 Keyword_inout = 1,
7033 Keyword_out = 2,
7034 SpellingNotCalculated = 15
7035
7036 };
7037
7038 unsigned Idx = Attr.getAttributeSpellingListIndex();
7039 switch (Idx) {
7040 default: llvm_unreachable("Unknown spelling list index");
7041 case 0: return Keyword_in;
7042 case 1: return Keyword_inout;
7043 case 2: return Keyword_out;
7044 }
7045}
7046
7047bool isParamExpr(size_t N) const override {
7048 return false;
7049}
7050
7051static const ParsedAttrInfoHLSLParamModifier Instance;
7052};
7053const ParsedAttrInfoHLSLParamModifier ParsedAttrInfoHLSLParamModifier::Instance;
7054static constexpr const char *HLSLResourceArgNames[] = {
7055"ResourceKind","isROV",};
7056struct ParsedAttrInfoHLSLResource final : public ParsedAttrInfo {
7057 constexpr ParsedAttrInfoHLSLResource() : ParsedAttrInfo(
7058 /*AttrKind=*/ParsedAttr::AT_HLSLResource,
7059 /*NumArgs=*/1,
7060 /*OptArgs=*/1,
7061 /*NumArgMembers=*/2,
7062 /*HasCustomParsing=*/0,
7063 /*AcceptsExprPack=*/0,
7064 /*IsTargetSpecific=*/0,
7065 /*IsType=*/0,
7066 /*IsStmt=*/0,
7067 /*IsKnownToGCC=*/0,
7068 /*IsSupportedByPragmaAttribute=*/0,
7069 /*Spellings=*/{},
7070 /*ArgNames=*/HLSLResourceArgNames) {}
7071bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7072 if (!isStruct(D)) {
7073 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7074 << Attr << Attr.isRegularKeywordAttribute() << "structs";
7075 return false;
7076 }
7077 return true;
7078}
7079
7080bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7081 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7082 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7083 return false;
7084}
7085
7086bool acceptsLangOpts(const LangOptions &LangOpts) const override {
7087 return LangOpts.HLSL;
7088}
7089
7090bool isParamExpr(size_t N) const override {
7091 return false;
7092}
7093
7094static const ParsedAttrInfoHLSLResource Instance;
7095};
7096const ParsedAttrInfoHLSLResource ParsedAttrInfoHLSLResource::Instance;
7097static constexpr ParsedAttrInfo::Spelling HLSLResourceBindingSpellings[] = {
7098 {.Syntax: AttributeCommonInfo::AS_HLSLAnnotation, .NormalizedFullName: "register"},
7099};
7100static constexpr const char *HLSLResourceBindingArgNames[] = {
7101"Slot","Space",};
7102struct ParsedAttrInfoHLSLResourceBinding final : public ParsedAttrInfo {
7103 constexpr ParsedAttrInfoHLSLResourceBinding() : ParsedAttrInfo(
7104 /*AttrKind=*/ParsedAttr::AT_HLSLResourceBinding,
7105 /*NumArgs=*/1,
7106 /*OptArgs=*/1,
7107 /*NumArgMembers=*/2,
7108 /*HasCustomParsing=*/0,
7109 /*AcceptsExprPack=*/0,
7110 /*IsTargetSpecific=*/0,
7111 /*IsType=*/0,
7112 /*IsStmt=*/0,
7113 /*IsKnownToGCC=*/0,
7114 /*IsSupportedByPragmaAttribute=*/0,
7115 /*Spellings=*/HLSLResourceBindingSpellings,
7116 /*ArgNames=*/HLSLResourceBindingArgNames) {}
7117bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7118 if (!isHLSLBufferObj(D) && !isExternalGlobalVar(D)) {
7119 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7120 << Attr << Attr.isRegularKeywordAttribute() << "cbuffer/tbuffer and external global variables";
7121 return false;
7122 }
7123 return true;
7124}
7125
7126bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7127 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7128 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7129 return false;
7130}
7131
7132bool acceptsLangOpts(const LangOptions &LangOpts) const override {
7133 return LangOpts.HLSL;
7134}
7135
7136bool isParamExpr(size_t N) const override {
7137 return false;
7138}
7139
7140static const ParsedAttrInfoHLSLResourceBinding Instance;
7141};
7142const ParsedAttrInfoHLSLResourceBinding ParsedAttrInfoHLSLResourceBinding::Instance;
7143static constexpr ParsedAttrInfo::Spelling HLSLResourceClassSpellings[] = {
7144 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "hlsl::resource_class"},
7145};
7146static constexpr const char *HLSLResourceClassArgNames[] = {
7147"ResourceClass",};
7148struct ParsedAttrInfoHLSLResourceClass final : public ParsedAttrInfo {
7149 constexpr ParsedAttrInfoHLSLResourceClass() : ParsedAttrInfo(
7150 /*AttrKind=*/ParsedAttr::AT_HLSLResourceClass,
7151 /*NumArgs=*/1,
7152 /*OptArgs=*/0,
7153 /*NumArgMembers=*/1,
7154 /*HasCustomParsing=*/0,
7155 /*AcceptsExprPack=*/0,
7156 /*IsTargetSpecific=*/0,
7157 /*IsType=*/0,
7158 /*IsStmt=*/0,
7159 /*IsKnownToGCC=*/0,
7160 /*IsSupportedByPragmaAttribute=*/1,
7161 /*Spellings=*/HLSLResourceClassSpellings,
7162 /*ArgNames=*/HLSLResourceClassArgNames) {}
7163bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7164 if (!isStruct(D)) {
7165 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7166 << Attr << Attr.isRegularKeywordAttribute() << "structs";
7167 return false;
7168 }
7169 return true;
7170}
7171
7172bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7173 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7174 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7175 return false;
7176}
7177
7178bool acceptsLangOpts(const LangOptions &LangOpts) const override {
7179 return LangOpts.HLSL;
7180}
7181
7182void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
7183 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record_not_is_union, /*IsSupported=*/y: true));
7184}
7185
7186bool isParamExpr(size_t N) const override {
7187 return false;
7188}
7189
7190static const ParsedAttrInfoHLSLResourceClass Instance;
7191};
7192const ParsedAttrInfoHLSLResourceClass ParsedAttrInfoHLSLResourceClass::Instance;
7193static constexpr ParsedAttrInfo::Spelling HLSLSV_DispatchThreadIDSpellings[] = {
7194 {.Syntax: AttributeCommonInfo::AS_HLSLAnnotation, .NormalizedFullName: "SV_DispatchThreadID"},
7195};
7196struct ParsedAttrInfoHLSLSV_DispatchThreadID final : public ParsedAttrInfo {
7197 constexpr ParsedAttrInfoHLSLSV_DispatchThreadID() : ParsedAttrInfo(
7198 /*AttrKind=*/ParsedAttr::AT_HLSLSV_DispatchThreadID,
7199 /*NumArgs=*/0,
7200 /*OptArgs=*/0,
7201 /*NumArgMembers=*/0,
7202 /*HasCustomParsing=*/0,
7203 /*AcceptsExprPack=*/0,
7204 /*IsTargetSpecific=*/0,
7205 /*IsType=*/0,
7206 /*IsStmt=*/0,
7207 /*IsKnownToGCC=*/0,
7208 /*IsSupportedByPragmaAttribute=*/0,
7209 /*Spellings=*/HLSLSV_DispatchThreadIDSpellings,
7210 /*ArgNames=*/{}) {}
7211bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7212 if (!isa<ParmVarDecl>(Val: D) && !isa<FieldDecl>(Val: D)) {
7213 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7214 << Attr << Attr.isRegularKeywordAttribute() << "parameters and non-static data members";
7215 return false;
7216 }
7217 return true;
7218}
7219
7220bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7221 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7222 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7223 return false;
7224}
7225
7226bool acceptsLangOpts(const LangOptions &LangOpts) const override {
7227 return LangOpts.HLSL;
7228}
7229
7230bool isParamExpr(size_t N) const override {
7231 return false;
7232}
7233
7234static const ParsedAttrInfoHLSLSV_DispatchThreadID Instance;
7235};
7236const ParsedAttrInfoHLSLSV_DispatchThreadID ParsedAttrInfoHLSLSV_DispatchThreadID::Instance;
7237static constexpr ParsedAttrInfo::Spelling HLSLSV_GroupIndexSpellings[] = {
7238 {.Syntax: AttributeCommonInfo::AS_HLSLAnnotation, .NormalizedFullName: "SV_GroupIndex"},
7239};
7240struct ParsedAttrInfoHLSLSV_GroupIndex final : public ParsedAttrInfo {
7241 constexpr ParsedAttrInfoHLSLSV_GroupIndex() : ParsedAttrInfo(
7242 /*AttrKind=*/ParsedAttr::AT_HLSLSV_GroupIndex,
7243 /*NumArgs=*/0,
7244 /*OptArgs=*/0,
7245 /*NumArgMembers=*/0,
7246 /*HasCustomParsing=*/0,
7247 /*AcceptsExprPack=*/0,
7248 /*IsTargetSpecific=*/0,
7249 /*IsType=*/0,
7250 /*IsStmt=*/0,
7251 /*IsKnownToGCC=*/0,
7252 /*IsSupportedByPragmaAttribute=*/0,
7253 /*Spellings=*/HLSLSV_GroupIndexSpellings,
7254 /*ArgNames=*/{}) {}
7255bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7256 if (!isa<ParmVarDecl>(Val: D) && !isGlobalVar(D)) {
7257 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7258 << Attr << Attr.isRegularKeywordAttribute() << "parameters and global variables";
7259 return false;
7260 }
7261 return true;
7262}
7263
7264bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7265 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7266 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7267 return false;
7268}
7269
7270bool acceptsLangOpts(const LangOptions &LangOpts) const override {
7271 return LangOpts.HLSL;
7272}
7273
7274bool isParamExpr(size_t N) const override {
7275 return false;
7276}
7277
7278static const ParsedAttrInfoHLSLSV_GroupIndex Instance;
7279};
7280const ParsedAttrInfoHLSLSV_GroupIndex ParsedAttrInfoHLSLSV_GroupIndex::Instance;
7281static constexpr ParsedAttrInfo::Spelling HLSLShaderSpellings[] = {
7282 {.Syntax: AttributeCommonInfo::AS_Microsoft, .NormalizedFullName: "shader"},
7283};
7284static constexpr const char *HLSLShaderArgNames[] = {
7285"Type",};
7286struct ParsedAttrInfoHLSLShader final : public ParsedAttrInfo {
7287 constexpr ParsedAttrInfoHLSLShader() : ParsedAttrInfo(
7288 /*AttrKind=*/ParsedAttr::AT_HLSLShader,
7289 /*NumArgs=*/1,
7290 /*OptArgs=*/0,
7291 /*NumArgMembers=*/1,
7292 /*HasCustomParsing=*/0,
7293 /*AcceptsExprPack=*/0,
7294 /*IsTargetSpecific=*/0,
7295 /*IsType=*/0,
7296 /*IsStmt=*/0,
7297 /*IsKnownToGCC=*/0,
7298 /*IsSupportedByPragmaAttribute=*/0,
7299 /*Spellings=*/HLSLShaderSpellings,
7300 /*ArgNames=*/HLSLShaderArgNames) {}
7301bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7302 if (!isHLSLEntry(D)) {
7303 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7304 << Attr << Attr.isRegularKeywordAttribute() << "global functions";
7305 return false;
7306 }
7307 return true;
7308}
7309
7310bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7311 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7312 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7313 return false;
7314}
7315
7316bool acceptsLangOpts(const LangOptions &LangOpts) const override {
7317 return LangOpts.HLSL;
7318}
7319
7320bool isParamExpr(size_t N) const override {
7321 return false;
7322}
7323
7324static const ParsedAttrInfoHLSLShader Instance;
7325};
7326const ParsedAttrInfoHLSLShader ParsedAttrInfoHLSLShader::Instance;
7327static constexpr ParsedAttrInfo::Spelling HotSpellings[] = {
7328 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "hot"},
7329 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::hot"},
7330 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::hot"},
7331};
7332struct ParsedAttrInfoHot final : public ParsedAttrInfo {
7333 constexpr ParsedAttrInfoHot() : ParsedAttrInfo(
7334 /*AttrKind=*/ParsedAttr::AT_Hot,
7335 /*NumArgs=*/0,
7336 /*OptArgs=*/0,
7337 /*NumArgMembers=*/0,
7338 /*HasCustomParsing=*/0,
7339 /*AcceptsExprPack=*/0,
7340 /*IsTargetSpecific=*/0,
7341 /*IsType=*/0,
7342 /*IsStmt=*/0,
7343 /*IsKnownToGCC=*/1,
7344 /*IsSupportedByPragmaAttribute=*/1,
7345 /*Spellings=*/HotSpellings,
7346 /*ArgNames=*/{}) {}
7347bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7348 if (!isa<FunctionDecl>(Val: D)) {
7349 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7350 << Attr << Attr.isRegularKeywordAttribute() << "functions";
7351 return false;
7352 }
7353 return true;
7354}
7355
7356bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7357 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7358 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7359 return false;
7360}
7361
7362 using ParsedAttrInfo::diagMutualExclusion;
7363
7364 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
7365 if (const auto *A = D->getAttr<ColdAttr>()) {
7366 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
7367 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
7368return false;
7369 }
7370 return true;
7371 }
7372
7373void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
7374 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
7375}
7376
7377AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
7378 D->addAttr(A: ::new (S.Context) HotAttr(S.Context, Attr));
7379 return AttributeApplied;
7380}
7381
7382bool isParamExpr(size_t N) const override {
7383 return false;
7384}
7385
7386static const ParsedAttrInfoHot Instance;
7387};
7388const ParsedAttrInfoHot ParsedAttrInfoHot::Instance;
7389static constexpr ParsedAttrInfo::Spelling HybridPatchableSpellings[] = {
7390 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "hybrid_patchable"},
7391 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "hybrid_patchable"},
7392 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::hybrid_patchable"},
7393 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::hybrid_patchable"},
7394};
7395struct ParsedAttrInfoHybridPatchable final : public ParsedAttrInfo {
7396 constexpr ParsedAttrInfoHybridPatchable() : ParsedAttrInfo(
7397 /*AttrKind=*/ParsedAttr::AT_HybridPatchable,
7398 /*NumArgs=*/0,
7399 /*OptArgs=*/0,
7400 /*NumArgMembers=*/0,
7401 /*HasCustomParsing=*/0,
7402 /*AcceptsExprPack=*/0,
7403 /*IsTargetSpecific=*/1,
7404 /*IsType=*/0,
7405 /*IsStmt=*/0,
7406 /*IsKnownToGCC=*/0,
7407 /*IsSupportedByPragmaAttribute=*/1,
7408 /*Spellings=*/HybridPatchableSpellings,
7409 /*ArgNames=*/{}) {}
7410bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7411 if (!isa<FunctionDecl>(Val: D)) {
7412 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7413 << Attr << Attr.isRegularKeywordAttribute() << "functions";
7414 return false;
7415 }
7416 return true;
7417}
7418
7419bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7420 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7421 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7422 return false;
7423}
7424
7425bool existsInTarget(const TargetInfo &Target) const override {
7426 const llvm::Triple &T = Target.getTriple(); (void)T;
7427 return true && ( Target.getTriple().isWindowsArm64EC() );
7428}
7429
7430void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
7431 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
7432}
7433
7434bool isParamExpr(size_t N) const override {
7435 return false;
7436}
7437
7438static const ParsedAttrInfoHybridPatchable Instance;
7439};
7440const ParsedAttrInfoHybridPatchable ParsedAttrInfoHybridPatchable::Instance;
7441static constexpr ParsedAttrInfo::Spelling IBActionSpellings[] = {
7442 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ibaction"},
7443 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::ibaction"},
7444 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::ibaction"},
7445};
7446struct ParsedAttrInfoIBAction final : public ParsedAttrInfo {
7447 constexpr ParsedAttrInfoIBAction() : ParsedAttrInfo(
7448 /*AttrKind=*/ParsedAttr::AT_IBAction,
7449 /*NumArgs=*/0,
7450 /*OptArgs=*/0,
7451 /*NumArgMembers=*/0,
7452 /*HasCustomParsing=*/0,
7453 /*AcceptsExprPack=*/0,
7454 /*IsTargetSpecific=*/0,
7455 /*IsType=*/0,
7456 /*IsStmt=*/0,
7457 /*IsKnownToGCC=*/0,
7458 /*IsSupportedByPragmaAttribute=*/1,
7459 /*Spellings=*/IBActionSpellings,
7460 /*ArgNames=*/{}) {}
7461bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7462 if (!isObjCInstanceMethod(D)) {
7463 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7464 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C instance methods";
7465 return false;
7466 }
7467 return true;
7468}
7469
7470bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7471 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7472 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7473 return false;
7474}
7475
7476void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
7477 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method_is_instance, /*IsSupported=*/y: LangOpts.ObjC));
7478}
7479
7480AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
7481 D->addAttr(A: ::new (S.Context) IBActionAttr(S.Context, Attr));
7482 return AttributeApplied;
7483}
7484
7485bool isParamExpr(size_t N) const override {
7486 return false;
7487}
7488
7489static const ParsedAttrInfoIBAction Instance;
7490};
7491const ParsedAttrInfoIBAction ParsedAttrInfoIBAction::Instance;
7492static constexpr ParsedAttrInfo::Spelling IBOutletSpellings[] = {
7493 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "iboutlet"},
7494 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::iboutlet"},
7495 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::iboutlet"},
7496};
7497struct ParsedAttrInfoIBOutlet final : public ParsedAttrInfo {
7498 constexpr ParsedAttrInfoIBOutlet() : ParsedAttrInfo(
7499 /*AttrKind=*/ParsedAttr::AT_IBOutlet,
7500 /*NumArgs=*/0,
7501 /*OptArgs=*/0,
7502 /*NumArgMembers=*/0,
7503 /*HasCustomParsing=*/0,
7504 /*AcceptsExprPack=*/0,
7505 /*IsTargetSpecific=*/0,
7506 /*IsType=*/0,
7507 /*IsStmt=*/0,
7508 /*IsKnownToGCC=*/0,
7509 /*IsSupportedByPragmaAttribute=*/0,
7510 /*Spellings=*/IBOutletSpellings,
7511 /*ArgNames=*/{}) {}
7512bool isParamExpr(size_t N) const override {
7513 return false;
7514}
7515
7516static const ParsedAttrInfoIBOutlet Instance;
7517};
7518const ParsedAttrInfoIBOutlet ParsedAttrInfoIBOutlet::Instance;
7519static constexpr ParsedAttrInfo::Spelling IBOutletCollectionSpellings[] = {
7520 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "iboutletcollection"},
7521 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::iboutletcollection"},
7522 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::iboutletcollection"},
7523};
7524static constexpr const char *IBOutletCollectionArgNames[] = {
7525"Interface",};
7526struct ParsedAttrInfoIBOutletCollection final : public ParsedAttrInfo {
7527 constexpr ParsedAttrInfoIBOutletCollection() : ParsedAttrInfo(
7528 /*AttrKind=*/ParsedAttr::AT_IBOutletCollection,
7529 /*NumArgs=*/0,
7530 /*OptArgs=*/1,
7531 /*NumArgMembers=*/1,
7532 /*HasCustomParsing=*/0,
7533 /*AcceptsExprPack=*/0,
7534 /*IsTargetSpecific=*/0,
7535 /*IsType=*/0,
7536 /*IsStmt=*/0,
7537 /*IsKnownToGCC=*/0,
7538 /*IsSupportedByPragmaAttribute=*/0,
7539 /*Spellings=*/IBOutletCollectionSpellings,
7540 /*ArgNames=*/IBOutletCollectionArgNames) {}
7541bool isParamExpr(size_t N) const override {
7542 return false;
7543}
7544
7545static const ParsedAttrInfoIBOutletCollection Instance;
7546};
7547const ParsedAttrInfoIBOutletCollection ParsedAttrInfoIBOutletCollection::Instance;
7548static constexpr ParsedAttrInfo::Spelling IFuncSpellings[] = {
7549 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ifunc"},
7550 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::ifunc"},
7551 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::ifunc"},
7552};
7553static constexpr const char *IFuncArgNames[] = {
7554"Resolver",};
7555struct ParsedAttrInfoIFunc final : public ParsedAttrInfo {
7556 constexpr ParsedAttrInfoIFunc() : ParsedAttrInfo(
7557 /*AttrKind=*/ParsedAttr::AT_IFunc,
7558 /*NumArgs=*/1,
7559 /*OptArgs=*/0,
7560 /*NumArgMembers=*/1,
7561 /*HasCustomParsing=*/0,
7562 /*AcceptsExprPack=*/0,
7563 /*IsTargetSpecific=*/1,
7564 /*IsType=*/0,
7565 /*IsStmt=*/0,
7566 /*IsKnownToGCC=*/1,
7567 /*IsSupportedByPragmaAttribute=*/1,
7568 /*Spellings=*/IFuncSpellings,
7569 /*ArgNames=*/IFuncArgNames) {}
7570bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7571 if (!isa<FunctionDecl>(Val: D)) {
7572 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7573 << Attr << Attr.isRegularKeywordAttribute() << "functions";
7574 return false;
7575 }
7576 return true;
7577}
7578
7579bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7580 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7581 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7582 return false;
7583}
7584
7585bool existsInTarget(const TargetInfo &Target) const override {
7586 const llvm::Triple &T = Target.getTriple(); (void)T;
7587 return true && (T.getObjectFormat() == llvm::Triple::ELF || T.getObjectFormat() == llvm::Triple::MachO);
7588}
7589
7590void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
7591 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
7592}
7593
7594bool isParamExpr(size_t N) const override {
7595 return false;
7596}
7597
7598static const ParsedAttrInfoIFunc Instance;
7599};
7600const ParsedAttrInfoIFunc ParsedAttrInfoIFunc::Instance;
7601static constexpr ParsedAttrInfo::Spelling InitPrioritySpellings[] = {
7602 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "init_priority"},
7603 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::init_priority"},
7604};
7605static constexpr const char *InitPriorityArgNames[] = {
7606"Priority",};
7607struct ParsedAttrInfoInitPriority final : public ParsedAttrInfo {
7608 constexpr ParsedAttrInfoInitPriority() : ParsedAttrInfo(
7609 /*AttrKind=*/ParsedAttr::AT_InitPriority,
7610 /*NumArgs=*/1,
7611 /*OptArgs=*/0,
7612 /*NumArgMembers=*/1,
7613 /*HasCustomParsing=*/0,
7614 /*AcceptsExprPack=*/0,
7615 /*IsTargetSpecific=*/1,
7616 /*IsType=*/0,
7617 /*IsStmt=*/0,
7618 /*IsKnownToGCC=*/1,
7619 /*IsSupportedByPragmaAttribute=*/1,
7620 /*Spellings=*/InitPrioritySpellings,
7621 /*ArgNames=*/InitPriorityArgNames) {}
7622bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7623 if (!isa<VarDecl>(Val: D)) {
7624 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
7625 << Attr << Attr.isRegularKeywordAttribute() << "variables";
7626 return false;
7627 }
7628 return true;
7629}
7630
7631bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7632 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7633 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7634 return false;
7635}
7636
7637bool existsInTarget(const TargetInfo &Target) const override {
7638 const llvm::Triple &T = Target.getTriple(); (void)T;
7639 return true && ( !Target.getTriple().isOSzOS() );
7640}
7641
7642void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
7643 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
7644}
7645
7646bool isParamExpr(size_t N) const override {
7647 return false;
7648}
7649
7650static const ParsedAttrInfoInitPriority Instance;
7651};
7652const ParsedAttrInfoInitPriority ParsedAttrInfoInitPriority::Instance;
7653static constexpr ParsedAttrInfo::Spelling IntelOclBiccSpellings[] = {
7654 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "intel_ocl_bicc"},
7655 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::intel_ocl_bicc"},
7656};
7657struct ParsedAttrInfoIntelOclBicc final : public ParsedAttrInfo {
7658 constexpr ParsedAttrInfoIntelOclBicc() : ParsedAttrInfo(
7659 /*AttrKind=*/ParsedAttr::AT_IntelOclBicc,
7660 /*NumArgs=*/0,
7661 /*OptArgs=*/0,
7662 /*NumArgMembers=*/0,
7663 /*HasCustomParsing=*/0,
7664 /*AcceptsExprPack=*/0,
7665 /*IsTargetSpecific=*/0,
7666 /*IsType=*/1,
7667 /*IsStmt=*/0,
7668 /*IsKnownToGCC=*/0,
7669 /*IsSupportedByPragmaAttribute=*/0,
7670 /*Spellings=*/IntelOclBiccSpellings,
7671 /*ArgNames=*/{}) {}
7672bool isParamExpr(size_t N) const override {
7673 return false;
7674}
7675
7676static const ParsedAttrInfoIntelOclBicc Instance;
7677};
7678const ParsedAttrInfoIntelOclBicc ParsedAttrInfoIntelOclBicc::Instance;
7679static constexpr ParsedAttrInfo::Spelling InternalLinkageSpellings[] = {
7680 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "internal_linkage"},
7681 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::internal_linkage"},
7682 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::internal_linkage"},
7683};
7684struct ParsedAttrInfoInternalLinkage final : public ParsedAttrInfo {
7685 constexpr ParsedAttrInfoInternalLinkage() : ParsedAttrInfo(
7686 /*AttrKind=*/ParsedAttr::AT_InternalLinkage,
7687 /*NumArgs=*/0,
7688 /*OptArgs=*/0,
7689 /*NumArgMembers=*/0,
7690 /*HasCustomParsing=*/0,
7691 /*AcceptsExprPack=*/0,
7692 /*IsTargetSpecific=*/0,
7693 /*IsType=*/0,
7694 /*IsStmt=*/0,
7695 /*IsKnownToGCC=*/0,
7696 /*IsSupportedByPragmaAttribute=*/1,
7697 /*Spellings=*/InternalLinkageSpellings,
7698 /*ArgNames=*/{}) {}
7699bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7700 if (!isa<VarDecl>(Val: D) && !isa<FunctionDecl>(Val: D) && !isa<CXXRecordDecl>(Val: D)) {
7701 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7702 << Attr << Attr.isRegularKeywordAttribute() << "variables, functions, and classes";
7703 return false;
7704 }
7705 return true;
7706}
7707
7708bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7709 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7710 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7711 return false;
7712}
7713
7714 using ParsedAttrInfo::diagMutualExclusion;
7715
7716 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
7717 if (const auto *A = D->getAttr<CommonAttr>()) {
7718 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
7719 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
7720return false;
7721 }
7722 return true;
7723 }
7724
7725void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
7726 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
7727 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
7728 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
7729}
7730
7731bool isParamExpr(size_t N) const override {
7732 return false;
7733}
7734
7735static const ParsedAttrInfoInternalLinkage Instance;
7736};
7737const ParsedAttrInfoInternalLinkage ParsedAttrInfoInternalLinkage::Instance;
7738static constexpr ParsedAttrInfo::Spelling LTOVisibilityPublicSpellings[] = {
7739 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "lto_visibility_public"},
7740 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::lto_visibility_public"},
7741 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::lto_visibility_public"},
7742};
7743struct ParsedAttrInfoLTOVisibilityPublic final : public ParsedAttrInfo {
7744 constexpr ParsedAttrInfoLTOVisibilityPublic() : ParsedAttrInfo(
7745 /*AttrKind=*/ParsedAttr::AT_LTOVisibilityPublic,
7746 /*NumArgs=*/0,
7747 /*OptArgs=*/0,
7748 /*NumArgMembers=*/0,
7749 /*HasCustomParsing=*/0,
7750 /*AcceptsExprPack=*/0,
7751 /*IsTargetSpecific=*/0,
7752 /*IsType=*/0,
7753 /*IsStmt=*/0,
7754 /*IsKnownToGCC=*/0,
7755 /*IsSupportedByPragmaAttribute=*/1,
7756 /*Spellings=*/LTOVisibilityPublicSpellings,
7757 /*ArgNames=*/{}) {}
7758bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7759 if (!isa<RecordDecl>(Val: D)) {
7760 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7761 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
7762 return false;
7763 }
7764 return true;
7765}
7766
7767bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7768 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7769 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7770 return false;
7771}
7772
7773void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
7774 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
7775}
7776
7777AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
7778 D->addAttr(A: ::new (S.Context) LTOVisibilityPublicAttr(S.Context, Attr));
7779 return AttributeApplied;
7780}
7781
7782bool isParamExpr(size_t N) const override {
7783 return false;
7784}
7785
7786static const ParsedAttrInfoLTOVisibilityPublic Instance;
7787};
7788const ParsedAttrInfoLTOVisibilityPublic ParsedAttrInfoLTOVisibilityPublic::Instance;
7789static constexpr ParsedAttrInfo::Spelling LayoutVersionSpellings[] = {
7790 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "layout_version"},
7791};
7792static constexpr const char *LayoutVersionArgNames[] = {
7793"Version",};
7794struct ParsedAttrInfoLayoutVersion final : public ParsedAttrInfo {
7795 constexpr ParsedAttrInfoLayoutVersion() : ParsedAttrInfo(
7796 /*AttrKind=*/ParsedAttr::AT_LayoutVersion,
7797 /*NumArgs=*/1,
7798 /*OptArgs=*/0,
7799 /*NumArgMembers=*/1,
7800 /*HasCustomParsing=*/0,
7801 /*AcceptsExprPack=*/0,
7802 /*IsTargetSpecific=*/1,
7803 /*IsType=*/0,
7804 /*IsStmt=*/0,
7805 /*IsKnownToGCC=*/0,
7806 /*IsSupportedByPragmaAttribute=*/0,
7807 /*Spellings=*/LayoutVersionSpellings,
7808 /*ArgNames=*/LayoutVersionArgNames) {}
7809bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7810 if (!isa<CXXRecordDecl>(Val: D)) {
7811 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7812 << Attr << Attr.isRegularKeywordAttribute() << "classes";
7813 return false;
7814 }
7815 return true;
7816}
7817
7818bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7819 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7820 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7821 return false;
7822}
7823
7824bool existsInTarget(const TargetInfo &Target) const override {
7825 const llvm::Triple &T = Target.getTriple(); (void)T;
7826 return true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64 || T.getArch() == llvm::Triple::arm || T.getArch() == llvm::Triple::thumb || T.getArch() == llvm::Triple::aarch64) && ( Target.getCXXABI().isMicrosoft() );
7827}
7828
7829bool isParamExpr(size_t N) const override {
7830 return false;
7831}
7832
7833static const ParsedAttrInfoLayoutVersion Instance;
7834};
7835const ParsedAttrInfoLayoutVersion ParsedAttrInfoLayoutVersion::Instance;
7836static constexpr ParsedAttrInfo::Spelling LeafSpellings[] = {
7837 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "leaf"},
7838 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::leaf"},
7839 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::leaf"},
7840};
7841struct ParsedAttrInfoLeaf final : public ParsedAttrInfo {
7842 constexpr ParsedAttrInfoLeaf() : ParsedAttrInfo(
7843 /*AttrKind=*/ParsedAttr::AT_Leaf,
7844 /*NumArgs=*/0,
7845 /*OptArgs=*/0,
7846 /*NumArgMembers=*/0,
7847 /*HasCustomParsing=*/0,
7848 /*AcceptsExprPack=*/0,
7849 /*IsTargetSpecific=*/0,
7850 /*IsType=*/0,
7851 /*IsStmt=*/0,
7852 /*IsKnownToGCC=*/1,
7853 /*IsSupportedByPragmaAttribute=*/1,
7854 /*Spellings=*/LeafSpellings,
7855 /*ArgNames=*/{}) {}
7856bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7857 if (!isa<FunctionDecl>(Val: D)) {
7858 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7859 << Attr << Attr.isRegularKeywordAttribute() << "functions";
7860 return false;
7861 }
7862 return true;
7863}
7864
7865bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7866 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7867 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7868 return false;
7869}
7870
7871void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
7872 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
7873}
7874
7875AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
7876 D->addAttr(A: ::new (S.Context) LeafAttr(S.Context, Attr));
7877 return AttributeApplied;
7878}
7879
7880bool isParamExpr(size_t N) const override {
7881 return false;
7882}
7883
7884static const ParsedAttrInfoLeaf Instance;
7885};
7886const ParsedAttrInfoLeaf ParsedAttrInfoLeaf::Instance;
7887static constexpr ParsedAttrInfo::Spelling LifetimeBoundSpellings[] = {
7888 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "lifetimebound"},
7889 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::lifetimebound"},
7890};
7891struct ParsedAttrInfoLifetimeBound final : public ParsedAttrInfo {
7892 constexpr ParsedAttrInfoLifetimeBound() : ParsedAttrInfo(
7893 /*AttrKind=*/ParsedAttr::AT_LifetimeBound,
7894 /*NumArgs=*/0,
7895 /*OptArgs=*/0,
7896 /*NumArgMembers=*/0,
7897 /*HasCustomParsing=*/0,
7898 /*AcceptsExprPack=*/0,
7899 /*IsTargetSpecific=*/0,
7900 /*IsType=*/1,
7901 /*IsStmt=*/0,
7902 /*IsKnownToGCC=*/0,
7903 /*IsSupportedByPragmaAttribute=*/0,
7904 /*Spellings=*/LifetimeBoundSpellings,
7905 /*ArgNames=*/{}) {}
7906bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7907 if (!isa<ParmVarDecl>(Val: D) && !isImplicitObjectParameter(D)) {
7908 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
7909 << Attr << Attr.isRegularKeywordAttribute() << "parameters and implicit object parameters";
7910 return false;
7911 }
7912 return true;
7913}
7914
7915bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7916 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7917 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7918 return false;
7919}
7920
7921bool acceptsLangOpts(const LangOptions &LangOpts) const override {
7922 return LangOpts.CPlusPlus;
7923}
7924
7925AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
7926 D->addAttr(A: ::new (S.Context) LifetimeBoundAttr(S.Context, Attr));
7927 return AttributeApplied;
7928}
7929
7930bool isParamExpr(size_t N) const override {
7931 return false;
7932}
7933
7934static const ParsedAttrInfoLifetimeBound Instance;
7935};
7936const ParsedAttrInfoLifetimeBound ParsedAttrInfoLifetimeBound::Instance;
7937static constexpr ParsedAttrInfo::Spelling LikelySpellings[] = {
7938 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "likely"},
7939 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::likely"},
7940};
7941struct ParsedAttrInfoLikely final : public ParsedAttrInfo {
7942 constexpr ParsedAttrInfoLikely() : ParsedAttrInfo(
7943 /*AttrKind=*/ParsedAttr::AT_Likely,
7944 /*NumArgs=*/0,
7945 /*OptArgs=*/0,
7946 /*NumArgMembers=*/0,
7947 /*HasCustomParsing=*/0,
7948 /*AcceptsExprPack=*/0,
7949 /*IsTargetSpecific=*/0,
7950 /*IsType=*/0,
7951 /*IsStmt=*/1,
7952 /*IsKnownToGCC=*/0,
7953 /*IsSupportedByPragmaAttribute=*/0,
7954 /*Spellings=*/LikelySpellings,
7955 /*ArgNames=*/{}) {}
7956 using ParsedAttrInfo::diagMutualExclusion;
7957
7958bool isParamExpr(size_t N) const override {
7959 return false;
7960}
7961
7962static const ParsedAttrInfoLikely Instance;
7963};
7964const ParsedAttrInfoLikely ParsedAttrInfoLikely::Instance;
7965static constexpr ParsedAttrInfo::Spelling LoaderUninitializedSpellings[] = {
7966 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "loader_uninitialized"},
7967 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::loader_uninitialized"},
7968 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::loader_uninitialized"},
7969};
7970struct ParsedAttrInfoLoaderUninitialized final : public ParsedAttrInfo {
7971 constexpr ParsedAttrInfoLoaderUninitialized() : ParsedAttrInfo(
7972 /*AttrKind=*/ParsedAttr::AT_LoaderUninitialized,
7973 /*NumArgs=*/0,
7974 /*OptArgs=*/0,
7975 /*NumArgMembers=*/0,
7976 /*HasCustomParsing=*/0,
7977 /*AcceptsExprPack=*/0,
7978 /*IsTargetSpecific=*/0,
7979 /*IsType=*/0,
7980 /*IsStmt=*/0,
7981 /*IsKnownToGCC=*/0,
7982 /*IsSupportedByPragmaAttribute=*/1,
7983 /*Spellings=*/LoaderUninitializedSpellings,
7984 /*ArgNames=*/{}) {}
7985bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
7986 if (!isGlobalVar(D)) {
7987 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
7988 << Attr << Attr.isRegularKeywordAttribute() << "global variables";
7989 return false;
7990 }
7991 return true;
7992}
7993
7994bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
7995 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
7996 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
7997 return false;
7998}
7999
8000void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8001 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/y: true));
8002}
8003
8004AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
8005 D->addAttr(A: ::new (S.Context) LoaderUninitializedAttr(S.Context, Attr));
8006 return AttributeApplied;
8007}
8008
8009bool isParamExpr(size_t N) const override {
8010 return false;
8011}
8012
8013static const ParsedAttrInfoLoaderUninitialized Instance;
8014};
8015const ParsedAttrInfoLoaderUninitialized ParsedAttrInfoLoaderUninitialized::Instance;
8016static constexpr ParsedAttrInfo::Spelling LockReturnedSpellings[] = {
8017 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "lock_returned"},
8018};
8019static constexpr const char *LockReturnedArgNames[] = {
8020"Arg",};
8021struct ParsedAttrInfoLockReturned final : public ParsedAttrInfo {
8022 constexpr ParsedAttrInfoLockReturned() : ParsedAttrInfo(
8023 /*AttrKind=*/ParsedAttr::AT_LockReturned,
8024 /*NumArgs=*/1,
8025 /*OptArgs=*/0,
8026 /*NumArgMembers=*/1,
8027 /*HasCustomParsing=*/0,
8028 /*AcceptsExprPack=*/0,
8029 /*IsTargetSpecific=*/0,
8030 /*IsType=*/0,
8031 /*IsStmt=*/0,
8032 /*IsKnownToGCC=*/0,
8033 /*IsSupportedByPragmaAttribute=*/0,
8034 /*Spellings=*/LockReturnedSpellings,
8035 /*ArgNames=*/LockReturnedArgNames) {}
8036bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8037 if (!isa<FunctionDecl>(Val: D)) {
8038 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
8039 << Attr << Attr.isRegularKeywordAttribute() << "functions";
8040 return false;
8041 }
8042 return true;
8043}
8044
8045bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8046 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8047 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8048 return false;
8049}
8050
8051bool isParamExpr(size_t N) const override {
8052 return (N == 0) || false;
8053}
8054
8055static const ParsedAttrInfoLockReturned Instance;
8056};
8057const ParsedAttrInfoLockReturned ParsedAttrInfoLockReturned::Instance;
8058static constexpr ParsedAttrInfo::Spelling LockableSpellings[] = {
8059 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "lockable"},
8060};
8061struct ParsedAttrInfoLockable final : public ParsedAttrInfo {
8062 constexpr ParsedAttrInfoLockable() : ParsedAttrInfo(
8063 /*AttrKind=*/ParsedAttr::AT_Lockable,
8064 /*NumArgs=*/0,
8065 /*OptArgs=*/0,
8066 /*NumArgMembers=*/0,
8067 /*HasCustomParsing=*/0,
8068 /*AcceptsExprPack=*/0,
8069 /*IsTargetSpecific=*/0,
8070 /*IsType=*/0,
8071 /*IsStmt=*/0,
8072 /*IsKnownToGCC=*/0,
8073 /*IsSupportedByPragmaAttribute=*/1,
8074 /*Spellings=*/LockableSpellings,
8075 /*ArgNames=*/{}) {}
8076bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8077 if (!isa<RecordDecl>(Val: D)) {
8078 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
8079 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
8080 return false;
8081 }
8082 return true;
8083}
8084
8085bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8086 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8087 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8088 return false;
8089}
8090
8091void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8092 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
8093}
8094
8095bool isParamExpr(size_t N) const override {
8096 return false;
8097}
8098
8099static const ParsedAttrInfoLockable Instance;
8100};
8101const ParsedAttrInfoLockable ParsedAttrInfoLockable::Instance;
8102static constexpr ParsedAttrInfo::Spelling LocksExcludedSpellings[] = {
8103 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "locks_excluded"},
8104};
8105static constexpr const char *LocksExcludedArgNames[] = {
8106"Args...",};
8107struct ParsedAttrInfoLocksExcluded final : public ParsedAttrInfo {
8108 constexpr ParsedAttrInfoLocksExcluded() : ParsedAttrInfo(
8109 /*AttrKind=*/ParsedAttr::AT_LocksExcluded,
8110 /*NumArgs=*/0,
8111 /*OptArgs=*/15,
8112 /*NumArgMembers=*/1,
8113 /*HasCustomParsing=*/0,
8114 /*AcceptsExprPack=*/0,
8115 /*IsTargetSpecific=*/0,
8116 /*IsType=*/0,
8117 /*IsStmt=*/0,
8118 /*IsKnownToGCC=*/0,
8119 /*IsSupportedByPragmaAttribute=*/0,
8120 /*Spellings=*/LocksExcludedSpellings,
8121 /*ArgNames=*/LocksExcludedArgNames) {}
8122bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8123 if (!isa<FunctionDecl>(Val: D)) {
8124 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
8125 << Attr << Attr.isRegularKeywordAttribute() << "functions";
8126 return false;
8127 }
8128 return true;
8129}
8130
8131bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8132 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8133 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8134 return false;
8135}
8136
8137bool isParamExpr(size_t N) const override {
8138 return (N == 0) || false;
8139}
8140
8141static const ParsedAttrInfoLocksExcluded Instance;
8142};
8143const ParsedAttrInfoLocksExcluded ParsedAttrInfoLocksExcluded::Instance;
8144static constexpr ParsedAttrInfo::Spelling LoopHintSpellings[] = {
8145 {.Syntax: AttributeCommonInfo::AS_Pragma, .NormalizedFullName: "clang::loop"},
8146 {.Syntax: AttributeCommonInfo::AS_Pragma, .NormalizedFullName: "unroll"},
8147 {.Syntax: AttributeCommonInfo::AS_Pragma, .NormalizedFullName: "nounroll"},
8148 {.Syntax: AttributeCommonInfo::AS_Pragma, .NormalizedFullName: "unroll_and_jam"},
8149 {.Syntax: AttributeCommonInfo::AS_Pragma, .NormalizedFullName: "nounroll_and_jam"},
8150};
8151static constexpr const char *LoopHintArgNames[] = {
8152"Option","State","Value",};
8153struct ParsedAttrInfoLoopHint final : public ParsedAttrInfo {
8154 constexpr ParsedAttrInfoLoopHint() : ParsedAttrInfo(
8155 /*AttrKind=*/ParsedAttr::AT_LoopHint,
8156 /*NumArgs=*/3,
8157 /*OptArgs=*/0,
8158 /*NumArgMembers=*/3,
8159 /*HasCustomParsing=*/1,
8160 /*AcceptsExprPack=*/0,
8161 /*IsTargetSpecific=*/0,
8162 /*IsType=*/0,
8163 /*IsStmt=*/0,
8164 /*IsKnownToGCC=*/0,
8165 /*IsSupportedByPragmaAttribute=*/0,
8166 /*Spellings=*/LoopHintSpellings,
8167 /*ArgNames=*/LoopHintArgNames) {}
8168unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
8169 enum Spelling {
8170 Pragma_clang_loop = 0,
8171 Pragma_unroll = 1,
8172 Pragma_nounroll = 2,
8173 Pragma_unroll_and_jam = 3,
8174 Pragma_nounroll_and_jam = 4,
8175 SpellingNotCalculated = 15
8176
8177 };
8178
8179 unsigned Idx = Attr.getAttributeSpellingListIndex();
8180 switch (Idx) {
8181 default: llvm_unreachable("Unknown spelling list index");
8182 case 0: return Pragma_clang_loop;
8183 case 1: return Pragma_unroll;
8184 case 2: return Pragma_nounroll;
8185 case 3: return Pragma_unroll_and_jam;
8186 case 4: return Pragma_nounroll_and_jam;
8187 }
8188}
8189
8190bool isParamExpr(size_t N) const override {
8191 return (N == 2) || false;
8192}
8193
8194static const ParsedAttrInfoLoopHint Instance;
8195};
8196const ParsedAttrInfoLoopHint ParsedAttrInfoLoopHint::Instance;
8197static constexpr ParsedAttrInfo::Spelling M68kRTDSpellings[] = {
8198 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "m68k_rtd"},
8199 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::m68k_rtd"},
8200 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::m68k_rtd"},
8201};
8202struct ParsedAttrInfoM68kRTD final : public ParsedAttrInfo {
8203 constexpr ParsedAttrInfoM68kRTD() : ParsedAttrInfo(
8204 /*AttrKind=*/ParsedAttr::AT_M68kRTD,
8205 /*NumArgs=*/0,
8206 /*OptArgs=*/0,
8207 /*NumArgMembers=*/0,
8208 /*HasCustomParsing=*/0,
8209 /*AcceptsExprPack=*/0,
8210 /*IsTargetSpecific=*/0,
8211 /*IsType=*/1,
8212 /*IsStmt=*/0,
8213 /*IsKnownToGCC=*/0,
8214 /*IsSupportedByPragmaAttribute=*/0,
8215 /*Spellings=*/M68kRTDSpellings,
8216 /*ArgNames=*/{}) {}
8217bool isParamExpr(size_t N) const override {
8218 return false;
8219}
8220
8221static const ParsedAttrInfoM68kRTD Instance;
8222};
8223const ParsedAttrInfoM68kRTD ParsedAttrInfoM68kRTD::Instance;
8224static constexpr ParsedAttrInfo::Spelling MIGServerRoutineSpellings[] = {
8225 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "mig_server_routine"},
8226 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::mig_server_routine"},
8227 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::mig_server_routine"},
8228};
8229struct ParsedAttrInfoMIGServerRoutine final : public ParsedAttrInfo {
8230 constexpr ParsedAttrInfoMIGServerRoutine() : ParsedAttrInfo(
8231 /*AttrKind=*/ParsedAttr::AT_MIGServerRoutine,
8232 /*NumArgs=*/0,
8233 /*OptArgs=*/0,
8234 /*NumArgMembers=*/0,
8235 /*HasCustomParsing=*/0,
8236 /*AcceptsExprPack=*/0,
8237 /*IsTargetSpecific=*/0,
8238 /*IsType=*/0,
8239 /*IsStmt=*/0,
8240 /*IsKnownToGCC=*/0,
8241 /*IsSupportedByPragmaAttribute=*/1,
8242 /*Spellings=*/MIGServerRoutineSpellings,
8243 /*ArgNames=*/{}) {}
8244bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8245 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D) && !isa<BlockDecl>(Val: D)) {
8246 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
8247 << Attr << Attr.isRegularKeywordAttribute() << "functions, Objective-C methods, and blocks";
8248 return false;
8249 }
8250 return true;
8251}
8252
8253bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8254 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8255 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8256 return false;
8257}
8258
8259void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8260 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
8261 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
8262 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_block, /*IsSupported=*/y: LangOpts.Blocks));
8263}
8264
8265bool isParamExpr(size_t N) const override {
8266 return false;
8267}
8268
8269static const ParsedAttrInfoMIGServerRoutine Instance;
8270};
8271const ParsedAttrInfoMIGServerRoutine ParsedAttrInfoMIGServerRoutine::Instance;
8272static constexpr ParsedAttrInfo::Spelling MSABISpellings[] = {
8273 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ms_abi"},
8274 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::ms_abi"},
8275 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::ms_abi"},
8276};
8277struct ParsedAttrInfoMSABI final : public ParsedAttrInfo {
8278 constexpr ParsedAttrInfoMSABI() : ParsedAttrInfo(
8279 /*AttrKind=*/ParsedAttr::AT_MSABI,
8280 /*NumArgs=*/0,
8281 /*OptArgs=*/0,
8282 /*NumArgMembers=*/0,
8283 /*HasCustomParsing=*/0,
8284 /*AcceptsExprPack=*/0,
8285 /*IsTargetSpecific=*/0,
8286 /*IsType=*/1,
8287 /*IsStmt=*/0,
8288 /*IsKnownToGCC=*/1,
8289 /*IsSupportedByPragmaAttribute=*/0,
8290 /*Spellings=*/MSABISpellings,
8291 /*ArgNames=*/{}) {}
8292bool isParamExpr(size_t N) const override {
8293 return false;
8294}
8295
8296static const ParsedAttrInfoMSABI Instance;
8297};
8298const ParsedAttrInfoMSABI ParsedAttrInfoMSABI::Instance;
8299static constexpr ParsedAttrInfo::Spelling MSAllocatorSpellings[] = {
8300 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "allocator"},
8301};
8302struct ParsedAttrInfoMSAllocator final : public ParsedAttrInfo {
8303 constexpr ParsedAttrInfoMSAllocator() : ParsedAttrInfo(
8304 /*AttrKind=*/ParsedAttr::AT_MSAllocator,
8305 /*NumArgs=*/0,
8306 /*OptArgs=*/0,
8307 /*NumArgMembers=*/0,
8308 /*HasCustomParsing=*/0,
8309 /*AcceptsExprPack=*/0,
8310 /*IsTargetSpecific=*/0,
8311 /*IsType=*/0,
8312 /*IsStmt=*/0,
8313 /*IsKnownToGCC=*/0,
8314 /*IsSupportedByPragmaAttribute=*/0,
8315 /*Spellings=*/MSAllocatorSpellings,
8316 /*ArgNames=*/{}) {}
8317bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8318 if (!isa<FunctionDecl>(Val: D)) {
8319 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
8320 << Attr << Attr.isRegularKeywordAttribute() << "functions";
8321 return false;
8322 }
8323 return true;
8324}
8325
8326bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8327 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8328 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8329 return false;
8330}
8331
8332bool isParamExpr(size_t N) const override {
8333 return false;
8334}
8335
8336static const ParsedAttrInfoMSAllocator Instance;
8337};
8338const ParsedAttrInfoMSAllocator ParsedAttrInfoMSAllocator::Instance;
8339static constexpr ParsedAttrInfo::Spelling MSConstexprSpellings[] = {
8340 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "msvc::constexpr"},
8341};
8342struct ParsedAttrInfoMSConstexpr final : public ParsedAttrInfo {
8343 constexpr ParsedAttrInfoMSConstexpr() : ParsedAttrInfo(
8344 /*AttrKind=*/ParsedAttr::AT_MSConstexpr,
8345 /*NumArgs=*/0,
8346 /*OptArgs=*/0,
8347 /*NumArgMembers=*/0,
8348 /*HasCustomParsing=*/0,
8349 /*AcceptsExprPack=*/0,
8350 /*IsTargetSpecific=*/0,
8351 /*IsType=*/0,
8352 /*IsStmt=*/0,
8353 /*IsKnownToGCC=*/0,
8354 /*IsSupportedByPragmaAttribute=*/1,
8355 /*Spellings=*/MSConstexprSpellings,
8356 /*ArgNames=*/{}) {}
8357bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8358 if (!isa<FunctionDecl>(Val: D)) {
8359 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
8360 << Attr << Attr.isRegularKeywordAttribute() << "functions and return statements";
8361 return false;
8362 }
8363 return true;
8364}
8365
8366bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
8367 if (!isa<ReturnStmt>(Val: St)) {
8368 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
8369 << Attr << Attr.isRegularKeywordAttribute() << "functions and return statements";
8370 return false;
8371 }
8372 return true;
8373}
8374
8375bool acceptsLangOpts(const LangOptions &LangOpts) const override {
8376 return LangOpts.MicrosoftExt;
8377}
8378
8379void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8380 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
8381}
8382
8383bool isParamExpr(size_t N) const override {
8384 return false;
8385}
8386
8387static const ParsedAttrInfoMSConstexpr Instance;
8388};
8389const ParsedAttrInfoMSConstexpr ParsedAttrInfoMSConstexpr::Instance;
8390static constexpr ParsedAttrInfo::Spelling MSInheritanceSpellings[] = {
8391 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__single_inheritance"},
8392 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__multiple_inheritance"},
8393 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__virtual_inheritance"},
8394 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__unspecified_inheritance"},
8395};
8396struct ParsedAttrInfoMSInheritance final : public ParsedAttrInfo {
8397 constexpr ParsedAttrInfoMSInheritance() : ParsedAttrInfo(
8398 /*AttrKind=*/ParsedAttr::AT_MSInheritance,
8399 /*NumArgs=*/0,
8400 /*OptArgs=*/0,
8401 /*NumArgMembers=*/0,
8402 /*HasCustomParsing=*/0,
8403 /*AcceptsExprPack=*/0,
8404 /*IsTargetSpecific=*/0,
8405 /*IsType=*/0,
8406 /*IsStmt=*/0,
8407 /*IsKnownToGCC=*/0,
8408 /*IsSupportedByPragmaAttribute=*/0,
8409 /*Spellings=*/MSInheritanceSpellings,
8410 /*ArgNames=*/{}) {}
8411bool acceptsLangOpts(const LangOptions &LangOpts) const override {
8412 return LangOpts.MicrosoftExt;
8413}
8414
8415unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
8416 enum Spelling {
8417 Keyword_single_inheritance = 0,
8418 Keyword_multiple_inheritance = 1,
8419 Keyword_virtual_inheritance = 2,
8420 Keyword_unspecified_inheritance = 3,
8421 SpellingNotCalculated = 15
8422
8423 };
8424
8425 unsigned Idx = Attr.getAttributeSpellingListIndex();
8426 switch (Idx) {
8427 default: llvm_unreachable("Unknown spelling list index");
8428 case 0: return Keyword_single_inheritance;
8429 case 1: return Keyword_multiple_inheritance;
8430 case 2: return Keyword_virtual_inheritance;
8431 case 3: return Keyword_unspecified_inheritance;
8432 }
8433}
8434
8435bool isParamExpr(size_t N) const override {
8436 return false;
8437}
8438
8439static const ParsedAttrInfoMSInheritance Instance;
8440};
8441const ParsedAttrInfoMSInheritance ParsedAttrInfoMSInheritance::Instance;
8442static constexpr ParsedAttrInfo::Spelling MSNoVTableSpellings[] = {
8443 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "novtable"},
8444};
8445struct ParsedAttrInfoMSNoVTable final : public ParsedAttrInfo {
8446 constexpr ParsedAttrInfoMSNoVTable() : ParsedAttrInfo(
8447 /*AttrKind=*/ParsedAttr::AT_MSNoVTable,
8448 /*NumArgs=*/0,
8449 /*OptArgs=*/0,
8450 /*NumArgMembers=*/0,
8451 /*HasCustomParsing=*/0,
8452 /*AcceptsExprPack=*/0,
8453 /*IsTargetSpecific=*/1,
8454 /*IsType=*/0,
8455 /*IsStmt=*/0,
8456 /*IsKnownToGCC=*/0,
8457 /*IsSupportedByPragmaAttribute=*/0,
8458 /*Spellings=*/MSNoVTableSpellings,
8459 /*ArgNames=*/{}) {}
8460bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8461 if (!isa<CXXRecordDecl>(Val: D)) {
8462 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
8463 << Attr << Attr.isRegularKeywordAttribute() << "classes";
8464 return false;
8465 }
8466 return true;
8467}
8468
8469bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8470 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8471 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8472 return false;
8473}
8474
8475bool existsInTarget(const TargetInfo &Target) const override {
8476 const llvm::Triple &T = Target.getTriple(); (void)T;
8477 return true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64 || T.getArch() == llvm::Triple::arm || T.getArch() == llvm::Triple::thumb || T.getArch() == llvm::Triple::aarch64) && ( Target.getCXXABI().isMicrosoft() );
8478}
8479
8480AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
8481 D->addAttr(A: ::new (S.Context) MSNoVTableAttr(S.Context, Attr));
8482 return AttributeApplied;
8483}
8484
8485bool isParamExpr(size_t N) const override {
8486 return false;
8487}
8488
8489static const ParsedAttrInfoMSNoVTable Instance;
8490};
8491const ParsedAttrInfoMSNoVTable ParsedAttrInfoMSNoVTable::Instance;
8492static constexpr ParsedAttrInfo::Spelling MSStructSpellings[] = {
8493 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ms_struct"},
8494 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::ms_struct"},
8495 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::ms_struct"},
8496};
8497struct ParsedAttrInfoMSStruct final : public ParsedAttrInfo {
8498 constexpr ParsedAttrInfoMSStruct() : ParsedAttrInfo(
8499 /*AttrKind=*/ParsedAttr::AT_MSStruct,
8500 /*NumArgs=*/0,
8501 /*OptArgs=*/0,
8502 /*NumArgMembers=*/0,
8503 /*HasCustomParsing=*/0,
8504 /*AcceptsExprPack=*/0,
8505 /*IsTargetSpecific=*/0,
8506 /*IsType=*/0,
8507 /*IsStmt=*/0,
8508 /*IsKnownToGCC=*/1,
8509 /*IsSupportedByPragmaAttribute=*/1,
8510 /*Spellings=*/MSStructSpellings,
8511 /*ArgNames=*/{}) {}
8512bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8513 if (!isa<RecordDecl>(Val: D)) {
8514 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
8515 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
8516 return false;
8517 }
8518 return true;
8519}
8520
8521bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8522 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8523 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8524 return false;
8525}
8526
8527void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8528 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
8529}
8530
8531AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
8532 D->addAttr(A: ::new (S.Context) MSStructAttr(S.Context, Attr));
8533 return AttributeApplied;
8534}
8535
8536bool isParamExpr(size_t N) const override {
8537 return false;
8538}
8539
8540static const ParsedAttrInfoMSStruct Instance;
8541};
8542const ParsedAttrInfoMSStruct ParsedAttrInfoMSStruct::Instance;
8543static constexpr ParsedAttrInfo::Spelling MatrixTypeSpellings[] = {
8544 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "matrix_type"},
8545 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::matrix_type"},
8546 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::matrix_type"},
8547};
8548static constexpr const char *MatrixTypeArgNames[] = {
8549"NumRows","NumColumns",};
8550struct ParsedAttrInfoMatrixType final : public ParsedAttrInfo {
8551 constexpr ParsedAttrInfoMatrixType() : ParsedAttrInfo(
8552 /*AttrKind=*/ParsedAttr::AT_MatrixType,
8553 /*NumArgs=*/2,
8554 /*OptArgs=*/0,
8555 /*NumArgMembers=*/2,
8556 /*HasCustomParsing=*/0,
8557 /*AcceptsExprPack=*/0,
8558 /*IsTargetSpecific=*/0,
8559 /*IsType=*/1,
8560 /*IsStmt=*/0,
8561 /*IsKnownToGCC=*/0,
8562 /*IsSupportedByPragmaAttribute=*/0,
8563 /*Spellings=*/MatrixTypeSpellings,
8564 /*ArgNames=*/MatrixTypeArgNames) {}
8565bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8566 if (!isa<TypedefNameDecl>(Val: D)) {
8567 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
8568 << Attr << Attr.isRegularKeywordAttribute() << "typedefs";
8569 return false;
8570 }
8571 return true;
8572}
8573
8574bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8575 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8576 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8577 return false;
8578}
8579
8580bool isParamExpr(size_t N) const override {
8581 return (N == 0) || (N == 1) || false;
8582}
8583
8584static const ParsedAttrInfoMatrixType Instance;
8585};
8586const ParsedAttrInfoMatrixType ParsedAttrInfoMatrixType::Instance;
8587static constexpr ParsedAttrInfo::Spelling MayAliasSpellings[] = {
8588 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "may_alias"},
8589 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::may_alias"},
8590 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::may_alias"},
8591};
8592struct ParsedAttrInfoMayAlias final : public ParsedAttrInfo {
8593 constexpr ParsedAttrInfoMayAlias() : ParsedAttrInfo(
8594 /*AttrKind=*/ParsedAttr::AT_MayAlias,
8595 /*NumArgs=*/0,
8596 /*OptArgs=*/0,
8597 /*NumArgMembers=*/0,
8598 /*HasCustomParsing=*/0,
8599 /*AcceptsExprPack=*/0,
8600 /*IsTargetSpecific=*/0,
8601 /*IsType=*/0,
8602 /*IsStmt=*/0,
8603 /*IsKnownToGCC=*/1,
8604 /*IsSupportedByPragmaAttribute=*/0,
8605 /*Spellings=*/MayAliasSpellings,
8606 /*ArgNames=*/{}) {}
8607AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
8608 D->addAttr(A: ::new (S.Context) MayAliasAttr(S.Context, Attr));
8609 return AttributeApplied;
8610}
8611
8612bool isParamExpr(size_t N) const override {
8613 return false;
8614}
8615
8616static const ParsedAttrInfoMayAlias Instance;
8617};
8618const ParsedAttrInfoMayAlias ParsedAttrInfoMayAlias::Instance;
8619static constexpr ParsedAttrInfo::Spelling MaybeUndefSpellings[] = {
8620 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "maybe_undef"},
8621 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::maybe_undef"},
8622 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::maybe_undef"},
8623};
8624struct ParsedAttrInfoMaybeUndef final : public ParsedAttrInfo {
8625 constexpr ParsedAttrInfoMaybeUndef() : ParsedAttrInfo(
8626 /*AttrKind=*/ParsedAttr::AT_MaybeUndef,
8627 /*NumArgs=*/0,
8628 /*OptArgs=*/0,
8629 /*NumArgMembers=*/0,
8630 /*HasCustomParsing=*/0,
8631 /*AcceptsExprPack=*/0,
8632 /*IsTargetSpecific=*/0,
8633 /*IsType=*/0,
8634 /*IsStmt=*/0,
8635 /*IsKnownToGCC=*/0,
8636 /*IsSupportedByPragmaAttribute=*/1,
8637 /*Spellings=*/MaybeUndefSpellings,
8638 /*ArgNames=*/{}) {}
8639bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8640 if (!isa<ParmVarDecl>(Val: D)) {
8641 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
8642 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
8643 return false;
8644 }
8645 return true;
8646}
8647
8648bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8649 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8650 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8651 return false;
8652}
8653
8654void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8655 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
8656}
8657
8658AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
8659 D->addAttr(A: ::new (S.Context) MaybeUndefAttr(S.Context, Attr));
8660 return AttributeApplied;
8661}
8662
8663bool isParamExpr(size_t N) const override {
8664 return false;
8665}
8666
8667static const ParsedAttrInfoMaybeUndef Instance;
8668};
8669const ParsedAttrInfoMaybeUndef ParsedAttrInfoMaybeUndef::Instance;
8670static constexpr ParsedAttrInfo::Spelling MicroMipsSpellings[] = {
8671 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "micromips"},
8672 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::micromips"},
8673 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::micromips"},
8674};
8675struct ParsedAttrInfoMicroMips final : public ParsedAttrInfo {
8676 constexpr ParsedAttrInfoMicroMips() : ParsedAttrInfo(
8677 /*AttrKind=*/ParsedAttr::AT_MicroMips,
8678 /*NumArgs=*/0,
8679 /*OptArgs=*/0,
8680 /*NumArgMembers=*/0,
8681 /*HasCustomParsing=*/0,
8682 /*AcceptsExprPack=*/0,
8683 /*IsTargetSpecific=*/1,
8684 /*IsType=*/0,
8685 /*IsStmt=*/0,
8686 /*IsKnownToGCC=*/1,
8687 /*IsSupportedByPragmaAttribute=*/1,
8688 /*Spellings=*/MicroMipsSpellings,
8689 /*ArgNames=*/{}) {}
8690bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8691 if (!isa<FunctionDecl>(Val: D)) {
8692 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
8693 << Attr << Attr.isRegularKeywordAttribute() << "functions";
8694 return false;
8695 }
8696 return true;
8697}
8698
8699bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8700 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8701 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8702 return false;
8703}
8704
8705 using ParsedAttrInfo::diagMutualExclusion;
8706
8707 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
8708 if (const auto *A = D->getAttr<Mips16Attr>()) {
8709 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
8710 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
8711return false;
8712 }
8713 return true;
8714 }
8715
8716bool existsInTarget(const TargetInfo &Target) const override {
8717 const llvm::Triple &T = Target.getTriple(); (void)T;
8718 return true && (T.getArch() == llvm::Triple::mips || T.getArch() == llvm::Triple::mipsel);
8719}
8720
8721void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8722 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
8723}
8724
8725AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
8726 D->addAttr(A: ::new (S.Context) MicroMipsAttr(S.Context, Attr));
8727 return AttributeApplied;
8728}
8729
8730bool isParamExpr(size_t N) const override {
8731 return false;
8732}
8733
8734static const ParsedAttrInfoMicroMips Instance;
8735};
8736const ParsedAttrInfoMicroMips ParsedAttrInfoMicroMips::Instance;
8737static constexpr ParsedAttrInfo::Spelling MinSizeSpellings[] = {
8738 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "minsize"},
8739 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::minsize"},
8740 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::minsize"},
8741};
8742struct ParsedAttrInfoMinSize final : public ParsedAttrInfo {
8743 constexpr ParsedAttrInfoMinSize() : ParsedAttrInfo(
8744 /*AttrKind=*/ParsedAttr::AT_MinSize,
8745 /*NumArgs=*/0,
8746 /*OptArgs=*/0,
8747 /*NumArgMembers=*/0,
8748 /*HasCustomParsing=*/0,
8749 /*AcceptsExprPack=*/0,
8750 /*IsTargetSpecific=*/0,
8751 /*IsType=*/0,
8752 /*IsStmt=*/0,
8753 /*IsKnownToGCC=*/0,
8754 /*IsSupportedByPragmaAttribute=*/1,
8755 /*Spellings=*/MinSizeSpellings,
8756 /*ArgNames=*/{}) {}
8757bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8758 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
8759 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
8760 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
8761 return false;
8762 }
8763 return true;
8764}
8765
8766bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8767 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8768 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8769 return false;
8770}
8771
8772void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8773 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
8774 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
8775}
8776
8777bool isParamExpr(size_t N) const override {
8778 return false;
8779}
8780
8781static const ParsedAttrInfoMinSize Instance;
8782};
8783const ParsedAttrInfoMinSize ParsedAttrInfoMinSize::Instance;
8784static constexpr ParsedAttrInfo::Spelling MinVectorWidthSpellings[] = {
8785 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "min_vector_width"},
8786 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::min_vector_width"},
8787 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::min_vector_width"},
8788};
8789static constexpr const char *MinVectorWidthArgNames[] = {
8790"VectorWidth",};
8791struct ParsedAttrInfoMinVectorWidth final : public ParsedAttrInfo {
8792 constexpr ParsedAttrInfoMinVectorWidth() : ParsedAttrInfo(
8793 /*AttrKind=*/ParsedAttr::AT_MinVectorWidth,
8794 /*NumArgs=*/1,
8795 /*OptArgs=*/0,
8796 /*NumArgMembers=*/1,
8797 /*HasCustomParsing=*/0,
8798 /*AcceptsExprPack=*/0,
8799 /*IsTargetSpecific=*/0,
8800 /*IsType=*/0,
8801 /*IsStmt=*/0,
8802 /*IsKnownToGCC=*/0,
8803 /*IsSupportedByPragmaAttribute=*/1,
8804 /*Spellings=*/MinVectorWidthSpellings,
8805 /*ArgNames=*/MinVectorWidthArgNames) {}
8806bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8807 if (!isa<FunctionDecl>(Val: D)) {
8808 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
8809 << Attr << Attr.isRegularKeywordAttribute() << "functions";
8810 return false;
8811 }
8812 return true;
8813}
8814
8815bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8816 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8817 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8818 return false;
8819}
8820
8821void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8822 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
8823}
8824
8825bool isParamExpr(size_t N) const override {
8826 return false;
8827}
8828
8829static const ParsedAttrInfoMinVectorWidth Instance;
8830};
8831const ParsedAttrInfoMinVectorWidth ParsedAttrInfoMinVectorWidth::Instance;
8832static constexpr ParsedAttrInfo::Spelling Mips16Spellings[] = {
8833 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "mips16"},
8834 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::mips16"},
8835 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::mips16"},
8836};
8837struct ParsedAttrInfoMips16 final : public ParsedAttrInfo {
8838 constexpr ParsedAttrInfoMips16() : ParsedAttrInfo(
8839 /*AttrKind=*/ParsedAttr::AT_Mips16,
8840 /*NumArgs=*/0,
8841 /*OptArgs=*/0,
8842 /*NumArgMembers=*/0,
8843 /*HasCustomParsing=*/0,
8844 /*AcceptsExprPack=*/0,
8845 /*IsTargetSpecific=*/1,
8846 /*IsType=*/0,
8847 /*IsStmt=*/0,
8848 /*IsKnownToGCC=*/1,
8849 /*IsSupportedByPragmaAttribute=*/1,
8850 /*Spellings=*/Mips16Spellings,
8851 /*ArgNames=*/{}) {}
8852bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8853 if (!isa<FunctionDecl>(Val: D)) {
8854 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
8855 << Attr << Attr.isRegularKeywordAttribute() << "functions";
8856 return false;
8857 }
8858 return true;
8859}
8860
8861bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8862 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8863 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8864 return false;
8865}
8866
8867 using ParsedAttrInfo::diagMutualExclusion;
8868
8869 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
8870 if (const auto *A = D->getAttr<MipsInterruptAttr>()) {
8871 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
8872 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
8873return false;
8874 }
8875 if (const auto *A = D->getAttr<MicroMipsAttr>()) {
8876 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
8877 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
8878return false;
8879 }
8880 return true;
8881 }
8882
8883bool existsInTarget(const TargetInfo &Target) const override {
8884 const llvm::Triple &T = Target.getTriple(); (void)T;
8885 return true && (T.getArch() == llvm::Triple::mips || T.getArch() == llvm::Triple::mipsel);
8886}
8887
8888void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8889 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
8890}
8891
8892AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
8893 D->addAttr(A: ::new (S.Context) Mips16Attr(S.Context, Attr));
8894 return AttributeApplied;
8895}
8896
8897bool isParamExpr(size_t N) const override {
8898 return false;
8899}
8900
8901static const ParsedAttrInfoMips16 Instance;
8902};
8903const ParsedAttrInfoMips16 ParsedAttrInfoMips16::Instance;
8904static constexpr ParsedAttrInfo::Spelling MipsLongCallSpellings[] = {
8905 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "long_call"},
8906 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::long_call"},
8907 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::long_call"},
8908 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "far"},
8909 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::far"},
8910 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::far"},
8911};
8912struct ParsedAttrInfoMipsLongCall final : public ParsedAttrInfo {
8913 constexpr ParsedAttrInfoMipsLongCall() : ParsedAttrInfo(
8914 /*AttrKind=*/ParsedAttr::AT_MipsLongCall,
8915 /*NumArgs=*/0,
8916 /*OptArgs=*/0,
8917 /*NumArgMembers=*/0,
8918 /*HasCustomParsing=*/0,
8919 /*AcceptsExprPack=*/0,
8920 /*IsTargetSpecific=*/1,
8921 /*IsType=*/0,
8922 /*IsStmt=*/0,
8923 /*IsKnownToGCC=*/1,
8924 /*IsSupportedByPragmaAttribute=*/1,
8925 /*Spellings=*/MipsLongCallSpellings,
8926 /*ArgNames=*/{}) {}
8927bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
8928 if (!isa<FunctionDecl>(Val: D)) {
8929 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
8930 << Attr << Attr.isRegularKeywordAttribute() << "functions";
8931 return false;
8932 }
8933 return true;
8934}
8935
8936bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
8937 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
8938 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
8939 return false;
8940}
8941
8942 using ParsedAttrInfo::diagMutualExclusion;
8943
8944 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
8945 if (const auto *A = D->getAttr<MipsShortCallAttr>()) {
8946 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
8947 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
8948return false;
8949 }
8950 return true;
8951 }
8952
8953bool existsInTarget(const TargetInfo &Target) const override {
8954 const llvm::Triple &T = Target.getTriple(); (void)T;
8955 return true && (T.getArch() == llvm::Triple::mips || T.getArch() == llvm::Triple::mipsel || T.getArch() == llvm::Triple::mips64 || T.getArch() == llvm::Triple::mips64el);
8956}
8957
8958unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
8959 enum Spelling {
8960 GNU_long_call = 0,
8961 CXX11_gnu_long_call = 1,
8962 C23_gnu_long_call = 2,
8963 GNU_far = 3,
8964 CXX11_gnu_far = 4,
8965 C23_gnu_far = 5,
8966 SpellingNotCalculated = 15
8967
8968 };
8969
8970 unsigned Idx = Attr.getAttributeSpellingListIndex();
8971 switch (Idx) {
8972 default: llvm_unreachable("Unknown spelling list index");
8973 case 0: return GNU_long_call;
8974 case 1: return CXX11_gnu_long_call;
8975 case 2: return C23_gnu_long_call;
8976 case 3: return GNU_far;
8977 case 4: return CXX11_gnu_far;
8978 case 5: return C23_gnu_far;
8979 }
8980}
8981
8982void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
8983 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
8984}
8985
8986AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
8987 D->addAttr(A: ::new (S.Context) MipsLongCallAttr(S.Context, Attr));
8988 return AttributeApplied;
8989}
8990
8991bool isParamExpr(size_t N) const override {
8992 return false;
8993}
8994
8995static const ParsedAttrInfoMipsLongCall Instance;
8996};
8997const ParsedAttrInfoMipsLongCall ParsedAttrInfoMipsLongCall::Instance;
8998static constexpr ParsedAttrInfo::Spelling MipsShortCallSpellings[] = {
8999 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "short_call"},
9000 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::short_call"},
9001 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::short_call"},
9002 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "near"},
9003 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::near"},
9004 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::near"},
9005};
9006struct ParsedAttrInfoMipsShortCall final : public ParsedAttrInfo {
9007 constexpr ParsedAttrInfoMipsShortCall() : ParsedAttrInfo(
9008 /*AttrKind=*/ParsedAttr::AT_MipsShortCall,
9009 /*NumArgs=*/0,
9010 /*OptArgs=*/0,
9011 /*NumArgMembers=*/0,
9012 /*HasCustomParsing=*/0,
9013 /*AcceptsExprPack=*/0,
9014 /*IsTargetSpecific=*/1,
9015 /*IsType=*/0,
9016 /*IsStmt=*/0,
9017 /*IsKnownToGCC=*/1,
9018 /*IsSupportedByPragmaAttribute=*/1,
9019 /*Spellings=*/MipsShortCallSpellings,
9020 /*ArgNames=*/{}) {}
9021bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9022 if (!isa<FunctionDecl>(Val: D)) {
9023 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9024 << Attr << Attr.isRegularKeywordAttribute() << "functions";
9025 return false;
9026 }
9027 return true;
9028}
9029
9030bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9031 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9032 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9033 return false;
9034}
9035
9036 using ParsedAttrInfo::diagMutualExclusion;
9037
9038 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
9039 if (const auto *A = D->getAttr<MipsLongCallAttr>()) {
9040 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
9041 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
9042return false;
9043 }
9044 return true;
9045 }
9046
9047bool existsInTarget(const TargetInfo &Target) const override {
9048 const llvm::Triple &T = Target.getTriple(); (void)T;
9049 return true && (T.getArch() == llvm::Triple::mips || T.getArch() == llvm::Triple::mipsel || T.getArch() == llvm::Triple::mips64 || T.getArch() == llvm::Triple::mips64el);
9050}
9051
9052unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
9053 enum Spelling {
9054 GNU_short_call = 0,
9055 CXX11_gnu_short_call = 1,
9056 C23_gnu_short_call = 2,
9057 GNU_near = 3,
9058 CXX11_gnu_near = 4,
9059 C23_gnu_near = 5,
9060 SpellingNotCalculated = 15
9061
9062 };
9063
9064 unsigned Idx = Attr.getAttributeSpellingListIndex();
9065 switch (Idx) {
9066 default: llvm_unreachable("Unknown spelling list index");
9067 case 0: return GNU_short_call;
9068 case 1: return CXX11_gnu_short_call;
9069 case 2: return C23_gnu_short_call;
9070 case 3: return GNU_near;
9071 case 4: return CXX11_gnu_near;
9072 case 5: return C23_gnu_near;
9073 }
9074}
9075
9076void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9077 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
9078}
9079
9080AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
9081 D->addAttr(A: ::new (S.Context) MipsShortCallAttr(S.Context, Attr));
9082 return AttributeApplied;
9083}
9084
9085bool isParamExpr(size_t N) const override {
9086 return false;
9087}
9088
9089static const ParsedAttrInfoMipsShortCall Instance;
9090};
9091const ParsedAttrInfoMipsShortCall ParsedAttrInfoMipsShortCall::Instance;
9092static constexpr ParsedAttrInfo::Spelling ModeSpellings[] = {
9093 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "mode"},
9094 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::mode"},
9095 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::mode"},
9096};
9097static constexpr const char *ModeArgNames[] = {
9098"Mode",};
9099struct ParsedAttrInfoMode final : public ParsedAttrInfo {
9100 constexpr ParsedAttrInfoMode() : ParsedAttrInfo(
9101 /*AttrKind=*/ParsedAttr::AT_Mode,
9102 /*NumArgs=*/1,
9103 /*OptArgs=*/0,
9104 /*NumArgMembers=*/1,
9105 /*HasCustomParsing=*/0,
9106 /*AcceptsExprPack=*/0,
9107 /*IsTargetSpecific=*/0,
9108 /*IsType=*/0,
9109 /*IsStmt=*/0,
9110 /*IsKnownToGCC=*/1,
9111 /*IsSupportedByPragmaAttribute=*/0,
9112 /*Spellings=*/ModeSpellings,
9113 /*ArgNames=*/ModeArgNames) {}
9114bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9115 if (!isa<VarDecl>(Val: D) && !isa<EnumDecl>(Val: D) && !isa<TypedefNameDecl>(Val: D) && !isa<FieldDecl>(Val: D)) {
9116 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
9117 << Attr << Attr.isRegularKeywordAttribute() << "variables, enums, typedefs, and non-static data members";
9118 return false;
9119 }
9120 return true;
9121}
9122
9123bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9124 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9125 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9126 return false;
9127}
9128
9129bool isParamExpr(size_t N) const override {
9130 return false;
9131}
9132
9133static const ParsedAttrInfoMode Instance;
9134};
9135const ParsedAttrInfoMode ParsedAttrInfoMode::Instance;
9136static constexpr ParsedAttrInfo::Spelling MustTailSpellings[] = {
9137 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "musttail"},
9138 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::musttail"},
9139 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::musttail"},
9140};
9141struct ParsedAttrInfoMustTail final : public ParsedAttrInfo {
9142 constexpr ParsedAttrInfoMustTail() : ParsedAttrInfo(
9143 /*AttrKind=*/ParsedAttr::AT_MustTail,
9144 /*NumArgs=*/0,
9145 /*OptArgs=*/0,
9146 /*NumArgMembers=*/0,
9147 /*HasCustomParsing=*/0,
9148 /*AcceptsExprPack=*/0,
9149 /*IsTargetSpecific=*/0,
9150 /*IsType=*/0,
9151 /*IsStmt=*/1,
9152 /*IsKnownToGCC=*/0,
9153 /*IsSupportedByPragmaAttribute=*/0,
9154 /*Spellings=*/MustTailSpellings,
9155 /*ArgNames=*/{}) {}
9156bool diagAppertainsToDecl(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
9157 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attribute_invalid_on_decl)
9158 << AL << AL.isRegularKeywordAttribute() << D->getLocation();
9159 return false;
9160}
9161
9162bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
9163 if (!isa<ReturnStmt>(Val: St)) {
9164 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
9165 << Attr << Attr.isRegularKeywordAttribute() << "return statements";
9166 return false;
9167 }
9168 return true;
9169}
9170
9171bool isParamExpr(size_t N) const override {
9172 return false;
9173}
9174
9175static const ParsedAttrInfoMustTail Instance;
9176};
9177const ParsedAttrInfoMustTail ParsedAttrInfoMustTail::Instance;
9178static constexpr ParsedAttrInfo::Spelling NSConsumedSpellings[] = {
9179 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ns_consumed"},
9180 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::ns_consumed"},
9181 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::ns_consumed"},
9182};
9183struct ParsedAttrInfoNSConsumed final : public ParsedAttrInfo {
9184 constexpr ParsedAttrInfoNSConsumed() : ParsedAttrInfo(
9185 /*AttrKind=*/ParsedAttr::AT_NSConsumed,
9186 /*NumArgs=*/0,
9187 /*OptArgs=*/0,
9188 /*NumArgMembers=*/0,
9189 /*HasCustomParsing=*/0,
9190 /*AcceptsExprPack=*/0,
9191 /*IsTargetSpecific=*/0,
9192 /*IsType=*/0,
9193 /*IsStmt=*/0,
9194 /*IsKnownToGCC=*/0,
9195 /*IsSupportedByPragmaAttribute=*/1,
9196 /*Spellings=*/NSConsumedSpellings,
9197 /*ArgNames=*/{}) {}
9198bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9199 if (!isa<ParmVarDecl>(Val: D)) {
9200 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9201 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
9202 return false;
9203 }
9204 return true;
9205}
9206
9207bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9208 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9209 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9210 return false;
9211}
9212
9213void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9214 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
9215}
9216
9217bool isParamExpr(size_t N) const override {
9218 return false;
9219}
9220
9221static const ParsedAttrInfoNSConsumed Instance;
9222};
9223const ParsedAttrInfoNSConsumed ParsedAttrInfoNSConsumed::Instance;
9224static constexpr ParsedAttrInfo::Spelling NSConsumesSelfSpellings[] = {
9225 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ns_consumes_self"},
9226 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::ns_consumes_self"},
9227 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::ns_consumes_self"},
9228};
9229struct ParsedAttrInfoNSConsumesSelf final : public ParsedAttrInfo {
9230 constexpr ParsedAttrInfoNSConsumesSelf() : ParsedAttrInfo(
9231 /*AttrKind=*/ParsedAttr::AT_NSConsumesSelf,
9232 /*NumArgs=*/0,
9233 /*OptArgs=*/0,
9234 /*NumArgMembers=*/0,
9235 /*HasCustomParsing=*/0,
9236 /*AcceptsExprPack=*/0,
9237 /*IsTargetSpecific=*/0,
9238 /*IsType=*/0,
9239 /*IsStmt=*/0,
9240 /*IsKnownToGCC=*/0,
9241 /*IsSupportedByPragmaAttribute=*/1,
9242 /*Spellings=*/NSConsumesSelfSpellings,
9243 /*ArgNames=*/{}) {}
9244bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9245 if (!isa<ObjCMethodDecl>(Val: D)) {
9246 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9247 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods";
9248 return false;
9249 }
9250 return true;
9251}
9252
9253bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9254 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9255 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9256 return false;
9257}
9258
9259void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9260 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
9261}
9262
9263AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
9264 D->addAttr(A: ::new (S.Context) NSConsumesSelfAttr(S.Context, Attr));
9265 return AttributeApplied;
9266}
9267
9268bool isParamExpr(size_t N) const override {
9269 return false;
9270}
9271
9272static const ParsedAttrInfoNSConsumesSelf Instance;
9273};
9274const ParsedAttrInfoNSConsumesSelf ParsedAttrInfoNSConsumesSelf::Instance;
9275static constexpr ParsedAttrInfo::Spelling NSErrorDomainSpellings[] = {
9276 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ns_error_domain"},
9277};
9278static constexpr const char *NSErrorDomainArgNames[] = {
9279"ErrorDomain",};
9280struct ParsedAttrInfoNSErrorDomain final : public ParsedAttrInfo {
9281 constexpr ParsedAttrInfoNSErrorDomain() : ParsedAttrInfo(
9282 /*AttrKind=*/ParsedAttr::AT_NSErrorDomain,
9283 /*NumArgs=*/1,
9284 /*OptArgs=*/0,
9285 /*NumArgMembers=*/1,
9286 /*HasCustomParsing=*/0,
9287 /*AcceptsExprPack=*/0,
9288 /*IsTargetSpecific=*/0,
9289 /*IsType=*/0,
9290 /*IsStmt=*/0,
9291 /*IsKnownToGCC=*/0,
9292 /*IsSupportedByPragmaAttribute=*/1,
9293 /*Spellings=*/NSErrorDomainSpellings,
9294 /*ArgNames=*/NSErrorDomainArgNames) {}
9295bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9296 if (!isa<EnumDecl>(Val: D)) {
9297 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
9298 << Attr << Attr.isRegularKeywordAttribute() << "enums";
9299 return false;
9300 }
9301 return true;
9302}
9303
9304bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9305 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9306 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9307 return false;
9308}
9309
9310void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9311 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_enum, /*IsSupported=*/y: true));
9312}
9313
9314bool isParamExpr(size_t N) const override {
9315 return false;
9316}
9317
9318static const ParsedAttrInfoNSErrorDomain Instance;
9319};
9320const ParsedAttrInfoNSErrorDomain ParsedAttrInfoNSErrorDomain::Instance;
9321static constexpr ParsedAttrInfo::Spelling NSReturnsAutoreleasedSpellings[] = {
9322 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ns_returns_autoreleased"},
9323 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::ns_returns_autoreleased"},
9324 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::ns_returns_autoreleased"},
9325};
9326struct ParsedAttrInfoNSReturnsAutoreleased final : public ParsedAttrInfo {
9327 constexpr ParsedAttrInfoNSReturnsAutoreleased() : ParsedAttrInfo(
9328 /*AttrKind=*/ParsedAttr::AT_NSReturnsAutoreleased,
9329 /*NumArgs=*/0,
9330 /*OptArgs=*/0,
9331 /*NumArgMembers=*/0,
9332 /*HasCustomParsing=*/0,
9333 /*AcceptsExprPack=*/0,
9334 /*IsTargetSpecific=*/0,
9335 /*IsType=*/0,
9336 /*IsStmt=*/0,
9337 /*IsKnownToGCC=*/0,
9338 /*IsSupportedByPragmaAttribute=*/0,
9339 /*Spellings=*/NSReturnsAutoreleasedSpellings,
9340 /*ArgNames=*/{}) {}
9341bool isParamExpr(size_t N) const override {
9342 return false;
9343}
9344
9345static const ParsedAttrInfoNSReturnsAutoreleased Instance;
9346};
9347const ParsedAttrInfoNSReturnsAutoreleased ParsedAttrInfoNSReturnsAutoreleased::Instance;
9348static constexpr ParsedAttrInfo::Spelling NSReturnsNotRetainedSpellings[] = {
9349 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ns_returns_not_retained"},
9350 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::ns_returns_not_retained"},
9351 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::ns_returns_not_retained"},
9352};
9353struct ParsedAttrInfoNSReturnsNotRetained final : public ParsedAttrInfo {
9354 constexpr ParsedAttrInfoNSReturnsNotRetained() : ParsedAttrInfo(
9355 /*AttrKind=*/ParsedAttr::AT_NSReturnsNotRetained,
9356 /*NumArgs=*/0,
9357 /*OptArgs=*/0,
9358 /*NumArgMembers=*/0,
9359 /*HasCustomParsing=*/0,
9360 /*AcceptsExprPack=*/0,
9361 /*IsTargetSpecific=*/0,
9362 /*IsType=*/0,
9363 /*IsStmt=*/0,
9364 /*IsKnownToGCC=*/0,
9365 /*IsSupportedByPragmaAttribute=*/0,
9366 /*Spellings=*/NSReturnsNotRetainedSpellings,
9367 /*ArgNames=*/{}) {}
9368bool isParamExpr(size_t N) const override {
9369 return false;
9370}
9371
9372static const ParsedAttrInfoNSReturnsNotRetained Instance;
9373};
9374const ParsedAttrInfoNSReturnsNotRetained ParsedAttrInfoNSReturnsNotRetained::Instance;
9375static constexpr ParsedAttrInfo::Spelling NSReturnsRetainedSpellings[] = {
9376 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ns_returns_retained"},
9377 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::ns_returns_retained"},
9378 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::ns_returns_retained"},
9379};
9380struct ParsedAttrInfoNSReturnsRetained final : public ParsedAttrInfo {
9381 constexpr ParsedAttrInfoNSReturnsRetained() : ParsedAttrInfo(
9382 /*AttrKind=*/ParsedAttr::AT_NSReturnsRetained,
9383 /*NumArgs=*/0,
9384 /*OptArgs=*/0,
9385 /*NumArgMembers=*/0,
9386 /*HasCustomParsing=*/0,
9387 /*AcceptsExprPack=*/0,
9388 /*IsTargetSpecific=*/0,
9389 /*IsType=*/1,
9390 /*IsStmt=*/0,
9391 /*IsKnownToGCC=*/0,
9392 /*IsSupportedByPragmaAttribute=*/0,
9393 /*Spellings=*/NSReturnsRetainedSpellings,
9394 /*ArgNames=*/{}) {}
9395bool isParamExpr(size_t N) const override {
9396 return false;
9397}
9398
9399static const ParsedAttrInfoNSReturnsRetained Instance;
9400};
9401const ParsedAttrInfoNSReturnsRetained ParsedAttrInfoNSReturnsRetained::Instance;
9402static constexpr ParsedAttrInfo::Spelling NVPTXKernelSpellings[] = {
9403 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nvptx_kernel"},
9404 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::nvptx_kernel"},
9405 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::nvptx_kernel"},
9406};
9407struct ParsedAttrInfoNVPTXKernel final : public ParsedAttrInfo {
9408 constexpr ParsedAttrInfoNVPTXKernel() : ParsedAttrInfo(
9409 /*AttrKind=*/ParsedAttr::AT_NVPTXKernel,
9410 /*NumArgs=*/0,
9411 /*OptArgs=*/0,
9412 /*NumArgMembers=*/0,
9413 /*HasCustomParsing=*/0,
9414 /*AcceptsExprPack=*/0,
9415 /*IsTargetSpecific=*/1,
9416 /*IsType=*/0,
9417 /*IsStmt=*/0,
9418 /*IsKnownToGCC=*/0,
9419 /*IsSupportedByPragmaAttribute=*/1,
9420 /*Spellings=*/NVPTXKernelSpellings,
9421 /*ArgNames=*/{}) {}
9422bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9423 if (!isa<FunctionDecl>(Val: D)) {
9424 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9425 << Attr << Attr.isRegularKeywordAttribute() << "functions";
9426 return false;
9427 }
9428 return true;
9429}
9430
9431bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9432 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9433 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9434 return false;
9435}
9436
9437bool existsInTarget(const TargetInfo &Target) const override {
9438 const llvm::Triple &T = Target.getTriple(); (void)T;
9439 return true && (T.getArch() == llvm::Triple::nvptx || T.getArch() == llvm::Triple::nvptx64);
9440}
9441
9442void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9443 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
9444}
9445
9446bool isParamExpr(size_t N) const override {
9447 return false;
9448}
9449
9450static const ParsedAttrInfoNVPTXKernel Instance;
9451};
9452const ParsedAttrInfoNVPTXKernel ParsedAttrInfoNVPTXKernel::Instance;
9453static constexpr ParsedAttrInfo::Spelling NakedSpellings[] = {
9454 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "naked"},
9455 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::naked"},
9456 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::naked"},
9457 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "naked"},
9458};
9459struct ParsedAttrInfoNaked final : public ParsedAttrInfo {
9460 constexpr ParsedAttrInfoNaked() : ParsedAttrInfo(
9461 /*AttrKind=*/ParsedAttr::AT_Naked,
9462 /*NumArgs=*/0,
9463 /*OptArgs=*/0,
9464 /*NumArgMembers=*/0,
9465 /*HasCustomParsing=*/0,
9466 /*AcceptsExprPack=*/0,
9467 /*IsTargetSpecific=*/0,
9468 /*IsType=*/0,
9469 /*IsStmt=*/0,
9470 /*IsKnownToGCC=*/1,
9471 /*IsSupportedByPragmaAttribute=*/1,
9472 /*Spellings=*/NakedSpellings,
9473 /*ArgNames=*/{}) {}
9474bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9475 if (!isa<FunctionDecl>(Val: D)) {
9476 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9477 << Attr << Attr.isRegularKeywordAttribute() << "functions";
9478 return false;
9479 }
9480 return true;
9481}
9482
9483bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9484 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9485 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9486 return false;
9487}
9488
9489 using ParsedAttrInfo::diagMutualExclusion;
9490
9491 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
9492 if (const auto *A = D->getAttr<DisableTailCallsAttr>()) {
9493 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
9494 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
9495return false;
9496 }
9497 return true;
9498 }
9499
9500void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9501 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
9502}
9503
9504bool isParamExpr(size_t N) const override {
9505 return false;
9506}
9507
9508static const ParsedAttrInfoNaked Instance;
9509};
9510const ParsedAttrInfoNaked ParsedAttrInfoNaked::Instance;
9511static constexpr ParsedAttrInfo::Spelling NeonPolyVectorTypeSpellings[] = {
9512 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "neon_polyvector_type"},
9513 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::neon_polyvector_type"},
9514 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::neon_polyvector_type"},
9515};
9516static constexpr const char *NeonPolyVectorTypeArgNames[] = {
9517"NumElements",};
9518struct ParsedAttrInfoNeonPolyVectorType final : public ParsedAttrInfo {
9519 constexpr ParsedAttrInfoNeonPolyVectorType() : ParsedAttrInfo(
9520 /*AttrKind=*/ParsedAttr::AT_NeonPolyVectorType,
9521 /*NumArgs=*/1,
9522 /*OptArgs=*/0,
9523 /*NumArgMembers=*/1,
9524 /*HasCustomParsing=*/0,
9525 /*AcceptsExprPack=*/0,
9526 /*IsTargetSpecific=*/0,
9527 /*IsType=*/1,
9528 /*IsStmt=*/0,
9529 /*IsKnownToGCC=*/0,
9530 /*IsSupportedByPragmaAttribute=*/0,
9531 /*Spellings=*/NeonPolyVectorTypeSpellings,
9532 /*ArgNames=*/NeonPolyVectorTypeArgNames) {}
9533bool isParamExpr(size_t N) const override {
9534 return false;
9535}
9536
9537static const ParsedAttrInfoNeonPolyVectorType Instance;
9538};
9539const ParsedAttrInfoNeonPolyVectorType ParsedAttrInfoNeonPolyVectorType::Instance;
9540static constexpr ParsedAttrInfo::Spelling NeonVectorTypeSpellings[] = {
9541 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "neon_vector_type"},
9542 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::neon_vector_type"},
9543 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::neon_vector_type"},
9544};
9545static constexpr const char *NeonVectorTypeArgNames[] = {
9546"NumElements",};
9547struct ParsedAttrInfoNeonVectorType final : public ParsedAttrInfo {
9548 constexpr ParsedAttrInfoNeonVectorType() : ParsedAttrInfo(
9549 /*AttrKind=*/ParsedAttr::AT_NeonVectorType,
9550 /*NumArgs=*/1,
9551 /*OptArgs=*/0,
9552 /*NumArgMembers=*/1,
9553 /*HasCustomParsing=*/0,
9554 /*AcceptsExprPack=*/0,
9555 /*IsTargetSpecific=*/0,
9556 /*IsType=*/1,
9557 /*IsStmt=*/0,
9558 /*IsKnownToGCC=*/0,
9559 /*IsSupportedByPragmaAttribute=*/0,
9560 /*Spellings=*/NeonVectorTypeSpellings,
9561 /*ArgNames=*/NeonVectorTypeArgNames) {}
9562bool isParamExpr(size_t N) const override {
9563 return false;
9564}
9565
9566static const ParsedAttrInfoNeonVectorType Instance;
9567};
9568const ParsedAttrInfoNeonVectorType ParsedAttrInfoNeonVectorType::Instance;
9569static constexpr ParsedAttrInfo::Spelling NoAliasSpellings[] = {
9570 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "noalias"},
9571};
9572struct ParsedAttrInfoNoAlias final : public ParsedAttrInfo {
9573 constexpr ParsedAttrInfoNoAlias() : ParsedAttrInfo(
9574 /*AttrKind=*/ParsedAttr::AT_NoAlias,
9575 /*NumArgs=*/0,
9576 /*OptArgs=*/0,
9577 /*NumArgMembers=*/0,
9578 /*HasCustomParsing=*/0,
9579 /*AcceptsExprPack=*/0,
9580 /*IsTargetSpecific=*/0,
9581 /*IsType=*/0,
9582 /*IsStmt=*/0,
9583 /*IsKnownToGCC=*/0,
9584 /*IsSupportedByPragmaAttribute=*/0,
9585 /*Spellings=*/NoAliasSpellings,
9586 /*ArgNames=*/{}) {}
9587bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9588 if (!isa<FunctionDecl>(Val: D)) {
9589 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9590 << Attr << Attr.isRegularKeywordAttribute() << "functions";
9591 return false;
9592 }
9593 return true;
9594}
9595
9596bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9597 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9598 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9599 return false;
9600}
9601
9602AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
9603 D->addAttr(A: ::new (S.Context) NoAliasAttr(S.Context, Attr));
9604 return AttributeApplied;
9605}
9606
9607bool isParamExpr(size_t N) const override {
9608 return false;
9609}
9610
9611static const ParsedAttrInfoNoAlias Instance;
9612};
9613const ParsedAttrInfoNoAlias ParsedAttrInfoNoAlias::Instance;
9614static constexpr ParsedAttrInfo::Spelling NoBuiltinSpellings[] = {
9615 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_builtin"},
9616 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::no_builtin"},
9617 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::no_builtin"},
9618};
9619static constexpr const char *NoBuiltinArgNames[] = {
9620"BuiltinNames...",};
9621struct ParsedAttrInfoNoBuiltin final : public ParsedAttrInfo {
9622 constexpr ParsedAttrInfoNoBuiltin() : ParsedAttrInfo(
9623 /*AttrKind=*/ParsedAttr::AT_NoBuiltin,
9624 /*NumArgs=*/0,
9625 /*OptArgs=*/15,
9626 /*NumArgMembers=*/1,
9627 /*HasCustomParsing=*/0,
9628 /*AcceptsExprPack=*/0,
9629 /*IsTargetSpecific=*/0,
9630 /*IsType=*/0,
9631 /*IsStmt=*/0,
9632 /*IsKnownToGCC=*/0,
9633 /*IsSupportedByPragmaAttribute=*/1,
9634 /*Spellings=*/NoBuiltinSpellings,
9635 /*ArgNames=*/NoBuiltinArgNames) {}
9636bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9637 if (!isa<FunctionDecl>(Val: D)) {
9638 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9639 << Attr << Attr.isRegularKeywordAttribute() << "functions";
9640 return false;
9641 }
9642 return true;
9643}
9644
9645bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9646 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9647 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9648 return false;
9649}
9650
9651void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9652 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
9653}
9654
9655bool isParamExpr(size_t N) const override {
9656 return false;
9657}
9658
9659static const ParsedAttrInfoNoBuiltin Instance;
9660};
9661const ParsedAttrInfoNoBuiltin ParsedAttrInfoNoBuiltin::Instance;
9662static constexpr ParsedAttrInfo::Spelling NoCommonSpellings[] = {
9663 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nocommon"},
9664 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::nocommon"},
9665 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::nocommon"},
9666};
9667struct ParsedAttrInfoNoCommon final : public ParsedAttrInfo {
9668 constexpr ParsedAttrInfoNoCommon() : ParsedAttrInfo(
9669 /*AttrKind=*/ParsedAttr::AT_NoCommon,
9670 /*NumArgs=*/0,
9671 /*OptArgs=*/0,
9672 /*NumArgMembers=*/0,
9673 /*HasCustomParsing=*/0,
9674 /*AcceptsExprPack=*/0,
9675 /*IsTargetSpecific=*/0,
9676 /*IsType=*/0,
9677 /*IsStmt=*/0,
9678 /*IsKnownToGCC=*/1,
9679 /*IsSupportedByPragmaAttribute=*/1,
9680 /*Spellings=*/NoCommonSpellings,
9681 /*ArgNames=*/{}) {}
9682bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9683 if (!isa<VarDecl>(Val: D)) {
9684 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9685 << Attr << Attr.isRegularKeywordAttribute() << "variables";
9686 return false;
9687 }
9688 return true;
9689}
9690
9691bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9692 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9693 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9694 return false;
9695}
9696
9697void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9698 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
9699}
9700
9701AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
9702 D->addAttr(A: ::new (S.Context) NoCommonAttr(S.Context, Attr));
9703 return AttributeApplied;
9704}
9705
9706bool isParamExpr(size_t N) const override {
9707 return false;
9708}
9709
9710static const ParsedAttrInfoNoCommon Instance;
9711};
9712const ParsedAttrInfoNoCommon ParsedAttrInfoNoCommon::Instance;
9713static constexpr ParsedAttrInfo::Spelling NoDebugSpellings[] = {
9714 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nodebug"},
9715 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::nodebug"},
9716 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::nodebug"},
9717};
9718struct ParsedAttrInfoNoDebug final : public ParsedAttrInfo {
9719 constexpr ParsedAttrInfoNoDebug() : ParsedAttrInfo(
9720 /*AttrKind=*/ParsedAttr::AT_NoDebug,
9721 /*NumArgs=*/0,
9722 /*OptArgs=*/0,
9723 /*NumArgMembers=*/0,
9724 /*HasCustomParsing=*/0,
9725 /*AcceptsExprPack=*/0,
9726 /*IsTargetSpecific=*/0,
9727 /*IsType=*/0,
9728 /*IsStmt=*/0,
9729 /*IsKnownToGCC=*/1,
9730 /*IsSupportedByPragmaAttribute=*/1,
9731 /*Spellings=*/NoDebugSpellings,
9732 /*ArgNames=*/{}) {}
9733bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9734 if (!isa<TypedefNameDecl>(Val: D) && !isFunctionLike(D) && !isa<ObjCMethodDecl>(Val: D) && !isNonParmVar(D)) {
9735 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9736 << Attr << Attr.isRegularKeywordAttribute() << "typedefs, functions, function pointers, Objective-C methods, and variables";
9737 return false;
9738 }
9739 return true;
9740}
9741
9742bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9743 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9744 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9745 return false;
9746}
9747
9748void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9749 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
9750 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/y: true));
9751 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
9752 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_not_is_parameter, /*IsSupported=*/y: true));
9753}
9754
9755bool isParamExpr(size_t N) const override {
9756 return false;
9757}
9758
9759static const ParsedAttrInfoNoDebug Instance;
9760};
9761const ParsedAttrInfoNoDebug ParsedAttrInfoNoDebug::Instance;
9762static constexpr ParsedAttrInfo::Spelling NoDerefSpellings[] = {
9763 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "noderef"},
9764 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::noderef"},
9765 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::noderef"},
9766};
9767struct ParsedAttrInfoNoDeref final : public ParsedAttrInfo {
9768 constexpr ParsedAttrInfoNoDeref() : ParsedAttrInfo(
9769 /*AttrKind=*/ParsedAttr::AT_NoDeref,
9770 /*NumArgs=*/0,
9771 /*OptArgs=*/0,
9772 /*NumArgMembers=*/0,
9773 /*HasCustomParsing=*/0,
9774 /*AcceptsExprPack=*/0,
9775 /*IsTargetSpecific=*/0,
9776 /*IsType=*/1,
9777 /*IsStmt=*/0,
9778 /*IsKnownToGCC=*/0,
9779 /*IsSupportedByPragmaAttribute=*/0,
9780 /*Spellings=*/NoDerefSpellings,
9781 /*ArgNames=*/{}) {}
9782bool isParamExpr(size_t N) const override {
9783 return false;
9784}
9785
9786static const ParsedAttrInfoNoDeref Instance;
9787};
9788const ParsedAttrInfoNoDeref ParsedAttrInfoNoDeref::Instance;
9789static constexpr ParsedAttrInfo::Spelling NoDestroySpellings[] = {
9790 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_destroy"},
9791 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::no_destroy"},
9792};
9793struct ParsedAttrInfoNoDestroy final : public ParsedAttrInfo {
9794 constexpr ParsedAttrInfoNoDestroy() : ParsedAttrInfo(
9795 /*AttrKind=*/ParsedAttr::AT_NoDestroy,
9796 /*NumArgs=*/0,
9797 /*OptArgs=*/0,
9798 /*NumArgMembers=*/0,
9799 /*HasCustomParsing=*/0,
9800 /*AcceptsExprPack=*/0,
9801 /*IsTargetSpecific=*/0,
9802 /*IsType=*/0,
9803 /*IsStmt=*/0,
9804 /*IsKnownToGCC=*/0,
9805 /*IsSupportedByPragmaAttribute=*/1,
9806 /*Spellings=*/NoDestroySpellings,
9807 /*ArgNames=*/{}) {}
9808bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9809 if (!isa<VarDecl>(Val: D)) {
9810 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9811 << Attr << Attr.isRegularKeywordAttribute() << "variables";
9812 return false;
9813 }
9814 return true;
9815}
9816
9817bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9818 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9819 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9820 return false;
9821}
9822
9823 using ParsedAttrInfo::diagMutualExclusion;
9824
9825 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
9826 if (const auto *A = D->getAttr<AlwaysDestroyAttr>()) {
9827 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
9828 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
9829return false;
9830 }
9831 return true;
9832 }
9833
9834void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9835 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
9836}
9837
9838bool isParamExpr(size_t N) const override {
9839 return false;
9840}
9841
9842static const ParsedAttrInfoNoDestroy Instance;
9843};
9844const ParsedAttrInfoNoDestroy ParsedAttrInfoNoDestroy::Instance;
9845static constexpr ParsedAttrInfo::Spelling NoDuplicateSpellings[] = {
9846 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "noduplicate"},
9847 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::noduplicate"},
9848 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::noduplicate"},
9849};
9850struct ParsedAttrInfoNoDuplicate final : public ParsedAttrInfo {
9851 constexpr ParsedAttrInfoNoDuplicate() : ParsedAttrInfo(
9852 /*AttrKind=*/ParsedAttr::AT_NoDuplicate,
9853 /*NumArgs=*/0,
9854 /*OptArgs=*/0,
9855 /*NumArgMembers=*/0,
9856 /*HasCustomParsing=*/0,
9857 /*AcceptsExprPack=*/0,
9858 /*IsTargetSpecific=*/0,
9859 /*IsType=*/0,
9860 /*IsStmt=*/0,
9861 /*IsKnownToGCC=*/0,
9862 /*IsSupportedByPragmaAttribute=*/1,
9863 /*Spellings=*/NoDuplicateSpellings,
9864 /*ArgNames=*/{}) {}
9865bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9866 if (!isa<FunctionDecl>(Val: D)) {
9867 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9868 << Attr << Attr.isRegularKeywordAttribute() << "functions";
9869 return false;
9870 }
9871 return true;
9872}
9873
9874bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9875 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9876 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9877 return false;
9878}
9879
9880void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9881 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
9882}
9883
9884AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
9885 D->addAttr(A: ::new (S.Context) NoDuplicateAttr(S.Context, Attr));
9886 return AttributeApplied;
9887}
9888
9889bool isParamExpr(size_t N) const override {
9890 return false;
9891}
9892
9893static const ParsedAttrInfoNoDuplicate Instance;
9894};
9895const ParsedAttrInfoNoDuplicate ParsedAttrInfoNoDuplicate::Instance;
9896static constexpr ParsedAttrInfo::Spelling NoEscapeSpellings[] = {
9897 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "noescape"},
9898 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::noescape"},
9899 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::noescape"},
9900};
9901struct ParsedAttrInfoNoEscape final : public ParsedAttrInfo {
9902 constexpr ParsedAttrInfoNoEscape() : ParsedAttrInfo(
9903 /*AttrKind=*/ParsedAttr::AT_NoEscape,
9904 /*NumArgs=*/0,
9905 /*OptArgs=*/0,
9906 /*NumArgMembers=*/0,
9907 /*HasCustomParsing=*/0,
9908 /*AcceptsExprPack=*/0,
9909 /*IsTargetSpecific=*/0,
9910 /*IsType=*/0,
9911 /*IsStmt=*/0,
9912 /*IsKnownToGCC=*/0,
9913 /*IsSupportedByPragmaAttribute=*/1,
9914 /*Spellings=*/NoEscapeSpellings,
9915 /*ArgNames=*/{}) {}
9916bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9917 if (!isa<ParmVarDecl>(Val: D)) {
9918 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9919 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
9920 return false;
9921 }
9922 return true;
9923}
9924
9925bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
9926 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
9927 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
9928 return false;
9929}
9930
9931void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9932 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
9933}
9934
9935bool isParamExpr(size_t N) const override {
9936 return false;
9937}
9938
9939static const ParsedAttrInfoNoEscape Instance;
9940};
9941const ParsedAttrInfoNoEscape ParsedAttrInfoNoEscape::Instance;
9942static constexpr ParsedAttrInfo::Spelling NoInlineSpellings[] = {
9943 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__noinline__"},
9944 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "noinline"},
9945 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::noinline"},
9946 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::noinline"},
9947 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::noinline"},
9948 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::noinline"},
9949 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "msvc::noinline"},
9950 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "msvc::noinline"},
9951 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "noinline"},
9952};
9953struct ParsedAttrInfoNoInline final : public ParsedAttrInfo {
9954 constexpr ParsedAttrInfoNoInline() : ParsedAttrInfo(
9955 /*AttrKind=*/ParsedAttr::AT_NoInline,
9956 /*NumArgs=*/0,
9957 /*OptArgs=*/0,
9958 /*NumArgMembers=*/0,
9959 /*HasCustomParsing=*/0,
9960 /*AcceptsExprPack=*/0,
9961 /*IsTargetSpecific=*/0,
9962 /*IsType=*/0,
9963 /*IsStmt=*/1,
9964 /*IsKnownToGCC=*/1,
9965 /*IsSupportedByPragmaAttribute=*/1,
9966 /*Spellings=*/NoInlineSpellings,
9967 /*ArgNames=*/{}) {}
9968bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
9969 if (!isa<FunctionDecl>(Val: D)) {
9970 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9971 << Attr << Attr.isRegularKeywordAttribute() << "functions and statements";
9972 return false;
9973 }
9974 return true;
9975}
9976
9977bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
9978 if (!isa<Stmt>(Val: St)) {
9979 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
9980 << Attr << Attr.isRegularKeywordAttribute() << "functions and statements";
9981 return false;
9982 }
9983 return true;
9984}
9985
9986void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
9987 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
9988}
9989
9990AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
9991 D->addAttr(A: ::new (S.Context) NoInlineAttr(S.Context, Attr));
9992 return AttributeApplied;
9993}
9994
9995bool isParamExpr(size_t N) const override {
9996 return false;
9997}
9998
9999static const ParsedAttrInfoNoInline Instance;
10000};
10001const ParsedAttrInfoNoInline ParsedAttrInfoNoInline::Instance;
10002static constexpr ParsedAttrInfo::Spelling NoInstrumentFunctionSpellings[] = {
10003 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_instrument_function"},
10004 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::no_instrument_function"},
10005 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::no_instrument_function"},
10006};
10007struct ParsedAttrInfoNoInstrumentFunction final : public ParsedAttrInfo {
10008 constexpr ParsedAttrInfoNoInstrumentFunction() : ParsedAttrInfo(
10009 /*AttrKind=*/ParsedAttr::AT_NoInstrumentFunction,
10010 /*NumArgs=*/0,
10011 /*OptArgs=*/0,
10012 /*NumArgMembers=*/0,
10013 /*HasCustomParsing=*/0,
10014 /*AcceptsExprPack=*/0,
10015 /*IsTargetSpecific=*/0,
10016 /*IsType=*/0,
10017 /*IsStmt=*/0,
10018 /*IsKnownToGCC=*/1,
10019 /*IsSupportedByPragmaAttribute=*/1,
10020 /*Spellings=*/NoInstrumentFunctionSpellings,
10021 /*ArgNames=*/{}) {}
10022bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10023 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
10024 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
10025 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
10026 return false;
10027 }
10028 return true;
10029}
10030
10031bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10032 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10033 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10034 return false;
10035}
10036
10037void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10038 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10039 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
10040}
10041
10042AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
10043 D->addAttr(A: ::new (S.Context) NoInstrumentFunctionAttr(S.Context, Attr));
10044 return AttributeApplied;
10045}
10046
10047bool isParamExpr(size_t N) const override {
10048 return false;
10049}
10050
10051static const ParsedAttrInfoNoInstrumentFunction Instance;
10052};
10053const ParsedAttrInfoNoInstrumentFunction ParsedAttrInfoNoInstrumentFunction::Instance;
10054static constexpr ParsedAttrInfo::Spelling NoMergeSpellings[] = {
10055 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nomerge"},
10056 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::nomerge"},
10057 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::nomerge"},
10058};
10059struct ParsedAttrInfoNoMerge final : public ParsedAttrInfo {
10060 constexpr ParsedAttrInfoNoMerge() : ParsedAttrInfo(
10061 /*AttrKind=*/ParsedAttr::AT_NoMerge,
10062 /*NumArgs=*/0,
10063 /*OptArgs=*/0,
10064 /*NumArgMembers=*/0,
10065 /*HasCustomParsing=*/0,
10066 /*AcceptsExprPack=*/0,
10067 /*IsTargetSpecific=*/0,
10068 /*IsType=*/0,
10069 /*IsStmt=*/1,
10070 /*IsKnownToGCC=*/0,
10071 /*IsSupportedByPragmaAttribute=*/1,
10072 /*Spellings=*/NoMergeSpellings,
10073 /*ArgNames=*/{}) {}
10074bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10075 if (!isa<FunctionDecl>(Val: D) && !isa<VarDecl>(Val: D)) {
10076 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
10077 << Attr << Attr.isRegularKeywordAttribute() << "functions, statements and variables";
10078 return false;
10079 }
10080 return true;
10081}
10082
10083bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
10084 if (!isa<Stmt>(Val: St)) {
10085 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
10086 << Attr << Attr.isRegularKeywordAttribute() << "functions, statements and variables";
10087 return false;
10088 }
10089 return true;
10090}
10091
10092void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10093 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10094 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
10095}
10096
10097bool isParamExpr(size_t N) const override {
10098 return false;
10099}
10100
10101static const ParsedAttrInfoNoMerge Instance;
10102};
10103const ParsedAttrInfoNoMerge ParsedAttrInfoNoMerge::Instance;
10104static constexpr ParsedAttrInfo::Spelling NoMicroMipsSpellings[] = {
10105 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nomicromips"},
10106 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::nomicromips"},
10107 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::nomicromips"},
10108};
10109struct ParsedAttrInfoNoMicroMips final : public ParsedAttrInfo {
10110 constexpr ParsedAttrInfoNoMicroMips() : ParsedAttrInfo(
10111 /*AttrKind=*/ParsedAttr::AT_NoMicroMips,
10112 /*NumArgs=*/0,
10113 /*OptArgs=*/0,
10114 /*NumArgMembers=*/0,
10115 /*HasCustomParsing=*/0,
10116 /*AcceptsExprPack=*/0,
10117 /*IsTargetSpecific=*/1,
10118 /*IsType=*/0,
10119 /*IsStmt=*/0,
10120 /*IsKnownToGCC=*/1,
10121 /*IsSupportedByPragmaAttribute=*/1,
10122 /*Spellings=*/NoMicroMipsSpellings,
10123 /*ArgNames=*/{}) {}
10124bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10125 if (!isa<FunctionDecl>(Val: D)) {
10126 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
10127 << Attr << Attr.isRegularKeywordAttribute() << "functions";
10128 return false;
10129 }
10130 return true;
10131}
10132
10133bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10134 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10135 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10136 return false;
10137}
10138
10139bool existsInTarget(const TargetInfo &Target) const override {
10140 const llvm::Triple &T = Target.getTriple(); (void)T;
10141 return true && (T.getArch() == llvm::Triple::mips || T.getArch() == llvm::Triple::mipsel);
10142}
10143
10144void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10145 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10146}
10147
10148AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
10149 D->addAttr(A: ::new (S.Context) NoMicroMipsAttr(S.Context, Attr));
10150 return AttributeApplied;
10151}
10152
10153bool isParamExpr(size_t N) const override {
10154 return false;
10155}
10156
10157static const ParsedAttrInfoNoMicroMips Instance;
10158};
10159const ParsedAttrInfoNoMicroMips ParsedAttrInfoNoMicroMips::Instance;
10160static constexpr ParsedAttrInfo::Spelling NoMips16Spellings[] = {
10161 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nomips16"},
10162 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::nomips16"},
10163 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::nomips16"},
10164};
10165struct ParsedAttrInfoNoMips16 final : public ParsedAttrInfo {
10166 constexpr ParsedAttrInfoNoMips16() : ParsedAttrInfo(
10167 /*AttrKind=*/ParsedAttr::AT_NoMips16,
10168 /*NumArgs=*/0,
10169 /*OptArgs=*/0,
10170 /*NumArgMembers=*/0,
10171 /*HasCustomParsing=*/0,
10172 /*AcceptsExprPack=*/0,
10173 /*IsTargetSpecific=*/1,
10174 /*IsType=*/0,
10175 /*IsStmt=*/0,
10176 /*IsKnownToGCC=*/1,
10177 /*IsSupportedByPragmaAttribute=*/1,
10178 /*Spellings=*/NoMips16Spellings,
10179 /*ArgNames=*/{}) {}
10180bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10181 if (!isa<FunctionDecl>(Val: D)) {
10182 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
10183 << Attr << Attr.isRegularKeywordAttribute() << "functions";
10184 return false;
10185 }
10186 return true;
10187}
10188
10189bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10190 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10191 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10192 return false;
10193}
10194
10195bool existsInTarget(const TargetInfo &Target) const override {
10196 const llvm::Triple &T = Target.getTriple(); (void)T;
10197 return true && (T.getArch() == llvm::Triple::mips || T.getArch() == llvm::Triple::mipsel);
10198}
10199
10200void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10201 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10202}
10203
10204AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
10205 D->addAttr(A: ::new (S.Context) NoMips16Attr(S.Context, Attr));
10206 return AttributeApplied;
10207}
10208
10209bool isParamExpr(size_t N) const override {
10210 return false;
10211}
10212
10213static const ParsedAttrInfoNoMips16 Instance;
10214};
10215const ParsedAttrInfoNoMips16 ParsedAttrInfoNoMips16::Instance;
10216static constexpr ParsedAttrInfo::Spelling NoProfileFunctionSpellings[] = {
10217 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_profile_instrument_function"},
10218 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::no_profile_instrument_function"},
10219 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::no_profile_instrument_function"},
10220};
10221struct ParsedAttrInfoNoProfileFunction final : public ParsedAttrInfo {
10222 constexpr ParsedAttrInfoNoProfileFunction() : ParsedAttrInfo(
10223 /*AttrKind=*/ParsedAttr::AT_NoProfileFunction,
10224 /*NumArgs=*/0,
10225 /*OptArgs=*/0,
10226 /*NumArgMembers=*/0,
10227 /*HasCustomParsing=*/0,
10228 /*AcceptsExprPack=*/0,
10229 /*IsTargetSpecific=*/0,
10230 /*IsType=*/0,
10231 /*IsStmt=*/0,
10232 /*IsKnownToGCC=*/1,
10233 /*IsSupportedByPragmaAttribute=*/1,
10234 /*Spellings=*/NoProfileFunctionSpellings,
10235 /*ArgNames=*/{}) {}
10236bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10237 if (!isa<FunctionDecl>(Val: D)) {
10238 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
10239 << Attr << Attr.isRegularKeywordAttribute() << "functions";
10240 return false;
10241 }
10242 return true;
10243}
10244
10245bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10246 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10247 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10248 return false;
10249}
10250
10251void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10252 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10253}
10254
10255AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
10256 D->addAttr(A: ::new (S.Context) NoProfileFunctionAttr(S.Context, Attr));
10257 return AttributeApplied;
10258}
10259
10260bool isParamExpr(size_t N) const override {
10261 return false;
10262}
10263
10264static const ParsedAttrInfoNoProfileFunction Instance;
10265};
10266const ParsedAttrInfoNoProfileFunction ParsedAttrInfoNoProfileFunction::Instance;
10267static constexpr ParsedAttrInfo::Spelling NoRandomizeLayoutSpellings[] = {
10268 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_randomize_layout"},
10269 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::no_randomize_layout"},
10270 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::no_randomize_layout"},
10271};
10272struct ParsedAttrInfoNoRandomizeLayout final : public ParsedAttrInfo {
10273 constexpr ParsedAttrInfoNoRandomizeLayout() : ParsedAttrInfo(
10274 /*AttrKind=*/ParsedAttr::AT_NoRandomizeLayout,
10275 /*NumArgs=*/0,
10276 /*OptArgs=*/0,
10277 /*NumArgMembers=*/0,
10278 /*HasCustomParsing=*/0,
10279 /*AcceptsExprPack=*/0,
10280 /*IsTargetSpecific=*/0,
10281 /*IsType=*/0,
10282 /*IsStmt=*/0,
10283 /*IsKnownToGCC=*/1,
10284 /*IsSupportedByPragmaAttribute=*/1,
10285 /*Spellings=*/NoRandomizeLayoutSpellings,
10286 /*ArgNames=*/{}) {}
10287bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10288 if (!isa<RecordDecl>(Val: D)) {
10289 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
10290 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
10291 return false;
10292 }
10293 return true;
10294}
10295
10296bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10297 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10298 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10299 return false;
10300}
10301
10302 using ParsedAttrInfo::diagMutualExclusion;
10303
10304 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
10305 if (const auto *A = D->getAttr<RandomizeLayoutAttr>()) {
10306 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
10307 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
10308return false;
10309 }
10310 return true;
10311 }
10312
10313bool acceptsLangOpts(const LangOptions &LangOpts) const override {
10314 return (!LangOpts.CPlusPlus);
10315}
10316
10317void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10318 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
10319}
10320
10321bool isParamExpr(size_t N) const override {
10322 return false;
10323}
10324
10325static const ParsedAttrInfoNoRandomizeLayout Instance;
10326};
10327const ParsedAttrInfoNoRandomizeLayout ParsedAttrInfoNoRandomizeLayout::Instance;
10328static constexpr ParsedAttrInfo::Spelling NoReturnSpellings[] = {
10329 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "noreturn"},
10330 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::noreturn"},
10331 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::noreturn"},
10332 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "noreturn"},
10333};
10334struct ParsedAttrInfoNoReturn final : public ParsedAttrInfo {
10335 constexpr ParsedAttrInfoNoReturn() : ParsedAttrInfo(
10336 /*AttrKind=*/ParsedAttr::AT_NoReturn,
10337 /*NumArgs=*/0,
10338 /*OptArgs=*/0,
10339 /*NumArgMembers=*/0,
10340 /*HasCustomParsing=*/0,
10341 /*AcceptsExprPack=*/0,
10342 /*IsTargetSpecific=*/0,
10343 /*IsType=*/0,
10344 /*IsStmt=*/0,
10345 /*IsKnownToGCC=*/1,
10346 /*IsSupportedByPragmaAttribute=*/0,
10347 /*Spellings=*/NoReturnSpellings,
10348 /*ArgNames=*/{}) {}
10349bool isParamExpr(size_t N) const override {
10350 return false;
10351}
10352
10353static const ParsedAttrInfoNoReturn Instance;
10354};
10355const ParsedAttrInfoNoReturn ParsedAttrInfoNoReturn::Instance;
10356static constexpr ParsedAttrInfo::Spelling NoSanitizeSpellings[] = {
10357 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_sanitize"},
10358 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::no_sanitize"},
10359 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::no_sanitize"},
10360};
10361static constexpr const char *NoSanitizeArgNames[] = {
10362"Sanitizers...",};
10363struct ParsedAttrInfoNoSanitize final : public ParsedAttrInfo {
10364 constexpr ParsedAttrInfoNoSanitize() : ParsedAttrInfo(
10365 /*AttrKind=*/ParsedAttr::AT_NoSanitize,
10366 /*NumArgs=*/0,
10367 /*OptArgs=*/15,
10368 /*NumArgMembers=*/1,
10369 /*HasCustomParsing=*/0,
10370 /*AcceptsExprPack=*/0,
10371 /*IsTargetSpecific=*/0,
10372 /*IsType=*/0,
10373 /*IsStmt=*/0,
10374 /*IsKnownToGCC=*/0,
10375 /*IsSupportedByPragmaAttribute=*/1,
10376 /*Spellings=*/NoSanitizeSpellings,
10377 /*ArgNames=*/NoSanitizeArgNames) {}
10378bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10379 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D) && !isGlobalVar(D)) {
10380 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
10381 << Attr << Attr.isRegularKeywordAttribute() << "functions, Objective-C methods, and global variables";
10382 return false;
10383 }
10384 return true;
10385}
10386
10387bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10388 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10389 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10390 return false;
10391}
10392
10393void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10394 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10395 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
10396 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/y: true));
10397}
10398
10399bool isParamExpr(size_t N) const override {
10400 return false;
10401}
10402
10403static const ParsedAttrInfoNoSanitize Instance;
10404};
10405const ParsedAttrInfoNoSanitize ParsedAttrInfoNoSanitize::Instance;
10406static constexpr ParsedAttrInfo::Spelling NoSanitizeSpecificSpellings[] = {
10407 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_address_safety_analysis"},
10408 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::no_address_safety_analysis"},
10409 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::no_address_safety_analysis"},
10410 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_sanitize_address"},
10411 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::no_sanitize_address"},
10412 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::no_sanitize_address"},
10413 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_sanitize_thread"},
10414 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::no_sanitize_thread"},
10415 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::no_sanitize_thread"},
10416 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_sanitize_memory"},
10417 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::no_sanitize_memory"},
10418 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::no_sanitize_memory"},
10419};
10420struct ParsedAttrInfoNoSanitizeSpecific final : public ParsedAttrInfo {
10421 constexpr ParsedAttrInfoNoSanitizeSpecific() : ParsedAttrInfo(
10422 /*AttrKind=*/ParsedAttr::AT_NoSanitizeSpecific,
10423 /*NumArgs=*/0,
10424 /*OptArgs=*/0,
10425 /*NumArgMembers=*/0,
10426 /*HasCustomParsing=*/0,
10427 /*AcceptsExprPack=*/0,
10428 /*IsTargetSpecific=*/0,
10429 /*IsType=*/0,
10430 /*IsStmt=*/0,
10431 /*IsKnownToGCC=*/1,
10432 /*IsSupportedByPragmaAttribute=*/1,
10433 /*Spellings=*/NoSanitizeSpecificSpellings,
10434 /*ArgNames=*/{}) {}
10435bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10436 if (!isa<FunctionDecl>(Val: D) && !isGlobalVar(D)) {
10437 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
10438 << Attr << Attr.isRegularKeywordAttribute() << "functions and global variables";
10439 return false;
10440 }
10441 return true;
10442}
10443
10444bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10445 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10446 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10447 return false;
10448}
10449
10450void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10451 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10452 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/y: true));
10453}
10454
10455bool isParamExpr(size_t N) const override {
10456 return false;
10457}
10458
10459static const ParsedAttrInfoNoSanitizeSpecific Instance;
10460};
10461const ParsedAttrInfoNoSanitizeSpecific ParsedAttrInfoNoSanitizeSpecific::Instance;
10462static constexpr ParsedAttrInfo::Spelling NoSpeculativeLoadHardeningSpellings[] = {
10463 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_speculative_load_hardening"},
10464 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::no_speculative_load_hardening"},
10465 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::no_speculative_load_hardening"},
10466};
10467struct ParsedAttrInfoNoSpeculativeLoadHardening final : public ParsedAttrInfo {
10468 constexpr ParsedAttrInfoNoSpeculativeLoadHardening() : ParsedAttrInfo(
10469 /*AttrKind=*/ParsedAttr::AT_NoSpeculativeLoadHardening,
10470 /*NumArgs=*/0,
10471 /*OptArgs=*/0,
10472 /*NumArgMembers=*/0,
10473 /*HasCustomParsing=*/0,
10474 /*AcceptsExprPack=*/0,
10475 /*IsTargetSpecific=*/0,
10476 /*IsType=*/0,
10477 /*IsStmt=*/0,
10478 /*IsKnownToGCC=*/0,
10479 /*IsSupportedByPragmaAttribute=*/1,
10480 /*Spellings=*/NoSpeculativeLoadHardeningSpellings,
10481 /*ArgNames=*/{}) {}
10482bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10483 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
10484 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
10485 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
10486 return false;
10487 }
10488 return true;
10489}
10490
10491bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10492 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10493 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10494 return false;
10495}
10496
10497 using ParsedAttrInfo::diagMutualExclusion;
10498
10499 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
10500 if (const auto *A = D->getAttr<SpeculativeLoadHardeningAttr>()) {
10501 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
10502 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
10503return false;
10504 }
10505 return true;
10506 }
10507
10508void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10509 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10510 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
10511}
10512
10513AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
10514 D->addAttr(A: ::new (S.Context) NoSpeculativeLoadHardeningAttr(S.Context, Attr));
10515 return AttributeApplied;
10516}
10517
10518bool isParamExpr(size_t N) const override {
10519 return false;
10520}
10521
10522static const ParsedAttrInfoNoSpeculativeLoadHardening Instance;
10523};
10524const ParsedAttrInfoNoSpeculativeLoadHardening ParsedAttrInfoNoSpeculativeLoadHardening::Instance;
10525static constexpr ParsedAttrInfo::Spelling NoSplitStackSpellings[] = {
10526 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_split_stack"},
10527 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::no_split_stack"},
10528 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::no_split_stack"},
10529};
10530struct ParsedAttrInfoNoSplitStack final : public ParsedAttrInfo {
10531 constexpr ParsedAttrInfoNoSplitStack() : ParsedAttrInfo(
10532 /*AttrKind=*/ParsedAttr::AT_NoSplitStack,
10533 /*NumArgs=*/0,
10534 /*OptArgs=*/0,
10535 /*NumArgMembers=*/0,
10536 /*HasCustomParsing=*/0,
10537 /*AcceptsExprPack=*/0,
10538 /*IsTargetSpecific=*/0,
10539 /*IsType=*/0,
10540 /*IsStmt=*/0,
10541 /*IsKnownToGCC=*/1,
10542 /*IsSupportedByPragmaAttribute=*/1,
10543 /*Spellings=*/NoSplitStackSpellings,
10544 /*ArgNames=*/{}) {}
10545bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10546 if (!isa<FunctionDecl>(Val: D)) {
10547 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
10548 << Attr << Attr.isRegularKeywordAttribute() << "functions";
10549 return false;
10550 }
10551 return true;
10552}
10553
10554bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10555 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10556 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10557 return false;
10558}
10559
10560void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10561 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10562}
10563
10564AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
10565 D->addAttr(A: ::new (S.Context) NoSplitStackAttr(S.Context, Attr));
10566 return AttributeApplied;
10567}
10568
10569bool isParamExpr(size_t N) const override {
10570 return false;
10571}
10572
10573static const ParsedAttrInfoNoSplitStack Instance;
10574};
10575const ParsedAttrInfoNoSplitStack ParsedAttrInfoNoSplitStack::Instance;
10576static constexpr ParsedAttrInfo::Spelling NoStackProtectorSpellings[] = {
10577 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_stack_protector"},
10578 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::no_stack_protector"},
10579 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::no_stack_protector"},
10580 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::no_stack_protector"},
10581 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::no_stack_protector"},
10582 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "safebuffers"},
10583};
10584struct ParsedAttrInfoNoStackProtector final : public ParsedAttrInfo {
10585 constexpr ParsedAttrInfoNoStackProtector() : ParsedAttrInfo(
10586 /*AttrKind=*/ParsedAttr::AT_NoStackProtector,
10587 /*NumArgs=*/0,
10588 /*OptArgs=*/0,
10589 /*NumArgMembers=*/0,
10590 /*HasCustomParsing=*/0,
10591 /*AcceptsExprPack=*/0,
10592 /*IsTargetSpecific=*/0,
10593 /*IsType=*/0,
10594 /*IsStmt=*/0,
10595 /*IsKnownToGCC=*/0,
10596 /*IsSupportedByPragmaAttribute=*/1,
10597 /*Spellings=*/NoStackProtectorSpellings,
10598 /*ArgNames=*/{}) {}
10599bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10600 if (!isa<FunctionDecl>(Val: D)) {
10601 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
10602 << Attr << Attr.isRegularKeywordAttribute() << "functions";
10603 return false;
10604 }
10605 return true;
10606}
10607
10608bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10609 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10610 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10611 return false;
10612}
10613
10614unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
10615 enum Spelling {
10616 GNU_no_stack_protector = 0,
10617 CXX11_clang_no_stack_protector = 1,
10618 C23_clang_no_stack_protector = 2,
10619 CXX11_gnu_no_stack_protector = 3,
10620 C23_gnu_no_stack_protector = 4,
10621 Declspec_safebuffers = 5,
10622 SpellingNotCalculated = 15
10623
10624 };
10625
10626 unsigned Idx = Attr.getAttributeSpellingListIndex();
10627 switch (Idx) {
10628 default: llvm_unreachable("Unknown spelling list index");
10629 case 0: return GNU_no_stack_protector;
10630 case 1: return CXX11_clang_no_stack_protector;
10631 case 2: return C23_clang_no_stack_protector;
10632 case 3: return CXX11_gnu_no_stack_protector;
10633 case 4: return C23_gnu_no_stack_protector;
10634 case 5: return Declspec_safebuffers;
10635 }
10636}
10637
10638void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10639 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10640}
10641
10642AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
10643 D->addAttr(A: ::new (S.Context) NoStackProtectorAttr(S.Context, Attr));
10644 return AttributeApplied;
10645}
10646
10647bool isParamExpr(size_t N) const override {
10648 return false;
10649}
10650
10651static const ParsedAttrInfoNoStackProtector Instance;
10652};
10653const ParsedAttrInfoNoStackProtector ParsedAttrInfoNoStackProtector::Instance;
10654static constexpr ParsedAttrInfo::Spelling NoThreadSafetyAnalysisSpellings[] = {
10655 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "no_thread_safety_analysis"},
10656 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::no_thread_safety_analysis"},
10657 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::no_thread_safety_analysis"},
10658};
10659struct ParsedAttrInfoNoThreadSafetyAnalysis final : public ParsedAttrInfo {
10660 constexpr ParsedAttrInfoNoThreadSafetyAnalysis() : ParsedAttrInfo(
10661 /*AttrKind=*/ParsedAttr::AT_NoThreadSafetyAnalysis,
10662 /*NumArgs=*/0,
10663 /*OptArgs=*/0,
10664 /*NumArgMembers=*/0,
10665 /*HasCustomParsing=*/0,
10666 /*AcceptsExprPack=*/0,
10667 /*IsTargetSpecific=*/0,
10668 /*IsType=*/0,
10669 /*IsStmt=*/0,
10670 /*IsKnownToGCC=*/0,
10671 /*IsSupportedByPragmaAttribute=*/1,
10672 /*Spellings=*/NoThreadSafetyAnalysisSpellings,
10673 /*ArgNames=*/{}) {}
10674bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10675 if (!isa<FunctionDecl>(Val: D)) {
10676 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
10677 << Attr << Attr.isRegularKeywordAttribute() << "functions";
10678 return false;
10679 }
10680 return true;
10681}
10682
10683bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10684 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10685 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10686 return false;
10687}
10688
10689void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10690 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
10691}
10692
10693AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
10694 D->addAttr(A: ::new (S.Context) NoThreadSafetyAnalysisAttr(S.Context, Attr));
10695 return AttributeApplied;
10696}
10697
10698bool isParamExpr(size_t N) const override {
10699 return false;
10700}
10701
10702static const ParsedAttrInfoNoThreadSafetyAnalysis Instance;
10703};
10704const ParsedAttrInfoNoThreadSafetyAnalysis ParsedAttrInfoNoThreadSafetyAnalysis::Instance;
10705static constexpr ParsedAttrInfo::Spelling NoThrowSpellings[] = {
10706 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nothrow"},
10707 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::nothrow"},
10708 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::nothrow"},
10709 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "nothrow"},
10710};
10711struct ParsedAttrInfoNoThrow final : public ParsedAttrInfo {
10712 constexpr ParsedAttrInfoNoThrow() : ParsedAttrInfo(
10713 /*AttrKind=*/ParsedAttr::AT_NoThrow,
10714 /*NumArgs=*/0,
10715 /*OptArgs=*/0,
10716 /*NumArgMembers=*/0,
10717 /*HasCustomParsing=*/0,
10718 /*AcceptsExprPack=*/0,
10719 /*IsTargetSpecific=*/0,
10720 /*IsType=*/0,
10721 /*IsStmt=*/0,
10722 /*IsKnownToGCC=*/1,
10723 /*IsSupportedByPragmaAttribute=*/1,
10724 /*Spellings=*/NoThrowSpellings,
10725 /*ArgNames=*/{}) {}
10726bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10727 if (!isFunctionLike(D)) {
10728 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
10729 << Attr << Attr.isRegularKeywordAttribute() << "functions and function pointers";
10730 return false;
10731 }
10732 return true;
10733}
10734
10735bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10736 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10737 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10738 return false;
10739}
10740
10741void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10742 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/y: true));
10743}
10744
10745bool isParamExpr(size_t N) const override {
10746 return false;
10747}
10748
10749static const ParsedAttrInfoNoThrow Instance;
10750};
10751const ParsedAttrInfoNoThrow ParsedAttrInfoNoThrow::Instance;
10752static constexpr ParsedAttrInfo::Spelling NoUniqueAddressSpellings[] = {
10753 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "no_unique_address"},
10754 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "msvc::no_unique_address"},
10755};
10756struct ParsedAttrInfoNoUniqueAddress final : public ParsedAttrInfo {
10757 constexpr ParsedAttrInfoNoUniqueAddress() : ParsedAttrInfo(
10758 /*AttrKind=*/ParsedAttr::AT_NoUniqueAddress,
10759 /*NumArgs=*/0,
10760 /*OptArgs=*/0,
10761 /*NumArgMembers=*/0,
10762 /*HasCustomParsing=*/0,
10763 /*AcceptsExprPack=*/0,
10764 /*IsTargetSpecific=*/0,
10765 /*IsType=*/0,
10766 /*IsStmt=*/0,
10767 /*IsKnownToGCC=*/0,
10768 /*IsSupportedByPragmaAttribute=*/0,
10769 /*Spellings=*/NoUniqueAddressSpellings,
10770 /*ArgNames=*/{}) {}
10771bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10772 if (!isNonBitField(D)) {
10773 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
10774 << Attr << Attr.isRegularKeywordAttribute() << "non-bit-field non-static data members";
10775 return false;
10776 }
10777 return true;
10778}
10779
10780bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10781 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10782 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10783 return false;
10784}
10785
10786bool spellingExistsInTarget(const TargetInfo &Target,
10787 const unsigned SpellingListIndex) const override {
10788 const llvm::Triple &T = Target.getTriple(); (void)T;
10789 return ((SpellingListIndex == 0) && true && ( Target.getCXXABI().isItaniumFamily() )) || ((SpellingListIndex == 1) && true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64 || T.getArch() == llvm::Triple::arm || T.getArch() == llvm::Triple::thumb || T.getArch() == llvm::Triple::aarch64) && ( Target.getCXXABI().isMicrosoft() ));
10790}
10791
10792bool isParamExpr(size_t N) const override {
10793 return false;
10794}
10795
10796static const ParsedAttrInfoNoUniqueAddress Instance;
10797};
10798const ParsedAttrInfoNoUniqueAddress ParsedAttrInfoNoUniqueAddress::Instance;
10799static constexpr ParsedAttrInfo::Spelling NoUwtableSpellings[] = {
10800 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nouwtable"},
10801 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::nouwtable"},
10802 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::nouwtable"},
10803};
10804struct ParsedAttrInfoNoUwtable final : public ParsedAttrInfo {
10805 constexpr ParsedAttrInfoNoUwtable() : ParsedAttrInfo(
10806 /*AttrKind=*/ParsedAttr::AT_NoUwtable,
10807 /*NumArgs=*/0,
10808 /*OptArgs=*/0,
10809 /*NumArgMembers=*/0,
10810 /*HasCustomParsing=*/0,
10811 /*AcceptsExprPack=*/0,
10812 /*IsTargetSpecific=*/0,
10813 /*IsType=*/0,
10814 /*IsStmt=*/0,
10815 /*IsKnownToGCC=*/0,
10816 /*IsSupportedByPragmaAttribute=*/1,
10817 /*Spellings=*/NoUwtableSpellings,
10818 /*ArgNames=*/{}) {}
10819bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10820 if (!isFunctionLike(D)) {
10821 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
10822 << Attr << Attr.isRegularKeywordAttribute() << "functions and function pointers";
10823 return false;
10824 }
10825 return true;
10826}
10827
10828bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10829 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10830 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10831 return false;
10832}
10833
10834void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10835 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/y: true));
10836}
10837
10838AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
10839 D->addAttr(A: ::new (S.Context) NoUwtableAttr(S.Context, Attr));
10840 return AttributeApplied;
10841}
10842
10843bool isParamExpr(size_t N) const override {
10844 return false;
10845}
10846
10847static const ParsedAttrInfoNoUwtable Instance;
10848};
10849const ParsedAttrInfoNoUwtable ParsedAttrInfoNoUwtable::Instance;
10850static constexpr ParsedAttrInfo::Spelling NonAllocatingSpellings[] = {
10851 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nonallocating"},
10852 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::nonallocating"},
10853 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::nonallocating"},
10854};
10855static constexpr const char *NonAllocatingArgNames[] = {
10856"Cond",};
10857struct ParsedAttrInfoNonAllocating final : public ParsedAttrInfo {
10858 constexpr ParsedAttrInfoNonAllocating() : ParsedAttrInfo(
10859 /*AttrKind=*/ParsedAttr::AT_NonAllocating,
10860 /*NumArgs=*/0,
10861 /*OptArgs=*/1,
10862 /*NumArgMembers=*/1,
10863 /*HasCustomParsing=*/0,
10864 /*AcceptsExprPack=*/0,
10865 /*IsTargetSpecific=*/0,
10866 /*IsType=*/1,
10867 /*IsStmt=*/0,
10868 /*IsKnownToGCC=*/0,
10869 /*IsSupportedByPragmaAttribute=*/0,
10870 /*Spellings=*/NonAllocatingSpellings,
10871 /*ArgNames=*/NonAllocatingArgNames) {}
10872bool isParamExpr(size_t N) const override {
10873 return (N == 0) || false;
10874}
10875
10876static const ParsedAttrInfoNonAllocating Instance;
10877};
10878const ParsedAttrInfoNonAllocating ParsedAttrInfoNonAllocating::Instance;
10879static constexpr ParsedAttrInfo::Spelling NonBlockingSpellings[] = {
10880 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nonblocking"},
10881 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::nonblocking"},
10882 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::nonblocking"},
10883};
10884static constexpr const char *NonBlockingArgNames[] = {
10885"Cond",};
10886struct ParsedAttrInfoNonBlocking final : public ParsedAttrInfo {
10887 constexpr ParsedAttrInfoNonBlocking() : ParsedAttrInfo(
10888 /*AttrKind=*/ParsedAttr::AT_NonBlocking,
10889 /*NumArgs=*/0,
10890 /*OptArgs=*/1,
10891 /*NumArgMembers=*/1,
10892 /*HasCustomParsing=*/0,
10893 /*AcceptsExprPack=*/0,
10894 /*IsTargetSpecific=*/0,
10895 /*IsType=*/1,
10896 /*IsStmt=*/0,
10897 /*IsKnownToGCC=*/0,
10898 /*IsSupportedByPragmaAttribute=*/0,
10899 /*Spellings=*/NonBlockingSpellings,
10900 /*ArgNames=*/NonBlockingArgNames) {}
10901bool isParamExpr(size_t N) const override {
10902 return (N == 0) || false;
10903}
10904
10905static const ParsedAttrInfoNonBlocking Instance;
10906};
10907const ParsedAttrInfoNonBlocking ParsedAttrInfoNonBlocking::Instance;
10908static constexpr ParsedAttrInfo::Spelling NonNullSpellings[] = {
10909 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nonnull"},
10910 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::nonnull"},
10911 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::nonnull"},
10912};
10913static constexpr const char *NonNullArgNames[] = {
10914"Args...",};
10915struct ParsedAttrInfoNonNull final : public ParsedAttrInfo {
10916 constexpr ParsedAttrInfoNonNull() : ParsedAttrInfo(
10917 /*AttrKind=*/ParsedAttr::AT_NonNull,
10918 /*NumArgs=*/0,
10919 /*OptArgs=*/15,
10920 /*NumArgMembers=*/1,
10921 /*HasCustomParsing=*/0,
10922 /*AcceptsExprPack=*/0,
10923 /*IsTargetSpecific=*/0,
10924 /*IsType=*/0,
10925 /*IsStmt=*/0,
10926 /*IsKnownToGCC=*/1,
10927 /*IsSupportedByPragmaAttribute=*/0,
10928 /*Spellings=*/NonNullSpellings,
10929 /*ArgNames=*/NonNullArgNames) {}
10930bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10931 if (!isa<ObjCMethodDecl>(Val: D) && !isHasFunctionProto(D) && !isa<ParmVarDecl>(Val: D)) {
10932 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
10933 << Attr << Attr.isRegularKeywordAttribute() << "functions, methods, and parameters";
10934 return false;
10935 }
10936 return true;
10937}
10938
10939bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10940 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10941 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10942 return false;
10943}
10944
10945bool isParamExpr(size_t N) const override {
10946 return false;
10947}
10948
10949static const ParsedAttrInfoNonNull Instance;
10950};
10951const ParsedAttrInfoNonNull ParsedAttrInfoNonNull::Instance;
10952static constexpr ParsedAttrInfo::Spelling NotTailCalledSpellings[] = {
10953 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "not_tail_called"},
10954 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::not_tail_called"},
10955 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::not_tail_called"},
10956};
10957struct ParsedAttrInfoNotTailCalled final : public ParsedAttrInfo {
10958 constexpr ParsedAttrInfoNotTailCalled() : ParsedAttrInfo(
10959 /*AttrKind=*/ParsedAttr::AT_NotTailCalled,
10960 /*NumArgs=*/0,
10961 /*OptArgs=*/0,
10962 /*NumArgMembers=*/0,
10963 /*HasCustomParsing=*/0,
10964 /*AcceptsExprPack=*/0,
10965 /*IsTargetSpecific=*/0,
10966 /*IsType=*/0,
10967 /*IsStmt=*/0,
10968 /*IsKnownToGCC=*/0,
10969 /*IsSupportedByPragmaAttribute=*/1,
10970 /*Spellings=*/NotTailCalledSpellings,
10971 /*ArgNames=*/{}) {}
10972bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
10973 if (!isa<FunctionDecl>(Val: D)) {
10974 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
10975 << Attr << Attr.isRegularKeywordAttribute() << "functions";
10976 return false;
10977 }
10978 return true;
10979}
10980
10981bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
10982 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
10983 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
10984 return false;
10985}
10986
10987 using ParsedAttrInfo::diagMutualExclusion;
10988
10989 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
10990 if (const auto *A = D->getAttr<AlwaysInlineAttr>()) {
10991 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
10992 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
10993return false;
10994 }
10995 return true;
10996 }
10997
10998void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
10999 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
11000}
11001
11002AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
11003 D->addAttr(A: ::new (S.Context) NotTailCalledAttr(S.Context, Attr));
11004 return AttributeApplied;
11005}
11006
11007bool isParamExpr(size_t N) const override {
11008 return false;
11009}
11010
11011static const ParsedAttrInfoNotTailCalled Instance;
11012};
11013const ParsedAttrInfoNotTailCalled ParsedAttrInfoNotTailCalled::Instance;
11014static constexpr ParsedAttrInfo::Spelling OMPAssumeSpellings[] = {
11015 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "omp::assume"},
11016};
11017static constexpr const char *OMPAssumeArgNames[] = {
11018"Assumption",};
11019struct ParsedAttrInfoOMPAssume final : public ParsedAttrInfo {
11020 constexpr ParsedAttrInfoOMPAssume() : ParsedAttrInfo(
11021 /*AttrKind=*/ParsedAttr::AT_OMPAssume,
11022 /*NumArgs=*/1,
11023 /*OptArgs=*/0,
11024 /*NumArgMembers=*/1,
11025 /*HasCustomParsing=*/0,
11026 /*AcceptsExprPack=*/0,
11027 /*IsTargetSpecific=*/0,
11028 /*IsType=*/0,
11029 /*IsStmt=*/0,
11030 /*IsKnownToGCC=*/0,
11031 /*IsSupportedByPragmaAttribute=*/1,
11032 /*Spellings=*/OMPAssumeSpellings,
11033 /*ArgNames=*/OMPAssumeArgNames) {}
11034bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11035 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
11036 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
11037 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
11038 return false;
11039 }
11040 return true;
11041}
11042
11043bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11044 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11045 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11046 return false;
11047}
11048
11049void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11050 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
11051 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
11052}
11053
11054bool isParamExpr(size_t N) const override {
11055 return false;
11056}
11057
11058static const ParsedAttrInfoOMPAssume Instance;
11059};
11060const ParsedAttrInfoOMPAssume ParsedAttrInfoOMPAssume::Instance;
11061static constexpr ParsedAttrInfo::Spelling OSConsumedSpellings[] = {
11062 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "os_consumed"},
11063 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::os_consumed"},
11064 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::os_consumed"},
11065};
11066struct ParsedAttrInfoOSConsumed final : public ParsedAttrInfo {
11067 constexpr ParsedAttrInfoOSConsumed() : ParsedAttrInfo(
11068 /*AttrKind=*/ParsedAttr::AT_OSConsumed,
11069 /*NumArgs=*/0,
11070 /*OptArgs=*/0,
11071 /*NumArgMembers=*/0,
11072 /*HasCustomParsing=*/0,
11073 /*AcceptsExprPack=*/0,
11074 /*IsTargetSpecific=*/0,
11075 /*IsType=*/0,
11076 /*IsStmt=*/0,
11077 /*IsKnownToGCC=*/0,
11078 /*IsSupportedByPragmaAttribute=*/1,
11079 /*Spellings=*/OSConsumedSpellings,
11080 /*ArgNames=*/{}) {}
11081bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11082 if (!isa<ParmVarDecl>(Val: D)) {
11083 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
11084 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
11085 return false;
11086 }
11087 return true;
11088}
11089
11090bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11091 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11092 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11093 return false;
11094}
11095
11096void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11097 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
11098}
11099
11100bool isParamExpr(size_t N) const override {
11101 return false;
11102}
11103
11104static const ParsedAttrInfoOSConsumed Instance;
11105};
11106const ParsedAttrInfoOSConsumed ParsedAttrInfoOSConsumed::Instance;
11107static constexpr ParsedAttrInfo::Spelling OSConsumesThisSpellings[] = {
11108 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "os_consumes_this"},
11109 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::os_consumes_this"},
11110 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::os_consumes_this"},
11111};
11112struct ParsedAttrInfoOSConsumesThis final : public ParsedAttrInfo {
11113 constexpr ParsedAttrInfoOSConsumesThis() : ParsedAttrInfo(
11114 /*AttrKind=*/ParsedAttr::AT_OSConsumesThis,
11115 /*NumArgs=*/0,
11116 /*OptArgs=*/0,
11117 /*NumArgMembers=*/0,
11118 /*HasCustomParsing=*/0,
11119 /*AcceptsExprPack=*/0,
11120 /*IsTargetSpecific=*/0,
11121 /*IsType=*/0,
11122 /*IsStmt=*/0,
11123 /*IsKnownToGCC=*/0,
11124 /*IsSupportedByPragmaAttribute=*/0,
11125 /*Spellings=*/OSConsumesThisSpellings,
11126 /*ArgNames=*/{}) {}
11127bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11128 if (!isNonStaticCXXMethod(D)) {
11129 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
11130 << Attr << Attr.isRegularKeywordAttribute() << "non-static member functions";
11131 return false;
11132 }
11133 return true;
11134}
11135
11136bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11137 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11138 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11139 return false;
11140}
11141
11142AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
11143 D->addAttr(A: ::new (S.Context) OSConsumesThisAttr(S.Context, Attr));
11144 return AttributeApplied;
11145}
11146
11147bool isParamExpr(size_t N) const override {
11148 return false;
11149}
11150
11151static const ParsedAttrInfoOSConsumesThis Instance;
11152};
11153const ParsedAttrInfoOSConsumesThis ParsedAttrInfoOSConsumesThis::Instance;
11154static constexpr ParsedAttrInfo::Spelling OSReturnsNotRetainedSpellings[] = {
11155 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "os_returns_not_retained"},
11156 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::os_returns_not_retained"},
11157 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::os_returns_not_retained"},
11158};
11159struct ParsedAttrInfoOSReturnsNotRetained final : public ParsedAttrInfo {
11160 constexpr ParsedAttrInfoOSReturnsNotRetained() : ParsedAttrInfo(
11161 /*AttrKind=*/ParsedAttr::AT_OSReturnsNotRetained,
11162 /*NumArgs=*/0,
11163 /*OptArgs=*/0,
11164 /*NumArgMembers=*/0,
11165 /*HasCustomParsing=*/0,
11166 /*AcceptsExprPack=*/0,
11167 /*IsTargetSpecific=*/0,
11168 /*IsType=*/0,
11169 /*IsStmt=*/0,
11170 /*IsKnownToGCC=*/0,
11171 /*IsSupportedByPragmaAttribute=*/1,
11172 /*Spellings=*/OSReturnsNotRetainedSpellings,
11173 /*ArgNames=*/{}) {}
11174bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11175 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D) && !isa<ObjCPropertyDecl>(Val: D) && !isa<ParmVarDecl>(Val: D)) {
11176 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
11177 << Attr << Attr.isRegularKeywordAttribute() << "functions, Objective-C methods, Objective-C properties, and parameters";
11178 return false;
11179 }
11180 return true;
11181}
11182
11183bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11184 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11185 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11186 return false;
11187}
11188
11189void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11190 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
11191 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
11192 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_property, /*IsSupported=*/y: LangOpts.ObjC));
11193 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
11194}
11195
11196bool isParamExpr(size_t N) const override {
11197 return false;
11198}
11199
11200static const ParsedAttrInfoOSReturnsNotRetained Instance;
11201};
11202const ParsedAttrInfoOSReturnsNotRetained ParsedAttrInfoOSReturnsNotRetained::Instance;
11203static constexpr ParsedAttrInfo::Spelling OSReturnsRetainedSpellings[] = {
11204 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "os_returns_retained"},
11205 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::os_returns_retained"},
11206 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::os_returns_retained"},
11207};
11208struct ParsedAttrInfoOSReturnsRetained final : public ParsedAttrInfo {
11209 constexpr ParsedAttrInfoOSReturnsRetained() : ParsedAttrInfo(
11210 /*AttrKind=*/ParsedAttr::AT_OSReturnsRetained,
11211 /*NumArgs=*/0,
11212 /*OptArgs=*/0,
11213 /*NumArgMembers=*/0,
11214 /*HasCustomParsing=*/0,
11215 /*AcceptsExprPack=*/0,
11216 /*IsTargetSpecific=*/0,
11217 /*IsType=*/0,
11218 /*IsStmt=*/0,
11219 /*IsKnownToGCC=*/0,
11220 /*IsSupportedByPragmaAttribute=*/1,
11221 /*Spellings=*/OSReturnsRetainedSpellings,
11222 /*ArgNames=*/{}) {}
11223bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11224 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D) && !isa<ObjCPropertyDecl>(Val: D) && !isa<ParmVarDecl>(Val: D)) {
11225 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
11226 << Attr << Attr.isRegularKeywordAttribute() << "functions, Objective-C methods, Objective-C properties, and parameters";
11227 return false;
11228 }
11229 return true;
11230}
11231
11232bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11233 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11234 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11235 return false;
11236}
11237
11238void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11239 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
11240 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
11241 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_property, /*IsSupported=*/y: LangOpts.ObjC));
11242 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
11243}
11244
11245bool isParamExpr(size_t N) const override {
11246 return false;
11247}
11248
11249static const ParsedAttrInfoOSReturnsRetained Instance;
11250};
11251const ParsedAttrInfoOSReturnsRetained ParsedAttrInfoOSReturnsRetained::Instance;
11252static constexpr ParsedAttrInfo::Spelling OSReturnsRetainedOnNonZeroSpellings[] = {
11253 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "os_returns_retained_on_non_zero"},
11254 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::os_returns_retained_on_non_zero"},
11255 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::os_returns_retained_on_non_zero"},
11256};
11257struct ParsedAttrInfoOSReturnsRetainedOnNonZero final : public ParsedAttrInfo {
11258 constexpr ParsedAttrInfoOSReturnsRetainedOnNonZero() : ParsedAttrInfo(
11259 /*AttrKind=*/ParsedAttr::AT_OSReturnsRetainedOnNonZero,
11260 /*NumArgs=*/0,
11261 /*OptArgs=*/0,
11262 /*NumArgMembers=*/0,
11263 /*HasCustomParsing=*/0,
11264 /*AcceptsExprPack=*/0,
11265 /*IsTargetSpecific=*/0,
11266 /*IsType=*/0,
11267 /*IsStmt=*/0,
11268 /*IsKnownToGCC=*/0,
11269 /*IsSupportedByPragmaAttribute=*/1,
11270 /*Spellings=*/OSReturnsRetainedOnNonZeroSpellings,
11271 /*ArgNames=*/{}) {}
11272bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11273 if (!isa<ParmVarDecl>(Val: D)) {
11274 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
11275 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
11276 return false;
11277 }
11278 return true;
11279}
11280
11281bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11282 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11283 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11284 return false;
11285}
11286
11287void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11288 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
11289}
11290
11291bool isParamExpr(size_t N) const override {
11292 return false;
11293}
11294
11295static const ParsedAttrInfoOSReturnsRetainedOnNonZero Instance;
11296};
11297const ParsedAttrInfoOSReturnsRetainedOnNonZero ParsedAttrInfoOSReturnsRetainedOnNonZero::Instance;
11298static constexpr ParsedAttrInfo::Spelling OSReturnsRetainedOnZeroSpellings[] = {
11299 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "os_returns_retained_on_zero"},
11300 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::os_returns_retained_on_zero"},
11301 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::os_returns_retained_on_zero"},
11302};
11303struct ParsedAttrInfoOSReturnsRetainedOnZero final : public ParsedAttrInfo {
11304 constexpr ParsedAttrInfoOSReturnsRetainedOnZero() : ParsedAttrInfo(
11305 /*AttrKind=*/ParsedAttr::AT_OSReturnsRetainedOnZero,
11306 /*NumArgs=*/0,
11307 /*OptArgs=*/0,
11308 /*NumArgMembers=*/0,
11309 /*HasCustomParsing=*/0,
11310 /*AcceptsExprPack=*/0,
11311 /*IsTargetSpecific=*/0,
11312 /*IsType=*/0,
11313 /*IsStmt=*/0,
11314 /*IsKnownToGCC=*/0,
11315 /*IsSupportedByPragmaAttribute=*/1,
11316 /*Spellings=*/OSReturnsRetainedOnZeroSpellings,
11317 /*ArgNames=*/{}) {}
11318bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11319 if (!isa<ParmVarDecl>(Val: D)) {
11320 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
11321 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
11322 return false;
11323 }
11324 return true;
11325}
11326
11327bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11328 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11329 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11330 return false;
11331}
11332
11333void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11334 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
11335}
11336
11337bool isParamExpr(size_t N) const override {
11338 return false;
11339}
11340
11341static const ParsedAttrInfoOSReturnsRetainedOnZero Instance;
11342};
11343const ParsedAttrInfoOSReturnsRetainedOnZero ParsedAttrInfoOSReturnsRetainedOnZero::Instance;
11344static constexpr ParsedAttrInfo::Spelling ObjCBoxableSpellings[] = {
11345 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_boxable"},
11346 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_boxable"},
11347 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_boxable"},
11348};
11349struct ParsedAttrInfoObjCBoxable final : public ParsedAttrInfo {
11350 constexpr ParsedAttrInfoObjCBoxable() : ParsedAttrInfo(
11351 /*AttrKind=*/ParsedAttr::AT_ObjCBoxable,
11352 /*NumArgs=*/0,
11353 /*OptArgs=*/0,
11354 /*NumArgMembers=*/0,
11355 /*HasCustomParsing=*/0,
11356 /*AcceptsExprPack=*/0,
11357 /*IsTargetSpecific=*/0,
11358 /*IsType=*/0,
11359 /*IsStmt=*/0,
11360 /*IsKnownToGCC=*/0,
11361 /*IsSupportedByPragmaAttribute=*/1,
11362 /*Spellings=*/ObjCBoxableSpellings,
11363 /*ArgNames=*/{}) {}
11364bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11365 if (!isa<RecordDecl>(Val: D)) {
11366 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
11367 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
11368 return false;
11369 }
11370 return true;
11371}
11372
11373bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11374 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11375 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11376 return false;
11377}
11378
11379void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11380 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
11381}
11382
11383bool isParamExpr(size_t N) const override {
11384 return false;
11385}
11386
11387static const ParsedAttrInfoObjCBoxable Instance;
11388};
11389const ParsedAttrInfoObjCBoxable ParsedAttrInfoObjCBoxable::Instance;
11390static constexpr ParsedAttrInfo::Spelling ObjCBridgeSpellings[] = {
11391 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_bridge"},
11392 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_bridge"},
11393 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_bridge"},
11394};
11395static constexpr const char *ObjCBridgeArgNames[] = {
11396"BridgedType",};
11397struct ParsedAttrInfoObjCBridge final : public ParsedAttrInfo {
11398 constexpr ParsedAttrInfoObjCBridge() : ParsedAttrInfo(
11399 /*AttrKind=*/ParsedAttr::AT_ObjCBridge,
11400 /*NumArgs=*/1,
11401 /*OptArgs=*/0,
11402 /*NumArgMembers=*/1,
11403 /*HasCustomParsing=*/0,
11404 /*AcceptsExprPack=*/0,
11405 /*IsTargetSpecific=*/0,
11406 /*IsType=*/0,
11407 /*IsStmt=*/0,
11408 /*IsKnownToGCC=*/0,
11409 /*IsSupportedByPragmaAttribute=*/1,
11410 /*Spellings=*/ObjCBridgeSpellings,
11411 /*ArgNames=*/ObjCBridgeArgNames) {}
11412bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11413 if (!isa<RecordDecl>(Val: D) && !isa<TypedefNameDecl>(Val: D)) {
11414 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
11415 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, classes, and typedefs";
11416 return false;
11417 }
11418 return true;
11419}
11420
11421bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11422 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11423 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11424 return false;
11425}
11426
11427void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11428 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
11429 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
11430}
11431
11432bool isParamExpr(size_t N) const override {
11433 return false;
11434}
11435
11436static const ParsedAttrInfoObjCBridge Instance;
11437};
11438const ParsedAttrInfoObjCBridge ParsedAttrInfoObjCBridge::Instance;
11439static constexpr ParsedAttrInfo::Spelling ObjCBridgeMutableSpellings[] = {
11440 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_bridge_mutable"},
11441 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_bridge_mutable"},
11442 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_bridge_mutable"},
11443};
11444static constexpr const char *ObjCBridgeMutableArgNames[] = {
11445"BridgedType",};
11446struct ParsedAttrInfoObjCBridgeMutable final : public ParsedAttrInfo {
11447 constexpr ParsedAttrInfoObjCBridgeMutable() : ParsedAttrInfo(
11448 /*AttrKind=*/ParsedAttr::AT_ObjCBridgeMutable,
11449 /*NumArgs=*/1,
11450 /*OptArgs=*/0,
11451 /*NumArgMembers=*/1,
11452 /*HasCustomParsing=*/0,
11453 /*AcceptsExprPack=*/0,
11454 /*IsTargetSpecific=*/0,
11455 /*IsType=*/0,
11456 /*IsStmt=*/0,
11457 /*IsKnownToGCC=*/0,
11458 /*IsSupportedByPragmaAttribute=*/1,
11459 /*Spellings=*/ObjCBridgeMutableSpellings,
11460 /*ArgNames=*/ObjCBridgeMutableArgNames) {}
11461bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11462 if (!isa<RecordDecl>(Val: D)) {
11463 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
11464 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
11465 return false;
11466 }
11467 return true;
11468}
11469
11470bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11471 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11472 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11473 return false;
11474}
11475
11476void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11477 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
11478}
11479
11480bool isParamExpr(size_t N) const override {
11481 return false;
11482}
11483
11484static const ParsedAttrInfoObjCBridgeMutable Instance;
11485};
11486const ParsedAttrInfoObjCBridgeMutable ParsedAttrInfoObjCBridgeMutable::Instance;
11487static constexpr ParsedAttrInfo::Spelling ObjCBridgeRelatedSpellings[] = {
11488 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_bridge_related"},
11489 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_bridge_related"},
11490 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_bridge_related"},
11491};
11492static constexpr const char *ObjCBridgeRelatedArgNames[] = {
11493"RelatedClass","ClassMethod","InstanceMethod",};
11494struct ParsedAttrInfoObjCBridgeRelated final : public ParsedAttrInfo {
11495 constexpr ParsedAttrInfoObjCBridgeRelated() : ParsedAttrInfo(
11496 /*AttrKind=*/ParsedAttr::AT_ObjCBridgeRelated,
11497 /*NumArgs=*/3,
11498 /*OptArgs=*/0,
11499 /*NumArgMembers=*/3,
11500 /*HasCustomParsing=*/1,
11501 /*AcceptsExprPack=*/0,
11502 /*IsTargetSpecific=*/0,
11503 /*IsType=*/0,
11504 /*IsStmt=*/0,
11505 /*IsKnownToGCC=*/0,
11506 /*IsSupportedByPragmaAttribute=*/1,
11507 /*Spellings=*/ObjCBridgeRelatedSpellings,
11508 /*ArgNames=*/ObjCBridgeRelatedArgNames) {}
11509bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11510 if (!isa<RecordDecl>(Val: D)) {
11511 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
11512 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
11513 return false;
11514 }
11515 return true;
11516}
11517
11518bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11519 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11520 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11521 return false;
11522}
11523
11524void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11525 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
11526}
11527
11528bool isParamExpr(size_t N) const override {
11529 return false;
11530}
11531
11532static const ParsedAttrInfoObjCBridgeRelated Instance;
11533};
11534const ParsedAttrInfoObjCBridgeRelated ParsedAttrInfoObjCBridgeRelated::Instance;
11535static constexpr ParsedAttrInfo::Spelling ObjCClassStubSpellings[] = {
11536 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_class_stub"},
11537 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_class_stub"},
11538 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_class_stub"},
11539};
11540struct ParsedAttrInfoObjCClassStub final : public ParsedAttrInfo {
11541 constexpr ParsedAttrInfoObjCClassStub() : ParsedAttrInfo(
11542 /*AttrKind=*/ParsedAttr::AT_ObjCClassStub,
11543 /*NumArgs=*/0,
11544 /*OptArgs=*/0,
11545 /*NumArgMembers=*/0,
11546 /*HasCustomParsing=*/0,
11547 /*AcceptsExprPack=*/0,
11548 /*IsTargetSpecific=*/0,
11549 /*IsType=*/0,
11550 /*IsStmt=*/0,
11551 /*IsKnownToGCC=*/0,
11552 /*IsSupportedByPragmaAttribute=*/1,
11553 /*Spellings=*/ObjCClassStubSpellings,
11554 /*ArgNames=*/{}) {}
11555bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11556 if (!isa<ObjCInterfaceDecl>(Val: D)) {
11557 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
11558 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C interfaces";
11559 return false;
11560 }
11561 return true;
11562}
11563
11564bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11565 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11566 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11567 return false;
11568}
11569
11570bool acceptsLangOpts(const LangOptions &LangOpts) const override {
11571 return (LangOpts.ObjCRuntime.allowsClassStubs());
11572}
11573
11574void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11575 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
11576}
11577
11578AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
11579 D->addAttr(A: ::new (S.Context) ObjCClassStubAttr(S.Context, Attr));
11580 return AttributeApplied;
11581}
11582
11583bool isParamExpr(size_t N) const override {
11584 return false;
11585}
11586
11587static const ParsedAttrInfoObjCClassStub Instance;
11588};
11589const ParsedAttrInfoObjCClassStub ParsedAttrInfoObjCClassStub::Instance;
11590static constexpr ParsedAttrInfo::Spelling ObjCDesignatedInitializerSpellings[] = {
11591 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_designated_initializer"},
11592 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_designated_initializer"},
11593 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_designated_initializer"},
11594};
11595struct ParsedAttrInfoObjCDesignatedInitializer final : public ParsedAttrInfo {
11596 constexpr ParsedAttrInfoObjCDesignatedInitializer() : ParsedAttrInfo(
11597 /*AttrKind=*/ParsedAttr::AT_ObjCDesignatedInitializer,
11598 /*NumArgs=*/0,
11599 /*OptArgs=*/0,
11600 /*NumArgMembers=*/0,
11601 /*HasCustomParsing=*/0,
11602 /*AcceptsExprPack=*/0,
11603 /*IsTargetSpecific=*/0,
11604 /*IsType=*/0,
11605 /*IsStmt=*/0,
11606 /*IsKnownToGCC=*/0,
11607 /*IsSupportedByPragmaAttribute=*/1,
11608 /*Spellings=*/ObjCDesignatedInitializerSpellings,
11609 /*ArgNames=*/{}) {}
11610bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11611 if (!isa<ObjCMethodDecl>(Val: D)) {
11612 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
11613 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods";
11614 return false;
11615 }
11616 return true;
11617}
11618
11619bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11620 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11621 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11622 return false;
11623}
11624
11625void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11626 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
11627}
11628
11629bool isParamExpr(size_t N) const override {
11630 return false;
11631}
11632
11633static const ParsedAttrInfoObjCDesignatedInitializer Instance;
11634};
11635const ParsedAttrInfoObjCDesignatedInitializer ParsedAttrInfoObjCDesignatedInitializer::Instance;
11636static constexpr ParsedAttrInfo::Spelling ObjCDirectSpellings[] = {
11637 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_direct"},
11638 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_direct"},
11639 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_direct"},
11640};
11641struct ParsedAttrInfoObjCDirect final : public ParsedAttrInfo {
11642 constexpr ParsedAttrInfoObjCDirect() : ParsedAttrInfo(
11643 /*AttrKind=*/ParsedAttr::AT_ObjCDirect,
11644 /*NumArgs=*/0,
11645 /*OptArgs=*/0,
11646 /*NumArgMembers=*/0,
11647 /*HasCustomParsing=*/0,
11648 /*AcceptsExprPack=*/0,
11649 /*IsTargetSpecific=*/0,
11650 /*IsType=*/0,
11651 /*IsStmt=*/0,
11652 /*IsKnownToGCC=*/0,
11653 /*IsSupportedByPragmaAttribute=*/1,
11654 /*Spellings=*/ObjCDirectSpellings,
11655 /*ArgNames=*/{}) {}
11656bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11657 if (!isa<ObjCMethodDecl>(Val: D)) {
11658 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
11659 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods";
11660 return false;
11661 }
11662 return true;
11663}
11664
11665bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11666 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11667 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11668 return false;
11669}
11670
11671bool acceptsLangOpts(const LangOptions &LangOpts) const override {
11672 return LangOpts.ObjC;
11673}
11674
11675void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11676 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
11677}
11678
11679bool isParamExpr(size_t N) const override {
11680 return false;
11681}
11682
11683static const ParsedAttrInfoObjCDirect Instance;
11684};
11685const ParsedAttrInfoObjCDirect ParsedAttrInfoObjCDirect::Instance;
11686static constexpr ParsedAttrInfo::Spelling ObjCDirectMembersSpellings[] = {
11687 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_direct_members"},
11688 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_direct_members"},
11689 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_direct_members"},
11690};
11691struct ParsedAttrInfoObjCDirectMembers final : public ParsedAttrInfo {
11692 constexpr ParsedAttrInfoObjCDirectMembers() : ParsedAttrInfo(
11693 /*AttrKind=*/ParsedAttr::AT_ObjCDirectMembers,
11694 /*NumArgs=*/0,
11695 /*OptArgs=*/0,
11696 /*NumArgMembers=*/0,
11697 /*HasCustomParsing=*/0,
11698 /*AcceptsExprPack=*/0,
11699 /*IsTargetSpecific=*/0,
11700 /*IsType=*/0,
11701 /*IsStmt=*/0,
11702 /*IsKnownToGCC=*/0,
11703 /*IsSupportedByPragmaAttribute=*/1,
11704 /*Spellings=*/ObjCDirectMembersSpellings,
11705 /*ArgNames=*/{}) {}
11706bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11707 if (!isa<ObjCImplDecl>(Val: D) && !isa<ObjCInterfaceDecl>(Val: D) && !isa<ObjCCategoryDecl>(Val: D)) {
11708 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
11709 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C implementation declarations, Objective-C interfaces, and Objective-C containers";
11710 return false;
11711 }
11712 return true;
11713}
11714
11715bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11716 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11717 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11718 return false;
11719}
11720
11721bool acceptsLangOpts(const LangOptions &LangOpts) const override {
11722 return LangOpts.ObjC;
11723}
11724
11725void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11726 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_implementation, /*IsSupported=*/y: LangOpts.ObjC));
11727 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
11728 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_category, /*IsSupported=*/y: LangOpts.ObjC));
11729}
11730
11731bool isParamExpr(size_t N) const override {
11732 return false;
11733}
11734
11735static const ParsedAttrInfoObjCDirectMembers Instance;
11736};
11737const ParsedAttrInfoObjCDirectMembers ParsedAttrInfoObjCDirectMembers::Instance;
11738static constexpr ParsedAttrInfo::Spelling ObjCExceptionSpellings[] = {
11739 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_exception"},
11740 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_exception"},
11741 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_exception"},
11742};
11743struct ParsedAttrInfoObjCException final : public ParsedAttrInfo {
11744 constexpr ParsedAttrInfoObjCException() : ParsedAttrInfo(
11745 /*AttrKind=*/ParsedAttr::AT_ObjCException,
11746 /*NumArgs=*/0,
11747 /*OptArgs=*/0,
11748 /*NumArgMembers=*/0,
11749 /*HasCustomParsing=*/0,
11750 /*AcceptsExprPack=*/0,
11751 /*IsTargetSpecific=*/0,
11752 /*IsType=*/0,
11753 /*IsStmt=*/0,
11754 /*IsKnownToGCC=*/0,
11755 /*IsSupportedByPragmaAttribute=*/1,
11756 /*Spellings=*/ObjCExceptionSpellings,
11757 /*ArgNames=*/{}) {}
11758bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11759 if (!isa<ObjCInterfaceDecl>(Val: D)) {
11760 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
11761 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C interfaces";
11762 return false;
11763 }
11764 return true;
11765}
11766
11767bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11768 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11769 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11770 return false;
11771}
11772
11773void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11774 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
11775}
11776
11777AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
11778 D->addAttr(A: ::new (S.Context) ObjCExceptionAttr(S.Context, Attr));
11779 return AttributeApplied;
11780}
11781
11782bool isParamExpr(size_t N) const override {
11783 return false;
11784}
11785
11786static const ParsedAttrInfoObjCException Instance;
11787};
11788const ParsedAttrInfoObjCException ParsedAttrInfoObjCException::Instance;
11789static constexpr ParsedAttrInfo::Spelling ObjCExplicitProtocolImplSpellings[] = {
11790 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_protocol_requires_explicit_implementation"},
11791 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_protocol_requires_explicit_implementation"},
11792 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_protocol_requires_explicit_implementation"},
11793};
11794struct ParsedAttrInfoObjCExplicitProtocolImpl final : public ParsedAttrInfo {
11795 constexpr ParsedAttrInfoObjCExplicitProtocolImpl() : ParsedAttrInfo(
11796 /*AttrKind=*/ParsedAttr::AT_ObjCExplicitProtocolImpl,
11797 /*NumArgs=*/0,
11798 /*OptArgs=*/0,
11799 /*NumArgMembers=*/0,
11800 /*HasCustomParsing=*/0,
11801 /*AcceptsExprPack=*/0,
11802 /*IsTargetSpecific=*/0,
11803 /*IsType=*/0,
11804 /*IsStmt=*/0,
11805 /*IsKnownToGCC=*/0,
11806 /*IsSupportedByPragmaAttribute=*/1,
11807 /*Spellings=*/ObjCExplicitProtocolImplSpellings,
11808 /*ArgNames=*/{}) {}
11809bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11810 if (!isa<ObjCProtocolDecl>(Val: D)) {
11811 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
11812 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C protocols";
11813 return false;
11814 }
11815 return true;
11816}
11817
11818bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11819 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11820 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11821 return false;
11822}
11823
11824void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11825 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_protocol, /*IsSupported=*/y: LangOpts.ObjC));
11826}
11827
11828bool isParamExpr(size_t N) const override {
11829 return false;
11830}
11831
11832static const ParsedAttrInfoObjCExplicitProtocolImpl Instance;
11833};
11834const ParsedAttrInfoObjCExplicitProtocolImpl ParsedAttrInfoObjCExplicitProtocolImpl::Instance;
11835static constexpr ParsedAttrInfo::Spelling ObjCExternallyRetainedSpellings[] = {
11836 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_externally_retained"},
11837 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_externally_retained"},
11838 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_externally_retained"},
11839};
11840struct ParsedAttrInfoObjCExternallyRetained final : public ParsedAttrInfo {
11841 constexpr ParsedAttrInfoObjCExternallyRetained() : ParsedAttrInfo(
11842 /*AttrKind=*/ParsedAttr::AT_ObjCExternallyRetained,
11843 /*NumArgs=*/0,
11844 /*OptArgs=*/0,
11845 /*NumArgMembers=*/0,
11846 /*HasCustomParsing=*/0,
11847 /*AcceptsExprPack=*/0,
11848 /*IsTargetSpecific=*/0,
11849 /*IsType=*/0,
11850 /*IsStmt=*/0,
11851 /*IsKnownToGCC=*/0,
11852 /*IsSupportedByPragmaAttribute=*/1,
11853 /*Spellings=*/ObjCExternallyRetainedSpellings,
11854 /*ArgNames=*/{}) {}
11855bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
11856 if (!isNonParmVar(D) && !isa<FunctionDecl>(Val: D) && !isa<BlockDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
11857 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
11858 << Attr << Attr.isRegularKeywordAttribute() << "variables, functions, blocks, and Objective-C methods";
11859 return false;
11860 }
11861 return true;
11862}
11863
11864bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
11865 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
11866 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
11867 return false;
11868}
11869
11870bool acceptsLangOpts(const LangOptions &LangOpts) const override {
11871 return LangOpts.ObjCAutoRefCount;
11872}
11873
11874void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
11875 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_not_is_parameter, /*IsSupported=*/y: true));
11876 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
11877 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_block, /*IsSupported=*/y: LangOpts.Blocks));
11878 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
11879}
11880
11881bool isParamExpr(size_t N) const override {
11882 return false;
11883}
11884
11885static const ParsedAttrInfoObjCExternallyRetained Instance;
11886};
11887const ParsedAttrInfoObjCExternallyRetained ParsedAttrInfoObjCExternallyRetained::Instance;
11888static constexpr ParsedAttrInfo::Spelling ObjCGCSpellings[] = {
11889 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_gc"},
11890 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_gc"},
11891 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_gc"},
11892};
11893static constexpr const char *ObjCGCArgNames[] = {
11894"Kind",};
11895struct ParsedAttrInfoObjCGC final : public ParsedAttrInfo {
11896 constexpr ParsedAttrInfoObjCGC() : ParsedAttrInfo(
11897 /*AttrKind=*/ParsedAttr::AT_ObjCGC,
11898 /*NumArgs=*/1,
11899 /*OptArgs=*/0,
11900 /*NumArgMembers=*/1,
11901 /*HasCustomParsing=*/0,
11902 /*AcceptsExprPack=*/0,
11903 /*IsTargetSpecific=*/0,
11904 /*IsType=*/1,
11905 /*IsStmt=*/0,
11906 /*IsKnownToGCC=*/0,
11907 /*IsSupportedByPragmaAttribute=*/0,
11908 /*Spellings=*/ObjCGCSpellings,
11909 /*ArgNames=*/ObjCGCArgNames) {}
11910bool isParamExpr(size_t N) const override {
11911 return false;
11912}
11913
11914static const ParsedAttrInfoObjCGC Instance;
11915};
11916const ParsedAttrInfoObjCGC ParsedAttrInfoObjCGC::Instance;
11917static constexpr ParsedAttrInfo::Spelling ObjCIndependentClassSpellings[] = {
11918 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_independent_class"},
11919 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_independent_class"},
11920 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_independent_class"},
11921};
11922struct ParsedAttrInfoObjCIndependentClass final : public ParsedAttrInfo {
11923 constexpr ParsedAttrInfoObjCIndependentClass() : ParsedAttrInfo(
11924 /*AttrKind=*/ParsedAttr::AT_ObjCIndependentClass,
11925 /*NumArgs=*/0,
11926 /*OptArgs=*/0,
11927 /*NumArgMembers=*/0,
11928 /*HasCustomParsing=*/0,
11929 /*AcceptsExprPack=*/0,
11930 /*IsTargetSpecific=*/0,
11931 /*IsType=*/0,
11932 /*IsStmt=*/0,
11933 /*IsKnownToGCC=*/0,
11934 /*IsSupportedByPragmaAttribute=*/0,
11935 /*Spellings=*/ObjCIndependentClassSpellings,
11936 /*ArgNames=*/{}) {}
11937bool isParamExpr(size_t N) const override {
11938 return false;
11939}
11940
11941static const ParsedAttrInfoObjCIndependentClass Instance;
11942};
11943const ParsedAttrInfoObjCIndependentClass ParsedAttrInfoObjCIndependentClass::Instance;
11944static constexpr ParsedAttrInfo::Spelling ObjCInertUnsafeUnretainedSpellings[] = {
11945 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__unsafe_unretained"},
11946};
11947struct ParsedAttrInfoObjCInertUnsafeUnretained final : public ParsedAttrInfo {
11948 constexpr ParsedAttrInfoObjCInertUnsafeUnretained() : ParsedAttrInfo(
11949 /*AttrKind=*/ParsedAttr::AT_ObjCInertUnsafeUnretained,
11950 /*NumArgs=*/0,
11951 /*OptArgs=*/0,
11952 /*NumArgMembers=*/0,
11953 /*HasCustomParsing=*/0,
11954 /*AcceptsExprPack=*/0,
11955 /*IsTargetSpecific=*/0,
11956 /*IsType=*/1,
11957 /*IsStmt=*/0,
11958 /*IsKnownToGCC=*/0,
11959 /*IsSupportedByPragmaAttribute=*/0,
11960 /*Spellings=*/ObjCInertUnsafeUnretainedSpellings,
11961 /*ArgNames=*/{}) {}
11962bool isParamExpr(size_t N) const override {
11963 return false;
11964}
11965
11966static const ParsedAttrInfoObjCInertUnsafeUnretained Instance;
11967};
11968const ParsedAttrInfoObjCInertUnsafeUnretained ParsedAttrInfoObjCInertUnsafeUnretained::Instance;
11969static constexpr ParsedAttrInfo::Spelling ObjCKindOfSpellings[] = {
11970 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__kindof"},
11971};
11972struct ParsedAttrInfoObjCKindOf final : public ParsedAttrInfo {
11973 constexpr ParsedAttrInfoObjCKindOf() : ParsedAttrInfo(
11974 /*AttrKind=*/ParsedAttr::AT_ObjCKindOf,
11975 /*NumArgs=*/0,
11976 /*OptArgs=*/0,
11977 /*NumArgMembers=*/0,
11978 /*HasCustomParsing=*/0,
11979 /*AcceptsExprPack=*/0,
11980 /*IsTargetSpecific=*/0,
11981 /*IsType=*/1,
11982 /*IsStmt=*/0,
11983 /*IsKnownToGCC=*/0,
11984 /*IsSupportedByPragmaAttribute=*/0,
11985 /*Spellings=*/ObjCKindOfSpellings,
11986 /*ArgNames=*/{}) {}
11987bool isParamExpr(size_t N) const override {
11988 return false;
11989}
11990
11991static const ParsedAttrInfoObjCKindOf Instance;
11992};
11993const ParsedAttrInfoObjCKindOf ParsedAttrInfoObjCKindOf::Instance;
11994static constexpr ParsedAttrInfo::Spelling ObjCMethodFamilySpellings[] = {
11995 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_method_family"},
11996 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_method_family"},
11997 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_method_family"},
11998};
11999static constexpr const char *ObjCMethodFamilyArgNames[] = {
12000"Family",};
12001struct ParsedAttrInfoObjCMethodFamily final : public ParsedAttrInfo {
12002 constexpr ParsedAttrInfoObjCMethodFamily() : ParsedAttrInfo(
12003 /*AttrKind=*/ParsedAttr::AT_ObjCMethodFamily,
12004 /*NumArgs=*/1,
12005 /*OptArgs=*/0,
12006 /*NumArgMembers=*/1,
12007 /*HasCustomParsing=*/0,
12008 /*AcceptsExprPack=*/0,
12009 /*IsTargetSpecific=*/0,
12010 /*IsType=*/0,
12011 /*IsStmt=*/0,
12012 /*IsKnownToGCC=*/0,
12013 /*IsSupportedByPragmaAttribute=*/1,
12014 /*Spellings=*/ObjCMethodFamilySpellings,
12015 /*ArgNames=*/ObjCMethodFamilyArgNames) {}
12016bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12017 if (!isa<ObjCMethodDecl>(Val: D)) {
12018 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12019 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods";
12020 return false;
12021 }
12022 return true;
12023}
12024
12025bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12026 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12027 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12028 return false;
12029}
12030
12031void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12032 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
12033}
12034
12035bool isParamExpr(size_t N) const override {
12036 return false;
12037}
12038
12039static const ParsedAttrInfoObjCMethodFamily Instance;
12040};
12041const ParsedAttrInfoObjCMethodFamily ParsedAttrInfoObjCMethodFamily::Instance;
12042static constexpr ParsedAttrInfo::Spelling ObjCNSObjectSpellings[] = {
12043 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "NSObject"},
12044 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::NSObject"},
12045 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::NSObject"},
12046};
12047struct ParsedAttrInfoObjCNSObject final : public ParsedAttrInfo {
12048 constexpr ParsedAttrInfoObjCNSObject() : ParsedAttrInfo(
12049 /*AttrKind=*/ParsedAttr::AT_ObjCNSObject,
12050 /*NumArgs=*/0,
12051 /*OptArgs=*/0,
12052 /*NumArgMembers=*/0,
12053 /*HasCustomParsing=*/0,
12054 /*AcceptsExprPack=*/0,
12055 /*IsTargetSpecific=*/0,
12056 /*IsType=*/0,
12057 /*IsStmt=*/0,
12058 /*IsKnownToGCC=*/0,
12059 /*IsSupportedByPragmaAttribute=*/0,
12060 /*Spellings=*/ObjCNSObjectSpellings,
12061 /*ArgNames=*/{}) {}
12062bool isParamExpr(size_t N) const override {
12063 return false;
12064}
12065
12066static const ParsedAttrInfoObjCNSObject Instance;
12067};
12068const ParsedAttrInfoObjCNSObject ParsedAttrInfoObjCNSObject::Instance;
12069static constexpr ParsedAttrInfo::Spelling ObjCNonLazyClassSpellings[] = {
12070 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_nonlazy_class"},
12071 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_nonlazy_class"},
12072 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_nonlazy_class"},
12073};
12074struct ParsedAttrInfoObjCNonLazyClass final : public ParsedAttrInfo {
12075 constexpr ParsedAttrInfoObjCNonLazyClass() : ParsedAttrInfo(
12076 /*AttrKind=*/ParsedAttr::AT_ObjCNonLazyClass,
12077 /*NumArgs=*/0,
12078 /*OptArgs=*/0,
12079 /*NumArgMembers=*/0,
12080 /*HasCustomParsing=*/0,
12081 /*AcceptsExprPack=*/0,
12082 /*IsTargetSpecific=*/0,
12083 /*IsType=*/0,
12084 /*IsStmt=*/0,
12085 /*IsKnownToGCC=*/0,
12086 /*IsSupportedByPragmaAttribute=*/1,
12087 /*Spellings=*/ObjCNonLazyClassSpellings,
12088 /*ArgNames=*/{}) {}
12089bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12090 if (!isa<ObjCInterfaceDecl>(Val: D) && !isa<ObjCImplDecl>(Val: D)) {
12091 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12092 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C interfaces and Objective-C implementation declarations";
12093 return false;
12094 }
12095 return true;
12096}
12097
12098bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12099 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12100 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12101 return false;
12102}
12103
12104bool acceptsLangOpts(const LangOptions &LangOpts) const override {
12105 return LangOpts.ObjC;
12106}
12107
12108void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12109 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
12110 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_implementation, /*IsSupported=*/y: LangOpts.ObjC));
12111}
12112
12113AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
12114 D->addAttr(A: ::new (S.Context) ObjCNonLazyClassAttr(S.Context, Attr));
12115 return AttributeApplied;
12116}
12117
12118bool isParamExpr(size_t N) const override {
12119 return false;
12120}
12121
12122static const ParsedAttrInfoObjCNonLazyClass Instance;
12123};
12124const ParsedAttrInfoObjCNonLazyClass ParsedAttrInfoObjCNonLazyClass::Instance;
12125static constexpr ParsedAttrInfo::Spelling ObjCNonRuntimeProtocolSpellings[] = {
12126 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_non_runtime_protocol"},
12127 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_non_runtime_protocol"},
12128 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_non_runtime_protocol"},
12129};
12130struct ParsedAttrInfoObjCNonRuntimeProtocol final : public ParsedAttrInfo {
12131 constexpr ParsedAttrInfoObjCNonRuntimeProtocol() : ParsedAttrInfo(
12132 /*AttrKind=*/ParsedAttr::AT_ObjCNonRuntimeProtocol,
12133 /*NumArgs=*/0,
12134 /*OptArgs=*/0,
12135 /*NumArgMembers=*/0,
12136 /*HasCustomParsing=*/0,
12137 /*AcceptsExprPack=*/0,
12138 /*IsTargetSpecific=*/0,
12139 /*IsType=*/0,
12140 /*IsStmt=*/0,
12141 /*IsKnownToGCC=*/0,
12142 /*IsSupportedByPragmaAttribute=*/1,
12143 /*Spellings=*/ObjCNonRuntimeProtocolSpellings,
12144 /*ArgNames=*/{}) {}
12145bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12146 if (!isa<ObjCProtocolDecl>(Val: D)) {
12147 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12148 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C protocols";
12149 return false;
12150 }
12151 return true;
12152}
12153
12154bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12155 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12156 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12157 return false;
12158}
12159
12160bool acceptsLangOpts(const LangOptions &LangOpts) const override {
12161 return LangOpts.ObjC;
12162}
12163
12164void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12165 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_protocol, /*IsSupported=*/y: LangOpts.ObjC));
12166}
12167
12168AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
12169 D->addAttr(A: ::new (S.Context) ObjCNonRuntimeProtocolAttr(S.Context, Attr));
12170 return AttributeApplied;
12171}
12172
12173bool isParamExpr(size_t N) const override {
12174 return false;
12175}
12176
12177static const ParsedAttrInfoObjCNonRuntimeProtocol Instance;
12178};
12179const ParsedAttrInfoObjCNonRuntimeProtocol ParsedAttrInfoObjCNonRuntimeProtocol::Instance;
12180static constexpr ParsedAttrInfo::Spelling ObjCOwnershipSpellings[] = {
12181 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_ownership"},
12182 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_ownership"},
12183 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_ownership"},
12184};
12185static constexpr const char *ObjCOwnershipArgNames[] = {
12186"Kind",};
12187struct ParsedAttrInfoObjCOwnership final : public ParsedAttrInfo {
12188 constexpr ParsedAttrInfoObjCOwnership() : ParsedAttrInfo(
12189 /*AttrKind=*/ParsedAttr::AT_ObjCOwnership,
12190 /*NumArgs=*/1,
12191 /*OptArgs=*/0,
12192 /*NumArgMembers=*/1,
12193 /*HasCustomParsing=*/0,
12194 /*AcceptsExprPack=*/0,
12195 /*IsTargetSpecific=*/0,
12196 /*IsType=*/1,
12197 /*IsStmt=*/0,
12198 /*IsKnownToGCC=*/0,
12199 /*IsSupportedByPragmaAttribute=*/0,
12200 /*Spellings=*/ObjCOwnershipSpellings,
12201 /*ArgNames=*/ObjCOwnershipArgNames) {}
12202bool isParamExpr(size_t N) const override {
12203 return false;
12204}
12205
12206static const ParsedAttrInfoObjCOwnership Instance;
12207};
12208const ParsedAttrInfoObjCOwnership ParsedAttrInfoObjCOwnership::Instance;
12209static constexpr ParsedAttrInfo::Spelling ObjCPreciseLifetimeSpellings[] = {
12210 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_precise_lifetime"},
12211 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_precise_lifetime"},
12212 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_precise_lifetime"},
12213};
12214struct ParsedAttrInfoObjCPreciseLifetime final : public ParsedAttrInfo {
12215 constexpr ParsedAttrInfoObjCPreciseLifetime() : ParsedAttrInfo(
12216 /*AttrKind=*/ParsedAttr::AT_ObjCPreciseLifetime,
12217 /*NumArgs=*/0,
12218 /*OptArgs=*/0,
12219 /*NumArgMembers=*/0,
12220 /*HasCustomParsing=*/0,
12221 /*AcceptsExprPack=*/0,
12222 /*IsTargetSpecific=*/0,
12223 /*IsType=*/0,
12224 /*IsStmt=*/0,
12225 /*IsKnownToGCC=*/0,
12226 /*IsSupportedByPragmaAttribute=*/1,
12227 /*Spellings=*/ObjCPreciseLifetimeSpellings,
12228 /*ArgNames=*/{}) {}
12229bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12230 if (!isa<VarDecl>(Val: D)) {
12231 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12232 << Attr << Attr.isRegularKeywordAttribute() << "variables";
12233 return false;
12234 }
12235 return true;
12236}
12237
12238bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12239 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12240 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12241 return false;
12242}
12243
12244void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12245 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
12246}
12247
12248bool isParamExpr(size_t N) const override {
12249 return false;
12250}
12251
12252static const ParsedAttrInfoObjCPreciseLifetime Instance;
12253};
12254const ParsedAttrInfoObjCPreciseLifetime ParsedAttrInfoObjCPreciseLifetime::Instance;
12255static constexpr ParsedAttrInfo::Spelling ObjCRequiresPropertyDefsSpellings[] = {
12256 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_requires_property_definitions"},
12257 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_requires_property_definitions"},
12258 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_requires_property_definitions"},
12259};
12260struct ParsedAttrInfoObjCRequiresPropertyDefs final : public ParsedAttrInfo {
12261 constexpr ParsedAttrInfoObjCRequiresPropertyDefs() : ParsedAttrInfo(
12262 /*AttrKind=*/ParsedAttr::AT_ObjCRequiresPropertyDefs,
12263 /*NumArgs=*/0,
12264 /*OptArgs=*/0,
12265 /*NumArgMembers=*/0,
12266 /*HasCustomParsing=*/0,
12267 /*AcceptsExprPack=*/0,
12268 /*IsTargetSpecific=*/0,
12269 /*IsType=*/0,
12270 /*IsStmt=*/0,
12271 /*IsKnownToGCC=*/0,
12272 /*IsSupportedByPragmaAttribute=*/1,
12273 /*Spellings=*/ObjCRequiresPropertyDefsSpellings,
12274 /*ArgNames=*/{}) {}
12275bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12276 if (!isa<ObjCInterfaceDecl>(Val: D)) {
12277 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12278 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C interfaces";
12279 return false;
12280 }
12281 return true;
12282}
12283
12284bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12285 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12286 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12287 return false;
12288}
12289
12290void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12291 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
12292}
12293
12294AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
12295 D->addAttr(A: ::new (S.Context) ObjCRequiresPropertyDefsAttr(S.Context, Attr));
12296 return AttributeApplied;
12297}
12298
12299bool isParamExpr(size_t N) const override {
12300 return false;
12301}
12302
12303static const ParsedAttrInfoObjCRequiresPropertyDefs Instance;
12304};
12305const ParsedAttrInfoObjCRequiresPropertyDefs ParsedAttrInfoObjCRequiresPropertyDefs::Instance;
12306static constexpr ParsedAttrInfo::Spelling ObjCRequiresSuperSpellings[] = {
12307 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_requires_super"},
12308 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_requires_super"},
12309 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_requires_super"},
12310};
12311struct ParsedAttrInfoObjCRequiresSuper final : public ParsedAttrInfo {
12312 constexpr ParsedAttrInfoObjCRequiresSuper() : ParsedAttrInfo(
12313 /*AttrKind=*/ParsedAttr::AT_ObjCRequiresSuper,
12314 /*NumArgs=*/0,
12315 /*OptArgs=*/0,
12316 /*NumArgMembers=*/0,
12317 /*HasCustomParsing=*/0,
12318 /*AcceptsExprPack=*/0,
12319 /*IsTargetSpecific=*/0,
12320 /*IsType=*/0,
12321 /*IsStmt=*/0,
12322 /*IsKnownToGCC=*/0,
12323 /*IsSupportedByPragmaAttribute=*/1,
12324 /*Spellings=*/ObjCRequiresSuperSpellings,
12325 /*ArgNames=*/{}) {}
12326bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12327 if (!isa<ObjCMethodDecl>(Val: D)) {
12328 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12329 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods";
12330 return false;
12331 }
12332 return true;
12333}
12334
12335bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12336 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12337 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12338 return false;
12339}
12340
12341void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12342 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
12343}
12344
12345bool isParamExpr(size_t N) const override {
12346 return false;
12347}
12348
12349static const ParsedAttrInfoObjCRequiresSuper Instance;
12350};
12351const ParsedAttrInfoObjCRequiresSuper ParsedAttrInfoObjCRequiresSuper::Instance;
12352static constexpr ParsedAttrInfo::Spelling ObjCReturnsInnerPointerSpellings[] = {
12353 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_returns_inner_pointer"},
12354 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_returns_inner_pointer"},
12355 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_returns_inner_pointer"},
12356};
12357struct ParsedAttrInfoObjCReturnsInnerPointer final : public ParsedAttrInfo {
12358 constexpr ParsedAttrInfoObjCReturnsInnerPointer() : ParsedAttrInfo(
12359 /*AttrKind=*/ParsedAttr::AT_ObjCReturnsInnerPointer,
12360 /*NumArgs=*/0,
12361 /*OptArgs=*/0,
12362 /*NumArgMembers=*/0,
12363 /*HasCustomParsing=*/0,
12364 /*AcceptsExprPack=*/0,
12365 /*IsTargetSpecific=*/0,
12366 /*IsType=*/0,
12367 /*IsStmt=*/0,
12368 /*IsKnownToGCC=*/0,
12369 /*IsSupportedByPragmaAttribute=*/1,
12370 /*Spellings=*/ObjCReturnsInnerPointerSpellings,
12371 /*ArgNames=*/{}) {}
12372bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12373 if (!isa<ObjCMethodDecl>(Val: D) && !isa<ObjCPropertyDecl>(Val: D)) {
12374 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12375 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods and Objective-C properties";
12376 return false;
12377 }
12378 return true;
12379}
12380
12381bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12382 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12383 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12384 return false;
12385}
12386
12387void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12388 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
12389 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_property, /*IsSupported=*/y: LangOpts.ObjC));
12390}
12391
12392bool isParamExpr(size_t N) const override {
12393 return false;
12394}
12395
12396static const ParsedAttrInfoObjCReturnsInnerPointer Instance;
12397};
12398const ParsedAttrInfoObjCReturnsInnerPointer ParsedAttrInfoObjCReturnsInnerPointer::Instance;
12399static constexpr ParsedAttrInfo::Spelling ObjCRootClassSpellings[] = {
12400 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_root_class"},
12401 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_root_class"},
12402 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_root_class"},
12403};
12404struct ParsedAttrInfoObjCRootClass final : public ParsedAttrInfo {
12405 constexpr ParsedAttrInfoObjCRootClass() : ParsedAttrInfo(
12406 /*AttrKind=*/ParsedAttr::AT_ObjCRootClass,
12407 /*NumArgs=*/0,
12408 /*OptArgs=*/0,
12409 /*NumArgMembers=*/0,
12410 /*HasCustomParsing=*/0,
12411 /*AcceptsExprPack=*/0,
12412 /*IsTargetSpecific=*/0,
12413 /*IsType=*/0,
12414 /*IsStmt=*/0,
12415 /*IsKnownToGCC=*/0,
12416 /*IsSupportedByPragmaAttribute=*/1,
12417 /*Spellings=*/ObjCRootClassSpellings,
12418 /*ArgNames=*/{}) {}
12419bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12420 if (!isa<ObjCInterfaceDecl>(Val: D)) {
12421 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12422 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C interfaces";
12423 return false;
12424 }
12425 return true;
12426}
12427
12428bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12429 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12430 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12431 return false;
12432}
12433
12434void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12435 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
12436}
12437
12438AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
12439 D->addAttr(A: ::new (S.Context) ObjCRootClassAttr(S.Context, Attr));
12440 return AttributeApplied;
12441}
12442
12443bool isParamExpr(size_t N) const override {
12444 return false;
12445}
12446
12447static const ParsedAttrInfoObjCRootClass Instance;
12448};
12449const ParsedAttrInfoObjCRootClass ParsedAttrInfoObjCRootClass::Instance;
12450static constexpr ParsedAttrInfo::Spelling ObjCRuntimeNameSpellings[] = {
12451 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_runtime_name"},
12452 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_runtime_name"},
12453 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_runtime_name"},
12454};
12455static constexpr const char *ObjCRuntimeNameArgNames[] = {
12456"MetadataName",};
12457struct ParsedAttrInfoObjCRuntimeName final : public ParsedAttrInfo {
12458 constexpr ParsedAttrInfoObjCRuntimeName() : ParsedAttrInfo(
12459 /*AttrKind=*/ParsedAttr::AT_ObjCRuntimeName,
12460 /*NumArgs=*/1,
12461 /*OptArgs=*/0,
12462 /*NumArgMembers=*/1,
12463 /*HasCustomParsing=*/0,
12464 /*AcceptsExprPack=*/0,
12465 /*IsTargetSpecific=*/0,
12466 /*IsType=*/0,
12467 /*IsStmt=*/0,
12468 /*IsKnownToGCC=*/0,
12469 /*IsSupportedByPragmaAttribute=*/1,
12470 /*Spellings=*/ObjCRuntimeNameSpellings,
12471 /*ArgNames=*/ObjCRuntimeNameArgNames) {}
12472bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12473 if (!isa<ObjCInterfaceDecl>(Val: D) && !isa<ObjCProtocolDecl>(Val: D)) {
12474 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12475 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C interfaces and Objective-C protocols";
12476 return false;
12477 }
12478 return true;
12479}
12480
12481bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12482 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12483 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12484 return false;
12485}
12486
12487void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12488 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
12489 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_protocol, /*IsSupported=*/y: LangOpts.ObjC));
12490}
12491
12492bool isParamExpr(size_t N) const override {
12493 return false;
12494}
12495
12496static const ParsedAttrInfoObjCRuntimeName Instance;
12497};
12498const ParsedAttrInfoObjCRuntimeName ParsedAttrInfoObjCRuntimeName::Instance;
12499static constexpr ParsedAttrInfo::Spelling ObjCRuntimeVisibleSpellings[] = {
12500 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_runtime_visible"},
12501 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_runtime_visible"},
12502 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_runtime_visible"},
12503};
12504struct ParsedAttrInfoObjCRuntimeVisible final : public ParsedAttrInfo {
12505 constexpr ParsedAttrInfoObjCRuntimeVisible() : ParsedAttrInfo(
12506 /*AttrKind=*/ParsedAttr::AT_ObjCRuntimeVisible,
12507 /*NumArgs=*/0,
12508 /*OptArgs=*/0,
12509 /*NumArgMembers=*/0,
12510 /*HasCustomParsing=*/0,
12511 /*AcceptsExprPack=*/0,
12512 /*IsTargetSpecific=*/0,
12513 /*IsType=*/0,
12514 /*IsStmt=*/0,
12515 /*IsKnownToGCC=*/0,
12516 /*IsSupportedByPragmaAttribute=*/1,
12517 /*Spellings=*/ObjCRuntimeVisibleSpellings,
12518 /*ArgNames=*/{}) {}
12519bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12520 if (!isa<ObjCInterfaceDecl>(Val: D)) {
12521 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12522 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C interfaces";
12523 return false;
12524 }
12525 return true;
12526}
12527
12528bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12529 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12530 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12531 return false;
12532}
12533
12534void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12535 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
12536}
12537
12538AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
12539 D->addAttr(A: ::new (S.Context) ObjCRuntimeVisibleAttr(S.Context, Attr));
12540 return AttributeApplied;
12541}
12542
12543bool isParamExpr(size_t N) const override {
12544 return false;
12545}
12546
12547static const ParsedAttrInfoObjCRuntimeVisible Instance;
12548};
12549const ParsedAttrInfoObjCRuntimeVisible ParsedAttrInfoObjCRuntimeVisible::Instance;
12550static constexpr ParsedAttrInfo::Spelling ObjCSubclassingRestrictedSpellings[] = {
12551 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "objc_subclassing_restricted"},
12552 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::objc_subclassing_restricted"},
12553 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::objc_subclassing_restricted"},
12554};
12555struct ParsedAttrInfoObjCSubclassingRestricted final : public ParsedAttrInfo {
12556 constexpr ParsedAttrInfoObjCSubclassingRestricted() : ParsedAttrInfo(
12557 /*AttrKind=*/ParsedAttr::AT_ObjCSubclassingRestricted,
12558 /*NumArgs=*/0,
12559 /*OptArgs=*/0,
12560 /*NumArgMembers=*/0,
12561 /*HasCustomParsing=*/0,
12562 /*AcceptsExprPack=*/0,
12563 /*IsTargetSpecific=*/0,
12564 /*IsType=*/0,
12565 /*IsStmt=*/0,
12566 /*IsKnownToGCC=*/0,
12567 /*IsSupportedByPragmaAttribute=*/1,
12568 /*Spellings=*/ObjCSubclassingRestrictedSpellings,
12569 /*ArgNames=*/{}) {}
12570bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12571 if (!isa<ObjCInterfaceDecl>(Val: D)) {
12572 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12573 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C interfaces";
12574 return false;
12575 }
12576 return true;
12577}
12578
12579bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12580 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12581 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12582 return false;
12583}
12584
12585void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12586 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
12587}
12588
12589AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
12590 D->addAttr(A: ::new (S.Context) ObjCSubclassingRestrictedAttr(S.Context, Attr));
12591 return AttributeApplied;
12592}
12593
12594bool isParamExpr(size_t N) const override {
12595 return false;
12596}
12597
12598static const ParsedAttrInfoObjCSubclassingRestricted Instance;
12599};
12600const ParsedAttrInfoObjCSubclassingRestricted ParsedAttrInfoObjCSubclassingRestricted::Instance;
12601static constexpr ParsedAttrInfo::Spelling OpenCLAccessSpellings[] = {
12602 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__read_only"},
12603 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "read_only"},
12604 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__write_only"},
12605 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "write_only"},
12606 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__read_write"},
12607 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "read_write"},
12608};
12609struct ParsedAttrInfoOpenCLAccess final : public ParsedAttrInfo {
12610 constexpr ParsedAttrInfoOpenCLAccess() : ParsedAttrInfo(
12611 /*AttrKind=*/ParsedAttr::AT_OpenCLAccess,
12612 /*NumArgs=*/0,
12613 /*OptArgs=*/0,
12614 /*NumArgMembers=*/0,
12615 /*HasCustomParsing=*/0,
12616 /*AcceptsExprPack=*/0,
12617 /*IsTargetSpecific=*/0,
12618 /*IsType=*/0,
12619 /*IsStmt=*/0,
12620 /*IsKnownToGCC=*/0,
12621 /*IsSupportedByPragmaAttribute=*/0,
12622 /*Spellings=*/OpenCLAccessSpellings,
12623 /*ArgNames=*/{}) {}
12624bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12625 if (!isa<ParmVarDecl>(Val: D) && !isa<TypedefNameDecl>(Val: D)) {
12626 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12627 << Attr << Attr.isRegularKeywordAttribute() << "parameters and typedefs";
12628 return false;
12629 }
12630 return true;
12631}
12632
12633bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12634 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12635 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12636 return false;
12637}
12638
12639unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
12640 enum Spelling {
12641 Keyword_read_only = 0,
12642 Keyword_write_only = 2,
12643 Keyword_read_write = 4,
12644 SpellingNotCalculated = 15
12645
12646 };
12647
12648 unsigned Idx = Attr.getAttributeSpellingListIndex();
12649 switch (Idx) {
12650 default: llvm_unreachable("Unknown spelling list index");
12651 case 0: return Keyword_read_only;
12652 case 1: return Keyword_read_only;
12653 case 2: return Keyword_write_only;
12654 case 3: return Keyword_write_only;
12655 case 4: return Keyword_read_write;
12656 case 5: return Keyword_read_write;
12657 }
12658}
12659
12660bool isParamExpr(size_t N) const override {
12661 return false;
12662}
12663
12664static const ParsedAttrInfoOpenCLAccess Instance;
12665};
12666const ParsedAttrInfoOpenCLAccess ParsedAttrInfoOpenCLAccess::Instance;
12667static constexpr ParsedAttrInfo::Spelling OpenCLConstantAddressSpaceSpellings[] = {
12668 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__constant"},
12669 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "constant"},
12670 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "opencl_constant"},
12671 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::opencl_constant"},
12672 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::opencl_constant"},
12673};
12674struct ParsedAttrInfoOpenCLConstantAddressSpace final : public ParsedAttrInfo {
12675 constexpr ParsedAttrInfoOpenCLConstantAddressSpace() : ParsedAttrInfo(
12676 /*AttrKind=*/ParsedAttr::AT_OpenCLConstantAddressSpace,
12677 /*NumArgs=*/0,
12678 /*OptArgs=*/0,
12679 /*NumArgMembers=*/0,
12680 /*HasCustomParsing=*/0,
12681 /*AcceptsExprPack=*/0,
12682 /*IsTargetSpecific=*/0,
12683 /*IsType=*/1,
12684 /*IsStmt=*/0,
12685 /*IsKnownToGCC=*/0,
12686 /*IsSupportedByPragmaAttribute=*/0,
12687 /*Spellings=*/OpenCLConstantAddressSpaceSpellings,
12688 /*ArgNames=*/{}) {}
12689unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
12690 enum Spelling {
12691 Keyword_constant = 0,
12692 GNU_opencl_constant = 2,
12693 CXX11_clang_opencl_constant = 3,
12694 C23_clang_opencl_constant = 4,
12695 SpellingNotCalculated = 15
12696
12697 };
12698
12699 unsigned Idx = Attr.getAttributeSpellingListIndex();
12700 switch (Idx) {
12701 default: llvm_unreachable("Unknown spelling list index");
12702 case 0: return Keyword_constant;
12703 case 1: return Keyword_constant;
12704 case 2: return GNU_opencl_constant;
12705 case 3: return CXX11_clang_opencl_constant;
12706 case 4: return C23_clang_opencl_constant;
12707 }
12708}
12709
12710bool isParamExpr(size_t N) const override {
12711 return false;
12712}
12713
12714static const ParsedAttrInfoOpenCLConstantAddressSpace Instance;
12715};
12716const ParsedAttrInfoOpenCLConstantAddressSpace ParsedAttrInfoOpenCLConstantAddressSpace::Instance;
12717static constexpr ParsedAttrInfo::Spelling OpenCLGenericAddressSpaceSpellings[] = {
12718 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__generic"},
12719 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "generic"},
12720 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "opencl_generic"},
12721 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::opencl_generic"},
12722 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::opencl_generic"},
12723};
12724struct ParsedAttrInfoOpenCLGenericAddressSpace final : public ParsedAttrInfo {
12725 constexpr ParsedAttrInfoOpenCLGenericAddressSpace() : ParsedAttrInfo(
12726 /*AttrKind=*/ParsedAttr::AT_OpenCLGenericAddressSpace,
12727 /*NumArgs=*/0,
12728 /*OptArgs=*/0,
12729 /*NumArgMembers=*/0,
12730 /*HasCustomParsing=*/0,
12731 /*AcceptsExprPack=*/0,
12732 /*IsTargetSpecific=*/0,
12733 /*IsType=*/1,
12734 /*IsStmt=*/0,
12735 /*IsKnownToGCC=*/0,
12736 /*IsSupportedByPragmaAttribute=*/0,
12737 /*Spellings=*/OpenCLGenericAddressSpaceSpellings,
12738 /*ArgNames=*/{}) {}
12739unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
12740 enum Spelling {
12741 Keyword_generic = 0,
12742 GNU_opencl_generic = 2,
12743 CXX11_clang_opencl_generic = 3,
12744 C23_clang_opencl_generic = 4,
12745 SpellingNotCalculated = 15
12746
12747 };
12748
12749 unsigned Idx = Attr.getAttributeSpellingListIndex();
12750 switch (Idx) {
12751 default: llvm_unreachable("Unknown spelling list index");
12752 case 0: return Keyword_generic;
12753 case 1: return Keyword_generic;
12754 case 2: return GNU_opencl_generic;
12755 case 3: return CXX11_clang_opencl_generic;
12756 case 4: return C23_clang_opencl_generic;
12757 }
12758}
12759
12760bool isParamExpr(size_t N) const override {
12761 return false;
12762}
12763
12764static const ParsedAttrInfoOpenCLGenericAddressSpace Instance;
12765};
12766const ParsedAttrInfoOpenCLGenericAddressSpace ParsedAttrInfoOpenCLGenericAddressSpace::Instance;
12767static constexpr ParsedAttrInfo::Spelling OpenCLGlobalAddressSpaceSpellings[] = {
12768 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__global"},
12769 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "global"},
12770 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "opencl_global"},
12771 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::opencl_global"},
12772 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::opencl_global"},
12773};
12774struct ParsedAttrInfoOpenCLGlobalAddressSpace final : public ParsedAttrInfo {
12775 constexpr ParsedAttrInfoOpenCLGlobalAddressSpace() : ParsedAttrInfo(
12776 /*AttrKind=*/ParsedAttr::AT_OpenCLGlobalAddressSpace,
12777 /*NumArgs=*/0,
12778 /*OptArgs=*/0,
12779 /*NumArgMembers=*/0,
12780 /*HasCustomParsing=*/0,
12781 /*AcceptsExprPack=*/0,
12782 /*IsTargetSpecific=*/0,
12783 /*IsType=*/1,
12784 /*IsStmt=*/0,
12785 /*IsKnownToGCC=*/0,
12786 /*IsSupportedByPragmaAttribute=*/0,
12787 /*Spellings=*/OpenCLGlobalAddressSpaceSpellings,
12788 /*ArgNames=*/{}) {}
12789unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
12790 enum Spelling {
12791 Keyword_global = 0,
12792 GNU_opencl_global = 2,
12793 CXX11_clang_opencl_global = 3,
12794 C23_clang_opencl_global = 4,
12795 SpellingNotCalculated = 15
12796
12797 };
12798
12799 unsigned Idx = Attr.getAttributeSpellingListIndex();
12800 switch (Idx) {
12801 default: llvm_unreachable("Unknown spelling list index");
12802 case 0: return Keyword_global;
12803 case 1: return Keyword_global;
12804 case 2: return GNU_opencl_global;
12805 case 3: return CXX11_clang_opencl_global;
12806 case 4: return C23_clang_opencl_global;
12807 }
12808}
12809
12810bool isParamExpr(size_t N) const override {
12811 return false;
12812}
12813
12814static const ParsedAttrInfoOpenCLGlobalAddressSpace Instance;
12815};
12816const ParsedAttrInfoOpenCLGlobalAddressSpace ParsedAttrInfoOpenCLGlobalAddressSpace::Instance;
12817static constexpr ParsedAttrInfo::Spelling OpenCLGlobalDeviceAddressSpaceSpellings[] = {
12818 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "opencl_global_device"},
12819 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::opencl_global_device"},
12820 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::opencl_global_device"},
12821};
12822struct ParsedAttrInfoOpenCLGlobalDeviceAddressSpace final : public ParsedAttrInfo {
12823 constexpr ParsedAttrInfoOpenCLGlobalDeviceAddressSpace() : ParsedAttrInfo(
12824 /*AttrKind=*/ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace,
12825 /*NumArgs=*/0,
12826 /*OptArgs=*/0,
12827 /*NumArgMembers=*/0,
12828 /*HasCustomParsing=*/0,
12829 /*AcceptsExprPack=*/0,
12830 /*IsTargetSpecific=*/0,
12831 /*IsType=*/1,
12832 /*IsStmt=*/0,
12833 /*IsKnownToGCC=*/0,
12834 /*IsSupportedByPragmaAttribute=*/0,
12835 /*Spellings=*/OpenCLGlobalDeviceAddressSpaceSpellings,
12836 /*ArgNames=*/{}) {}
12837bool isParamExpr(size_t N) const override {
12838 return false;
12839}
12840
12841static const ParsedAttrInfoOpenCLGlobalDeviceAddressSpace Instance;
12842};
12843const ParsedAttrInfoOpenCLGlobalDeviceAddressSpace ParsedAttrInfoOpenCLGlobalDeviceAddressSpace::Instance;
12844static constexpr ParsedAttrInfo::Spelling OpenCLGlobalHostAddressSpaceSpellings[] = {
12845 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "opencl_global_host"},
12846 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::opencl_global_host"},
12847 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::opencl_global_host"},
12848};
12849struct ParsedAttrInfoOpenCLGlobalHostAddressSpace final : public ParsedAttrInfo {
12850 constexpr ParsedAttrInfoOpenCLGlobalHostAddressSpace() : ParsedAttrInfo(
12851 /*AttrKind=*/ParsedAttr::AT_OpenCLGlobalHostAddressSpace,
12852 /*NumArgs=*/0,
12853 /*OptArgs=*/0,
12854 /*NumArgMembers=*/0,
12855 /*HasCustomParsing=*/0,
12856 /*AcceptsExprPack=*/0,
12857 /*IsTargetSpecific=*/0,
12858 /*IsType=*/1,
12859 /*IsStmt=*/0,
12860 /*IsKnownToGCC=*/0,
12861 /*IsSupportedByPragmaAttribute=*/0,
12862 /*Spellings=*/OpenCLGlobalHostAddressSpaceSpellings,
12863 /*ArgNames=*/{}) {}
12864bool isParamExpr(size_t N) const override {
12865 return false;
12866}
12867
12868static const ParsedAttrInfoOpenCLGlobalHostAddressSpace Instance;
12869};
12870const ParsedAttrInfoOpenCLGlobalHostAddressSpace ParsedAttrInfoOpenCLGlobalHostAddressSpace::Instance;
12871static constexpr ParsedAttrInfo::Spelling OpenCLIntelReqdSubGroupSizeSpellings[] = {
12872 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "intel_reqd_sub_group_size"},
12873};
12874static constexpr const char *OpenCLIntelReqdSubGroupSizeArgNames[] = {
12875"SubGroupSize",};
12876struct ParsedAttrInfoOpenCLIntelReqdSubGroupSize final : public ParsedAttrInfo {
12877 constexpr ParsedAttrInfoOpenCLIntelReqdSubGroupSize() : ParsedAttrInfo(
12878 /*AttrKind=*/ParsedAttr::AT_OpenCLIntelReqdSubGroupSize,
12879 /*NumArgs=*/1,
12880 /*OptArgs=*/0,
12881 /*NumArgMembers=*/1,
12882 /*HasCustomParsing=*/0,
12883 /*AcceptsExprPack=*/0,
12884 /*IsTargetSpecific=*/0,
12885 /*IsType=*/0,
12886 /*IsStmt=*/0,
12887 /*IsKnownToGCC=*/0,
12888 /*IsSupportedByPragmaAttribute=*/1,
12889 /*Spellings=*/OpenCLIntelReqdSubGroupSizeSpellings,
12890 /*ArgNames=*/OpenCLIntelReqdSubGroupSizeArgNames) {}
12891bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12892 if (!isa<FunctionDecl>(Val: D)) {
12893 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12894 << Attr << Attr.isRegularKeywordAttribute() << "functions";
12895 return false;
12896 }
12897 return true;
12898}
12899
12900bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12901 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12902 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12903 return false;
12904}
12905
12906void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
12907 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
12908}
12909
12910bool isParamExpr(size_t N) const override {
12911 return false;
12912}
12913
12914static const ParsedAttrInfoOpenCLIntelReqdSubGroupSize Instance;
12915};
12916const ParsedAttrInfoOpenCLIntelReqdSubGroupSize ParsedAttrInfoOpenCLIntelReqdSubGroupSize::Instance;
12917static constexpr ParsedAttrInfo::Spelling OpenCLKernelSpellings[] = {
12918 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__kernel"},
12919 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "kernel"},
12920};
12921struct ParsedAttrInfoOpenCLKernel final : public ParsedAttrInfo {
12922 constexpr ParsedAttrInfoOpenCLKernel() : ParsedAttrInfo(
12923 /*AttrKind=*/ParsedAttr::AT_OpenCLKernel,
12924 /*NumArgs=*/0,
12925 /*OptArgs=*/0,
12926 /*NumArgMembers=*/0,
12927 /*HasCustomParsing=*/0,
12928 /*AcceptsExprPack=*/0,
12929 /*IsTargetSpecific=*/0,
12930 /*IsType=*/0,
12931 /*IsStmt=*/0,
12932 /*IsKnownToGCC=*/0,
12933 /*IsSupportedByPragmaAttribute=*/0,
12934 /*Spellings=*/OpenCLKernelSpellings,
12935 /*ArgNames=*/{}) {}
12936bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
12937 if (!isa<FunctionDecl>(Val: D)) {
12938 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
12939 << Attr << Attr.isRegularKeywordAttribute() << "functions";
12940 return false;
12941 }
12942 return true;
12943}
12944
12945bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
12946 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
12947 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
12948 return false;
12949}
12950
12951AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
12952 D->addAttr(A: ::new (S.Context) OpenCLKernelAttr(S.Context, Attr));
12953 return AttributeApplied;
12954}
12955
12956bool isParamExpr(size_t N) const override {
12957 return false;
12958}
12959
12960static const ParsedAttrInfoOpenCLKernel Instance;
12961};
12962const ParsedAttrInfoOpenCLKernel ParsedAttrInfoOpenCLKernel::Instance;
12963static constexpr ParsedAttrInfo::Spelling OpenCLLocalAddressSpaceSpellings[] = {
12964 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__local"},
12965 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "local"},
12966 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "opencl_local"},
12967 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::opencl_local"},
12968 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::opencl_local"},
12969};
12970struct ParsedAttrInfoOpenCLLocalAddressSpace final : public ParsedAttrInfo {
12971 constexpr ParsedAttrInfoOpenCLLocalAddressSpace() : ParsedAttrInfo(
12972 /*AttrKind=*/ParsedAttr::AT_OpenCLLocalAddressSpace,
12973 /*NumArgs=*/0,
12974 /*OptArgs=*/0,
12975 /*NumArgMembers=*/0,
12976 /*HasCustomParsing=*/0,
12977 /*AcceptsExprPack=*/0,
12978 /*IsTargetSpecific=*/0,
12979 /*IsType=*/1,
12980 /*IsStmt=*/0,
12981 /*IsKnownToGCC=*/0,
12982 /*IsSupportedByPragmaAttribute=*/0,
12983 /*Spellings=*/OpenCLLocalAddressSpaceSpellings,
12984 /*ArgNames=*/{}) {}
12985unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
12986 enum Spelling {
12987 Keyword_local = 0,
12988 GNU_opencl_local = 2,
12989 CXX11_clang_opencl_local = 3,
12990 C23_clang_opencl_local = 4,
12991 SpellingNotCalculated = 15
12992
12993 };
12994
12995 unsigned Idx = Attr.getAttributeSpellingListIndex();
12996 switch (Idx) {
12997 default: llvm_unreachable("Unknown spelling list index");
12998 case 0: return Keyword_local;
12999 case 1: return Keyword_local;
13000 case 2: return GNU_opencl_local;
13001 case 3: return CXX11_clang_opencl_local;
13002 case 4: return C23_clang_opencl_local;
13003 }
13004}
13005
13006bool isParamExpr(size_t N) const override {
13007 return false;
13008}
13009
13010static const ParsedAttrInfoOpenCLLocalAddressSpace Instance;
13011};
13012const ParsedAttrInfoOpenCLLocalAddressSpace ParsedAttrInfoOpenCLLocalAddressSpace::Instance;
13013static constexpr ParsedAttrInfo::Spelling OpenCLNoSVMSpellings[] = {
13014 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "nosvm"},
13015};
13016struct ParsedAttrInfoOpenCLNoSVM final : public ParsedAttrInfo {
13017 constexpr ParsedAttrInfoOpenCLNoSVM() : ParsedAttrInfo(
13018 /*AttrKind=*/ParsedAttr::AT_OpenCLNoSVM,
13019 /*NumArgs=*/0,
13020 /*OptArgs=*/0,
13021 /*NumArgMembers=*/0,
13022 /*HasCustomParsing=*/0,
13023 /*AcceptsExprPack=*/0,
13024 /*IsTargetSpecific=*/0,
13025 /*IsType=*/0,
13026 /*IsStmt=*/0,
13027 /*IsKnownToGCC=*/0,
13028 /*IsSupportedByPragmaAttribute=*/1,
13029 /*Spellings=*/OpenCLNoSVMSpellings,
13030 /*ArgNames=*/{}) {}
13031bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13032 if (!isa<VarDecl>(Val: D)) {
13033 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
13034 << Attr << Attr.isRegularKeywordAttribute() << "variables";
13035 return false;
13036 }
13037 return true;
13038}
13039
13040bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13041 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13042 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13043 return false;
13044}
13045
13046bool acceptsLangOpts(const LangOptions &LangOpts) const override {
13047 return LangOpts.OpenCL;
13048}
13049
13050void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
13051 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
13052}
13053
13054bool isParamExpr(size_t N) const override {
13055 return false;
13056}
13057
13058static const ParsedAttrInfoOpenCLNoSVM Instance;
13059};
13060const ParsedAttrInfoOpenCLNoSVM ParsedAttrInfoOpenCLNoSVM::Instance;
13061static constexpr ParsedAttrInfo::Spelling OpenCLPrivateAddressSpaceSpellings[] = {
13062 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__private"},
13063 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "private"},
13064 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "opencl_private"},
13065 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::opencl_private"},
13066 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::opencl_private"},
13067};
13068struct ParsedAttrInfoOpenCLPrivateAddressSpace final : public ParsedAttrInfo {
13069 constexpr ParsedAttrInfoOpenCLPrivateAddressSpace() : ParsedAttrInfo(
13070 /*AttrKind=*/ParsedAttr::AT_OpenCLPrivateAddressSpace,
13071 /*NumArgs=*/0,
13072 /*OptArgs=*/0,
13073 /*NumArgMembers=*/0,
13074 /*HasCustomParsing=*/0,
13075 /*AcceptsExprPack=*/0,
13076 /*IsTargetSpecific=*/0,
13077 /*IsType=*/1,
13078 /*IsStmt=*/0,
13079 /*IsKnownToGCC=*/0,
13080 /*IsSupportedByPragmaAttribute=*/0,
13081 /*Spellings=*/OpenCLPrivateAddressSpaceSpellings,
13082 /*ArgNames=*/{}) {}
13083unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
13084 enum Spelling {
13085 Keyword_private = 0,
13086 GNU_opencl_private = 2,
13087 CXX11_clang_opencl_private = 3,
13088 C23_clang_opencl_private = 4,
13089 SpellingNotCalculated = 15
13090
13091 };
13092
13093 unsigned Idx = Attr.getAttributeSpellingListIndex();
13094 switch (Idx) {
13095 default: llvm_unreachable("Unknown spelling list index");
13096 case 0: return Keyword_private;
13097 case 1: return Keyword_private;
13098 case 2: return GNU_opencl_private;
13099 case 3: return CXX11_clang_opencl_private;
13100 case 4: return C23_clang_opencl_private;
13101 }
13102}
13103
13104bool isParamExpr(size_t N) const override {
13105 return false;
13106}
13107
13108static const ParsedAttrInfoOpenCLPrivateAddressSpace Instance;
13109};
13110const ParsedAttrInfoOpenCLPrivateAddressSpace ParsedAttrInfoOpenCLPrivateAddressSpace::Instance;
13111static constexpr ParsedAttrInfo::Spelling OpenCLUnrollHintSpellings[] = {
13112 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "opencl_unroll_hint"},
13113};
13114static constexpr const char *OpenCLUnrollHintArgNames[] = {
13115"UnrollHint",};
13116struct ParsedAttrInfoOpenCLUnrollHint final : public ParsedAttrInfo {
13117 constexpr ParsedAttrInfoOpenCLUnrollHint() : ParsedAttrInfo(
13118 /*AttrKind=*/ParsedAttr::AT_OpenCLUnrollHint,
13119 /*NumArgs=*/0,
13120 /*OptArgs=*/1,
13121 /*NumArgMembers=*/1,
13122 /*HasCustomParsing=*/0,
13123 /*AcceptsExprPack=*/0,
13124 /*IsTargetSpecific=*/0,
13125 /*IsType=*/0,
13126 /*IsStmt=*/1,
13127 /*IsKnownToGCC=*/0,
13128 /*IsSupportedByPragmaAttribute=*/0,
13129 /*Spellings=*/OpenCLUnrollHintSpellings,
13130 /*ArgNames=*/OpenCLUnrollHintArgNames) {}
13131bool diagAppertainsToDecl(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
13132 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attribute_invalid_on_decl)
13133 << AL << AL.isRegularKeywordAttribute() << D->getLocation();
13134 return false;
13135}
13136
13137bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
13138 if (!isa<ForStmt>(Val: St) && !isa<CXXForRangeStmt>(Val: St) && !isa<WhileStmt>(Val: St) && !isa<DoStmt>(Val: St)) {
13139 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
13140 << Attr << Attr.isRegularKeywordAttribute() << "'for', 'while', and 'do' statements";
13141 return false;
13142 }
13143 return true;
13144}
13145
13146bool isParamExpr(size_t N) const override {
13147 return false;
13148}
13149
13150static const ParsedAttrInfoOpenCLUnrollHint Instance;
13151};
13152const ParsedAttrInfoOpenCLUnrollHint ParsedAttrInfoOpenCLUnrollHint::Instance;
13153static constexpr ParsedAttrInfo::Spelling OptimizeNoneSpellings[] = {
13154 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "optnone"},
13155 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::optnone"},
13156 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::optnone"},
13157};
13158struct ParsedAttrInfoOptimizeNone final : public ParsedAttrInfo {
13159 constexpr ParsedAttrInfoOptimizeNone() : ParsedAttrInfo(
13160 /*AttrKind=*/ParsedAttr::AT_OptimizeNone,
13161 /*NumArgs=*/0,
13162 /*OptArgs=*/0,
13163 /*NumArgMembers=*/0,
13164 /*HasCustomParsing=*/0,
13165 /*AcceptsExprPack=*/0,
13166 /*IsTargetSpecific=*/0,
13167 /*IsType=*/0,
13168 /*IsStmt=*/0,
13169 /*IsKnownToGCC=*/0,
13170 /*IsSupportedByPragmaAttribute=*/1,
13171 /*Spellings=*/OptimizeNoneSpellings,
13172 /*ArgNames=*/{}) {}
13173bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13174 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
13175 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
13176 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
13177 return false;
13178 }
13179 return true;
13180}
13181
13182bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13183 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13184 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13185 return false;
13186}
13187
13188void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
13189 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
13190 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
13191}
13192
13193bool isParamExpr(size_t N) const override {
13194 return false;
13195}
13196
13197static const ParsedAttrInfoOptimizeNone Instance;
13198};
13199const ParsedAttrInfoOptimizeNone ParsedAttrInfoOptimizeNone::Instance;
13200static constexpr ParsedAttrInfo::Spelling OverloadableSpellings[] = {
13201 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "overloadable"},
13202 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::overloadable"},
13203 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::overloadable"},
13204};
13205struct ParsedAttrInfoOverloadable final : public ParsedAttrInfo {
13206 constexpr ParsedAttrInfoOverloadable() : ParsedAttrInfo(
13207 /*AttrKind=*/ParsedAttr::AT_Overloadable,
13208 /*NumArgs=*/0,
13209 /*OptArgs=*/0,
13210 /*NumArgMembers=*/0,
13211 /*HasCustomParsing=*/0,
13212 /*AcceptsExprPack=*/0,
13213 /*IsTargetSpecific=*/0,
13214 /*IsType=*/0,
13215 /*IsStmt=*/0,
13216 /*IsKnownToGCC=*/0,
13217 /*IsSupportedByPragmaAttribute=*/1,
13218 /*Spellings=*/OverloadableSpellings,
13219 /*ArgNames=*/{}) {}
13220bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13221 if (!isa<FunctionDecl>(Val: D)) {
13222 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
13223 << Attr << Attr.isRegularKeywordAttribute() << "functions";
13224 return false;
13225 }
13226 return true;
13227}
13228
13229bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13230 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13231 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13232 return false;
13233}
13234
13235void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
13236 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
13237}
13238
13239AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
13240 D->addAttr(A: ::new (S.Context) OverloadableAttr(S.Context, Attr));
13241 return AttributeApplied;
13242}
13243
13244bool isParamExpr(size_t N) const override {
13245 return false;
13246}
13247
13248static const ParsedAttrInfoOverloadable Instance;
13249};
13250const ParsedAttrInfoOverloadable ParsedAttrInfoOverloadable::Instance;
13251static constexpr ParsedAttrInfo::Spelling OwnerSpellings[] = {
13252 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gsl::Owner"},
13253};
13254static constexpr const char *OwnerArgNames[] = {
13255"DerefType",};
13256struct ParsedAttrInfoOwner final : public ParsedAttrInfo {
13257 constexpr ParsedAttrInfoOwner() : ParsedAttrInfo(
13258 /*AttrKind=*/ParsedAttr::AT_Owner,
13259 /*NumArgs=*/0,
13260 /*OptArgs=*/1,
13261 /*NumArgMembers=*/1,
13262 /*HasCustomParsing=*/0,
13263 /*AcceptsExprPack=*/0,
13264 /*IsTargetSpecific=*/0,
13265 /*IsType=*/0,
13266 /*IsStmt=*/0,
13267 /*IsKnownToGCC=*/0,
13268 /*IsSupportedByPragmaAttribute=*/1,
13269 /*Spellings=*/OwnerSpellings,
13270 /*ArgNames=*/OwnerArgNames) {}
13271bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13272 if (!isStruct(D)) {
13273 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
13274 << Attr << Attr.isRegularKeywordAttribute() << "structs";
13275 return false;
13276 }
13277 return true;
13278}
13279
13280bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13281 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13282 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13283 return false;
13284}
13285
13286 using ParsedAttrInfo::diagMutualExclusion;
13287
13288 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
13289 if (const auto *A = D->getAttr<PointerAttr>()) {
13290 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
13291 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
13292return false;
13293 }
13294 return true;
13295 }
13296
13297void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
13298 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record_not_is_union, /*IsSupported=*/y: true));
13299}
13300
13301bool isParamExpr(size_t N) const override {
13302 return false;
13303}
13304
13305static const ParsedAttrInfoOwner Instance;
13306};
13307const ParsedAttrInfoOwner ParsedAttrInfoOwner::Instance;
13308static constexpr ParsedAttrInfo::Spelling OwnershipSpellings[] = {
13309 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ownership_holds"},
13310 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::ownership_holds"},
13311 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::ownership_holds"},
13312 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ownership_returns"},
13313 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::ownership_returns"},
13314 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::ownership_returns"},
13315 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ownership_takes"},
13316 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::ownership_takes"},
13317 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::ownership_takes"},
13318};
13319static constexpr const char *OwnershipArgNames[] = {
13320"Module","Args...",};
13321struct ParsedAttrInfoOwnership final : public ParsedAttrInfo {
13322 constexpr ParsedAttrInfoOwnership() : ParsedAttrInfo(
13323 /*AttrKind=*/ParsedAttr::AT_Ownership,
13324 /*NumArgs=*/1,
13325 /*OptArgs=*/15,
13326 /*NumArgMembers=*/2,
13327 /*HasCustomParsing=*/0,
13328 /*AcceptsExprPack=*/0,
13329 /*IsTargetSpecific=*/0,
13330 /*IsType=*/0,
13331 /*IsStmt=*/0,
13332 /*IsKnownToGCC=*/0,
13333 /*IsSupportedByPragmaAttribute=*/0,
13334 /*Spellings=*/OwnershipSpellings,
13335 /*ArgNames=*/OwnershipArgNames) {}
13336bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13337 if (!isHasFunctionProto(D)) {
13338 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
13339 << Attr << Attr.isRegularKeywordAttribute() << "non-K&R-style functions";
13340 return false;
13341 }
13342 return true;
13343}
13344
13345bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13346 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13347 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13348 return false;
13349}
13350
13351unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
13352 enum Spelling {
13353 GNU_ownership_holds = 0,
13354 CXX11_clang_ownership_holds = 1,
13355 C23_clang_ownership_holds = 2,
13356 GNU_ownership_returns = 3,
13357 CXX11_clang_ownership_returns = 4,
13358 C23_clang_ownership_returns = 5,
13359 GNU_ownership_takes = 6,
13360 CXX11_clang_ownership_takes = 7,
13361 C23_clang_ownership_takes = 8,
13362 SpellingNotCalculated = 15
13363
13364 };
13365
13366 unsigned Idx = Attr.getAttributeSpellingListIndex();
13367 switch (Idx) {
13368 default: llvm_unreachable("Unknown spelling list index");
13369 case 0: return GNU_ownership_holds;
13370 case 1: return CXX11_clang_ownership_holds;
13371 case 2: return C23_clang_ownership_holds;
13372 case 3: return GNU_ownership_returns;
13373 case 4: return CXX11_clang_ownership_returns;
13374 case 5: return C23_clang_ownership_returns;
13375 case 6: return GNU_ownership_takes;
13376 case 7: return CXX11_clang_ownership_takes;
13377 case 8: return C23_clang_ownership_takes;
13378 }
13379}
13380
13381bool isParamExpr(size_t N) const override {
13382 return false;
13383}
13384
13385static const ParsedAttrInfoOwnership Instance;
13386};
13387const ParsedAttrInfoOwnership ParsedAttrInfoOwnership::Instance;
13388static constexpr ParsedAttrInfo::Spelling PackedSpellings[] = {
13389 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "packed"},
13390 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::packed"},
13391 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::packed"},
13392};
13393struct ParsedAttrInfoPacked final : public ParsedAttrInfo {
13394 constexpr ParsedAttrInfoPacked() : ParsedAttrInfo(
13395 /*AttrKind=*/ParsedAttr::AT_Packed,
13396 /*NumArgs=*/0,
13397 /*OptArgs=*/0,
13398 /*NumArgMembers=*/0,
13399 /*HasCustomParsing=*/0,
13400 /*AcceptsExprPack=*/0,
13401 /*IsTargetSpecific=*/0,
13402 /*IsType=*/0,
13403 /*IsStmt=*/0,
13404 /*IsKnownToGCC=*/1,
13405 /*IsSupportedByPragmaAttribute=*/0,
13406 /*Spellings=*/PackedSpellings,
13407 /*ArgNames=*/{}) {}
13408bool isParamExpr(size_t N) const override {
13409 return false;
13410}
13411
13412static const ParsedAttrInfoPacked Instance;
13413};
13414const ParsedAttrInfoPacked ParsedAttrInfoPacked::Instance;
13415static constexpr ParsedAttrInfo::Spelling ParamTypestateSpellings[] = {
13416 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "param_typestate"},
13417 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::param_typestate"},
13418};
13419static constexpr const char *ParamTypestateArgNames[] = {
13420"ParamState",};
13421struct ParsedAttrInfoParamTypestate final : public ParsedAttrInfo {
13422 constexpr ParsedAttrInfoParamTypestate() : ParsedAttrInfo(
13423 /*AttrKind=*/ParsedAttr::AT_ParamTypestate,
13424 /*NumArgs=*/1,
13425 /*OptArgs=*/0,
13426 /*NumArgMembers=*/1,
13427 /*HasCustomParsing=*/0,
13428 /*AcceptsExprPack=*/0,
13429 /*IsTargetSpecific=*/0,
13430 /*IsType=*/0,
13431 /*IsStmt=*/0,
13432 /*IsKnownToGCC=*/0,
13433 /*IsSupportedByPragmaAttribute=*/1,
13434 /*Spellings=*/ParamTypestateSpellings,
13435 /*ArgNames=*/ParamTypestateArgNames) {}
13436bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13437 if (!isa<ParmVarDecl>(Val: D)) {
13438 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
13439 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
13440 return false;
13441 }
13442 return true;
13443}
13444
13445bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13446 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13447 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13448 return false;
13449}
13450
13451void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
13452 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
13453}
13454
13455bool isParamExpr(size_t N) const override {
13456 return false;
13457}
13458
13459static const ParsedAttrInfoParamTypestate Instance;
13460};
13461const ParsedAttrInfoParamTypestate ParsedAttrInfoParamTypestate::Instance;
13462static constexpr ParsedAttrInfo::Spelling PascalSpellings[] = {
13463 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "pascal"},
13464 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::pascal"},
13465 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::pascal"},
13466 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__pascal"},
13467 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_pascal"},
13468};
13469struct ParsedAttrInfoPascal final : public ParsedAttrInfo {
13470 constexpr ParsedAttrInfoPascal() : ParsedAttrInfo(
13471 /*AttrKind=*/ParsedAttr::AT_Pascal,
13472 /*NumArgs=*/0,
13473 /*OptArgs=*/0,
13474 /*NumArgMembers=*/0,
13475 /*HasCustomParsing=*/0,
13476 /*AcceptsExprPack=*/0,
13477 /*IsTargetSpecific=*/0,
13478 /*IsType=*/1,
13479 /*IsStmt=*/0,
13480 /*IsKnownToGCC=*/0,
13481 /*IsSupportedByPragmaAttribute=*/0,
13482 /*Spellings=*/PascalSpellings,
13483 /*ArgNames=*/{}) {}
13484bool isParamExpr(size_t N) const override {
13485 return false;
13486}
13487
13488static const ParsedAttrInfoPascal Instance;
13489};
13490const ParsedAttrInfoPascal ParsedAttrInfoPascal::Instance;
13491static constexpr ParsedAttrInfo::Spelling PassObjectSizeSpellings[] = {
13492 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "pass_object_size"},
13493 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::pass_object_size"},
13494 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::pass_object_size"},
13495 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "pass_dynamic_object_size"},
13496 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::pass_dynamic_object_size"},
13497 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::pass_dynamic_object_size"},
13498};
13499static constexpr const char *PassObjectSizeArgNames[] = {
13500"Type",};
13501struct ParsedAttrInfoPassObjectSize final : public ParsedAttrInfo {
13502 constexpr ParsedAttrInfoPassObjectSize() : ParsedAttrInfo(
13503 /*AttrKind=*/ParsedAttr::AT_PassObjectSize,
13504 /*NumArgs=*/1,
13505 /*OptArgs=*/0,
13506 /*NumArgMembers=*/1,
13507 /*HasCustomParsing=*/0,
13508 /*AcceptsExprPack=*/0,
13509 /*IsTargetSpecific=*/0,
13510 /*IsType=*/0,
13511 /*IsStmt=*/0,
13512 /*IsKnownToGCC=*/0,
13513 /*IsSupportedByPragmaAttribute=*/1,
13514 /*Spellings=*/PassObjectSizeSpellings,
13515 /*ArgNames=*/PassObjectSizeArgNames) {}
13516bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13517 if (!isa<ParmVarDecl>(Val: D)) {
13518 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
13519 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
13520 return false;
13521 }
13522 return true;
13523}
13524
13525bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13526 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13527 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13528 return false;
13529}
13530
13531unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
13532 enum Spelling {
13533 GNU_pass_object_size = 0,
13534 CXX11_clang_pass_object_size = 1,
13535 C23_clang_pass_object_size = 2,
13536 GNU_pass_dynamic_object_size = 3,
13537 CXX11_clang_pass_dynamic_object_size = 4,
13538 C23_clang_pass_dynamic_object_size = 5,
13539 SpellingNotCalculated = 15
13540
13541 };
13542
13543 unsigned Idx = Attr.getAttributeSpellingListIndex();
13544 switch (Idx) {
13545 default: llvm_unreachable("Unknown spelling list index");
13546 case 0: return GNU_pass_object_size;
13547 case 1: return CXX11_clang_pass_object_size;
13548 case 2: return C23_clang_pass_object_size;
13549 case 3: return GNU_pass_dynamic_object_size;
13550 case 4: return CXX11_clang_pass_dynamic_object_size;
13551 case 5: return C23_clang_pass_dynamic_object_size;
13552 }
13553}
13554
13555void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
13556 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
13557}
13558
13559bool isParamExpr(size_t N) const override {
13560 return false;
13561}
13562
13563static const ParsedAttrInfoPassObjectSize Instance;
13564};
13565const ParsedAttrInfoPassObjectSize ParsedAttrInfoPassObjectSize::Instance;
13566static constexpr ParsedAttrInfo::Spelling PatchableFunctionEntrySpellings[] = {
13567 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "patchable_function_entry"},
13568 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::patchable_function_entry"},
13569 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::patchable_function_entry"},
13570};
13571static constexpr const char *PatchableFunctionEntryArgNames[] = {
13572"Count","Offset",};
13573struct ParsedAttrInfoPatchableFunctionEntry final : public ParsedAttrInfo {
13574 constexpr ParsedAttrInfoPatchableFunctionEntry() : ParsedAttrInfo(
13575 /*AttrKind=*/ParsedAttr::AT_PatchableFunctionEntry,
13576 /*NumArgs=*/1,
13577 /*OptArgs=*/1,
13578 /*NumArgMembers=*/2,
13579 /*HasCustomParsing=*/0,
13580 /*AcceptsExprPack=*/0,
13581 /*IsTargetSpecific=*/1,
13582 /*IsType=*/0,
13583 /*IsStmt=*/0,
13584 /*IsKnownToGCC=*/1,
13585 /*IsSupportedByPragmaAttribute=*/1,
13586 /*Spellings=*/PatchableFunctionEntrySpellings,
13587 /*ArgNames=*/PatchableFunctionEntryArgNames) {}
13588bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13589 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
13590 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
13591 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
13592 return false;
13593 }
13594 return true;
13595}
13596
13597bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13598 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13599 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13600 return false;
13601}
13602
13603bool existsInTarget(const TargetInfo &Target) const override {
13604 const llvm::Triple &T = Target.getTriple(); (void)T;
13605 return true && (T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::loongarch32 || T.getArch() == llvm::Triple::loongarch64 || T.getArch() == llvm::Triple::riscv32 || T.getArch() == llvm::Triple::riscv64 || T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64 || T.getArch() == llvm::Triple::ppc || T.getArch() == llvm::Triple::ppc64);
13606}
13607
13608void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
13609 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
13610 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
13611}
13612
13613bool isParamExpr(size_t N) const override {
13614 return false;
13615}
13616
13617static const ParsedAttrInfoPatchableFunctionEntry Instance;
13618};
13619const ParsedAttrInfoPatchableFunctionEntry ParsedAttrInfoPatchableFunctionEntry::Instance;
13620static constexpr ParsedAttrInfo::Spelling PcsSpellings[] = {
13621 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "pcs"},
13622 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::pcs"},
13623 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::pcs"},
13624};
13625static constexpr const char *PcsArgNames[] = {
13626"PCS",};
13627struct ParsedAttrInfoPcs final : public ParsedAttrInfo {
13628 constexpr ParsedAttrInfoPcs() : ParsedAttrInfo(
13629 /*AttrKind=*/ParsedAttr::AT_Pcs,
13630 /*NumArgs=*/1,
13631 /*OptArgs=*/0,
13632 /*NumArgMembers=*/1,
13633 /*HasCustomParsing=*/0,
13634 /*AcceptsExprPack=*/0,
13635 /*IsTargetSpecific=*/0,
13636 /*IsType=*/1,
13637 /*IsStmt=*/0,
13638 /*IsKnownToGCC=*/1,
13639 /*IsSupportedByPragmaAttribute=*/0,
13640 /*Spellings=*/PcsSpellings,
13641 /*ArgNames=*/PcsArgNames) {}
13642bool isParamExpr(size_t N) const override {
13643 return false;
13644}
13645
13646static const ParsedAttrInfoPcs Instance;
13647};
13648const ParsedAttrInfoPcs ParsedAttrInfoPcs::Instance;
13649static constexpr ParsedAttrInfo::Spelling PointerSpellings[] = {
13650 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gsl::Pointer"},
13651};
13652static constexpr const char *PointerArgNames[] = {
13653"DerefType",};
13654struct ParsedAttrInfoPointer final : public ParsedAttrInfo {
13655 constexpr ParsedAttrInfoPointer() : ParsedAttrInfo(
13656 /*AttrKind=*/ParsedAttr::AT_Pointer,
13657 /*NumArgs=*/0,
13658 /*OptArgs=*/1,
13659 /*NumArgMembers=*/1,
13660 /*HasCustomParsing=*/0,
13661 /*AcceptsExprPack=*/0,
13662 /*IsTargetSpecific=*/0,
13663 /*IsType=*/0,
13664 /*IsStmt=*/0,
13665 /*IsKnownToGCC=*/0,
13666 /*IsSupportedByPragmaAttribute=*/1,
13667 /*Spellings=*/PointerSpellings,
13668 /*ArgNames=*/PointerArgNames) {}
13669bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13670 if (!isStruct(D)) {
13671 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
13672 << Attr << Attr.isRegularKeywordAttribute() << "structs";
13673 return false;
13674 }
13675 return true;
13676}
13677
13678bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13679 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13680 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13681 return false;
13682}
13683
13684 using ParsedAttrInfo::diagMutualExclusion;
13685
13686 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
13687 if (const auto *A = D->getAttr<OwnerAttr>()) {
13688 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
13689 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
13690return false;
13691 }
13692 return true;
13693 }
13694
13695void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
13696 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record_not_is_union, /*IsSupported=*/y: true));
13697}
13698
13699bool isParamExpr(size_t N) const override {
13700 return false;
13701}
13702
13703static const ParsedAttrInfoPointer Instance;
13704};
13705const ParsedAttrInfoPointer ParsedAttrInfoPointer::Instance;
13706static constexpr const char *PragmaClangBSSSectionArgNames[] = {
13707"Name",};
13708struct ParsedAttrInfoPragmaClangBSSSection final : public ParsedAttrInfo {
13709 constexpr ParsedAttrInfoPragmaClangBSSSection() : ParsedAttrInfo(
13710 /*AttrKind=*/ParsedAttr::AT_PragmaClangBSSSection,
13711 /*NumArgs=*/1,
13712 /*OptArgs=*/0,
13713 /*NumArgMembers=*/1,
13714 /*HasCustomParsing=*/0,
13715 /*AcceptsExprPack=*/0,
13716 /*IsTargetSpecific=*/0,
13717 /*IsType=*/0,
13718 /*IsStmt=*/0,
13719 /*IsKnownToGCC=*/0,
13720 /*IsSupportedByPragmaAttribute=*/0,
13721 /*Spellings=*/{},
13722 /*ArgNames=*/PragmaClangBSSSectionArgNames) {}
13723bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13724 if (!isGlobalVar(D)) {
13725 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
13726 << Attr << Attr.isRegularKeywordAttribute() << "global variables";
13727 return false;
13728 }
13729 return true;
13730}
13731
13732bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13733 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13734 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13735 return false;
13736}
13737
13738bool isParamExpr(size_t N) const override {
13739 return false;
13740}
13741
13742static const ParsedAttrInfoPragmaClangBSSSection Instance;
13743};
13744const ParsedAttrInfoPragmaClangBSSSection ParsedAttrInfoPragmaClangBSSSection::Instance;
13745static constexpr const char *PragmaClangDataSectionArgNames[] = {
13746"Name",};
13747struct ParsedAttrInfoPragmaClangDataSection final : public ParsedAttrInfo {
13748 constexpr ParsedAttrInfoPragmaClangDataSection() : ParsedAttrInfo(
13749 /*AttrKind=*/ParsedAttr::AT_PragmaClangDataSection,
13750 /*NumArgs=*/1,
13751 /*OptArgs=*/0,
13752 /*NumArgMembers=*/1,
13753 /*HasCustomParsing=*/0,
13754 /*AcceptsExprPack=*/0,
13755 /*IsTargetSpecific=*/0,
13756 /*IsType=*/0,
13757 /*IsStmt=*/0,
13758 /*IsKnownToGCC=*/0,
13759 /*IsSupportedByPragmaAttribute=*/0,
13760 /*Spellings=*/{},
13761 /*ArgNames=*/PragmaClangDataSectionArgNames) {}
13762bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13763 if (!isGlobalVar(D)) {
13764 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
13765 << Attr << Attr.isRegularKeywordAttribute() << "global variables";
13766 return false;
13767 }
13768 return true;
13769}
13770
13771bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13772 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13773 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13774 return false;
13775}
13776
13777bool isParamExpr(size_t N) const override {
13778 return false;
13779}
13780
13781static const ParsedAttrInfoPragmaClangDataSection Instance;
13782};
13783const ParsedAttrInfoPragmaClangDataSection ParsedAttrInfoPragmaClangDataSection::Instance;
13784static constexpr const char *PragmaClangRelroSectionArgNames[] = {
13785"Name",};
13786struct ParsedAttrInfoPragmaClangRelroSection final : public ParsedAttrInfo {
13787 constexpr ParsedAttrInfoPragmaClangRelroSection() : ParsedAttrInfo(
13788 /*AttrKind=*/ParsedAttr::AT_PragmaClangRelroSection,
13789 /*NumArgs=*/1,
13790 /*OptArgs=*/0,
13791 /*NumArgMembers=*/1,
13792 /*HasCustomParsing=*/0,
13793 /*AcceptsExprPack=*/0,
13794 /*IsTargetSpecific=*/0,
13795 /*IsType=*/0,
13796 /*IsStmt=*/0,
13797 /*IsKnownToGCC=*/0,
13798 /*IsSupportedByPragmaAttribute=*/0,
13799 /*Spellings=*/{},
13800 /*ArgNames=*/PragmaClangRelroSectionArgNames) {}
13801bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13802 if (!isGlobalVar(D)) {
13803 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
13804 << Attr << Attr.isRegularKeywordAttribute() << "global variables";
13805 return false;
13806 }
13807 return true;
13808}
13809
13810bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13811 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13812 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13813 return false;
13814}
13815
13816bool isParamExpr(size_t N) const override {
13817 return false;
13818}
13819
13820static const ParsedAttrInfoPragmaClangRelroSection Instance;
13821};
13822const ParsedAttrInfoPragmaClangRelroSection ParsedAttrInfoPragmaClangRelroSection::Instance;
13823static constexpr const char *PragmaClangRodataSectionArgNames[] = {
13824"Name",};
13825struct ParsedAttrInfoPragmaClangRodataSection final : public ParsedAttrInfo {
13826 constexpr ParsedAttrInfoPragmaClangRodataSection() : ParsedAttrInfo(
13827 /*AttrKind=*/ParsedAttr::AT_PragmaClangRodataSection,
13828 /*NumArgs=*/1,
13829 /*OptArgs=*/0,
13830 /*NumArgMembers=*/1,
13831 /*HasCustomParsing=*/0,
13832 /*AcceptsExprPack=*/0,
13833 /*IsTargetSpecific=*/0,
13834 /*IsType=*/0,
13835 /*IsStmt=*/0,
13836 /*IsKnownToGCC=*/0,
13837 /*IsSupportedByPragmaAttribute=*/0,
13838 /*Spellings=*/{},
13839 /*ArgNames=*/PragmaClangRodataSectionArgNames) {}
13840bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13841 if (!isGlobalVar(D)) {
13842 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
13843 << Attr << Attr.isRegularKeywordAttribute() << "global variables";
13844 return false;
13845 }
13846 return true;
13847}
13848
13849bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13850 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13851 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13852 return false;
13853}
13854
13855bool isParamExpr(size_t N) const override {
13856 return false;
13857}
13858
13859static const ParsedAttrInfoPragmaClangRodataSection Instance;
13860};
13861const ParsedAttrInfoPragmaClangRodataSection ParsedAttrInfoPragmaClangRodataSection::Instance;
13862static constexpr const char *PragmaClangTextSectionArgNames[] = {
13863"Name",};
13864struct ParsedAttrInfoPragmaClangTextSection final : public ParsedAttrInfo {
13865 constexpr ParsedAttrInfoPragmaClangTextSection() : ParsedAttrInfo(
13866 /*AttrKind=*/ParsedAttr::AT_PragmaClangTextSection,
13867 /*NumArgs=*/1,
13868 /*OptArgs=*/0,
13869 /*NumArgMembers=*/1,
13870 /*HasCustomParsing=*/0,
13871 /*AcceptsExprPack=*/0,
13872 /*IsTargetSpecific=*/0,
13873 /*IsType=*/0,
13874 /*IsStmt=*/0,
13875 /*IsKnownToGCC=*/0,
13876 /*IsSupportedByPragmaAttribute=*/0,
13877 /*Spellings=*/{},
13878 /*ArgNames=*/PragmaClangTextSectionArgNames) {}
13879bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13880 if (!isa<FunctionDecl>(Val: D)) {
13881 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
13882 << Attr << Attr.isRegularKeywordAttribute() << "functions";
13883 return false;
13884 }
13885 return true;
13886}
13887
13888bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13889 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13890 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13891 return false;
13892}
13893
13894bool isParamExpr(size_t N) const override {
13895 return false;
13896}
13897
13898static const ParsedAttrInfoPragmaClangTextSection Instance;
13899};
13900const ParsedAttrInfoPragmaClangTextSection ParsedAttrInfoPragmaClangTextSection::Instance;
13901static constexpr ParsedAttrInfo::Spelling PreferredNameSpellings[] = {
13902 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "preferred_name"},
13903 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::preferred_name"},
13904};
13905static constexpr const char *PreferredNameArgNames[] = {
13906"TypedefType",};
13907struct ParsedAttrInfoPreferredName final : public ParsedAttrInfo {
13908 constexpr ParsedAttrInfoPreferredName() : ParsedAttrInfo(
13909 /*AttrKind=*/ParsedAttr::AT_PreferredName,
13910 /*NumArgs=*/1,
13911 /*OptArgs=*/0,
13912 /*NumArgMembers=*/1,
13913 /*HasCustomParsing=*/0,
13914 /*AcceptsExprPack=*/0,
13915 /*IsTargetSpecific=*/0,
13916 /*IsType=*/0,
13917 /*IsStmt=*/0,
13918 /*IsKnownToGCC=*/0,
13919 /*IsSupportedByPragmaAttribute=*/0,
13920 /*Spellings=*/PreferredNameSpellings,
13921 /*ArgNames=*/PreferredNameArgNames) {}
13922bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13923 if (!isClassTmpl(D)) {
13924 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
13925 << Attr << Attr.isRegularKeywordAttribute() << "class templates";
13926 return false;
13927 }
13928 return true;
13929}
13930
13931bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13932 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13933 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13934 return false;
13935}
13936
13937bool isParamExpr(size_t N) const override {
13938 return false;
13939}
13940
13941static const ParsedAttrInfoPreferredName Instance;
13942};
13943const ParsedAttrInfoPreferredName ParsedAttrInfoPreferredName::Instance;
13944static constexpr ParsedAttrInfo::Spelling PreferredTypeSpellings[] = {
13945 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "preferred_type"},
13946 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::preferred_type"},
13947 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::preferred_type"},
13948};
13949static constexpr const char *PreferredTypeArgNames[] = {
13950"Type",};
13951struct ParsedAttrInfoPreferredType final : public ParsedAttrInfo {
13952 constexpr ParsedAttrInfoPreferredType() : ParsedAttrInfo(
13953 /*AttrKind=*/ParsedAttr::AT_PreferredType,
13954 /*NumArgs=*/0,
13955 /*OptArgs=*/1,
13956 /*NumArgMembers=*/1,
13957 /*HasCustomParsing=*/0,
13958 /*AcceptsExprPack=*/0,
13959 /*IsTargetSpecific=*/0,
13960 /*IsType=*/0,
13961 /*IsStmt=*/0,
13962 /*IsKnownToGCC=*/0,
13963 /*IsSupportedByPragmaAttribute=*/0,
13964 /*Spellings=*/PreferredTypeSpellings,
13965 /*ArgNames=*/PreferredTypeArgNames) {}
13966bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
13967 if (!isBitField(D)) {
13968 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
13969 << Attr << Attr.isRegularKeywordAttribute() << "bit-field data members";
13970 return false;
13971 }
13972 return true;
13973}
13974
13975bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
13976 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
13977 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
13978 return false;
13979}
13980
13981bool isParamExpr(size_t N) const override {
13982 return false;
13983}
13984
13985static const ParsedAttrInfoPreferredType Instance;
13986};
13987const ParsedAttrInfoPreferredType ParsedAttrInfoPreferredType::Instance;
13988static constexpr ParsedAttrInfo::Spelling PreserveAllSpellings[] = {
13989 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "preserve_all"},
13990 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::preserve_all"},
13991 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::preserve_all"},
13992};
13993struct ParsedAttrInfoPreserveAll final : public ParsedAttrInfo {
13994 constexpr ParsedAttrInfoPreserveAll() : ParsedAttrInfo(
13995 /*AttrKind=*/ParsedAttr::AT_PreserveAll,
13996 /*NumArgs=*/0,
13997 /*OptArgs=*/0,
13998 /*NumArgMembers=*/0,
13999 /*HasCustomParsing=*/0,
14000 /*AcceptsExprPack=*/0,
14001 /*IsTargetSpecific=*/0,
14002 /*IsType=*/1,
14003 /*IsStmt=*/0,
14004 /*IsKnownToGCC=*/0,
14005 /*IsSupportedByPragmaAttribute=*/0,
14006 /*Spellings=*/PreserveAllSpellings,
14007 /*ArgNames=*/{}) {}
14008bool isParamExpr(size_t N) const override {
14009 return false;
14010}
14011
14012static const ParsedAttrInfoPreserveAll Instance;
14013};
14014const ParsedAttrInfoPreserveAll ParsedAttrInfoPreserveAll::Instance;
14015static constexpr ParsedAttrInfo::Spelling PreserveMostSpellings[] = {
14016 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "preserve_most"},
14017 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::preserve_most"},
14018 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::preserve_most"},
14019};
14020struct ParsedAttrInfoPreserveMost final : public ParsedAttrInfo {
14021 constexpr ParsedAttrInfoPreserveMost() : ParsedAttrInfo(
14022 /*AttrKind=*/ParsedAttr::AT_PreserveMost,
14023 /*NumArgs=*/0,
14024 /*OptArgs=*/0,
14025 /*NumArgMembers=*/0,
14026 /*HasCustomParsing=*/0,
14027 /*AcceptsExprPack=*/0,
14028 /*IsTargetSpecific=*/0,
14029 /*IsType=*/1,
14030 /*IsStmt=*/0,
14031 /*IsKnownToGCC=*/0,
14032 /*IsSupportedByPragmaAttribute=*/0,
14033 /*Spellings=*/PreserveMostSpellings,
14034 /*ArgNames=*/{}) {}
14035bool isParamExpr(size_t N) const override {
14036 return false;
14037}
14038
14039static const ParsedAttrInfoPreserveMost Instance;
14040};
14041const ParsedAttrInfoPreserveMost ParsedAttrInfoPreserveMost::Instance;
14042static constexpr ParsedAttrInfo::Spelling PreserveNoneSpellings[] = {
14043 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "preserve_none"},
14044 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::preserve_none"},
14045 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::preserve_none"},
14046};
14047struct ParsedAttrInfoPreserveNone final : public ParsedAttrInfo {
14048 constexpr ParsedAttrInfoPreserveNone() : ParsedAttrInfo(
14049 /*AttrKind=*/ParsedAttr::AT_PreserveNone,
14050 /*NumArgs=*/0,
14051 /*OptArgs=*/0,
14052 /*NumArgMembers=*/0,
14053 /*HasCustomParsing=*/0,
14054 /*AcceptsExprPack=*/0,
14055 /*IsTargetSpecific=*/1,
14056 /*IsType=*/1,
14057 /*IsStmt=*/0,
14058 /*IsKnownToGCC=*/0,
14059 /*IsSupportedByPragmaAttribute=*/1,
14060 /*Spellings=*/PreserveNoneSpellings,
14061 /*ArgNames=*/{}) {}
14062bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14063 if (!isFunctionLike(D)) {
14064 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14065 << Attr << Attr.isRegularKeywordAttribute() << "functions and function pointers";
14066 return false;
14067 }
14068 return true;
14069}
14070
14071bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14072 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14073 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14074 return false;
14075}
14076
14077bool existsInTarget(const TargetInfo &Target) const override {
14078 const llvm::Triple &T = Target.getTriple(); (void)T;
14079 return true && (T.getArch() == llvm::Triple::aarch64 || T.getArch() == llvm::Triple::aarch64_be || T.getArch() == llvm::Triple::aarch64_32 || T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64);
14080}
14081
14082void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
14083 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/y: true));
14084}
14085
14086bool isParamExpr(size_t N) const override {
14087 return false;
14088}
14089
14090static const ParsedAttrInfoPreserveNone Instance;
14091};
14092const ParsedAttrInfoPreserveNone ParsedAttrInfoPreserveNone::Instance;
14093static constexpr ParsedAttrInfo::Spelling PtGuardedBySpellings[] = {
14094 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "pt_guarded_by"},
14095};
14096static constexpr const char *PtGuardedByArgNames[] = {
14097"Arg",};
14098struct ParsedAttrInfoPtGuardedBy final : public ParsedAttrInfo {
14099 constexpr ParsedAttrInfoPtGuardedBy() : ParsedAttrInfo(
14100 /*AttrKind=*/ParsedAttr::AT_PtGuardedBy,
14101 /*NumArgs=*/1,
14102 /*OptArgs=*/0,
14103 /*NumArgMembers=*/1,
14104 /*HasCustomParsing=*/0,
14105 /*AcceptsExprPack=*/0,
14106 /*IsTargetSpecific=*/0,
14107 /*IsType=*/0,
14108 /*IsStmt=*/0,
14109 /*IsKnownToGCC=*/0,
14110 /*IsSupportedByPragmaAttribute=*/0,
14111 /*Spellings=*/PtGuardedBySpellings,
14112 /*ArgNames=*/PtGuardedByArgNames) {}
14113bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14114 if (!isa<FieldDecl>(Val: D) && !isSharedVar(D)) {
14115 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14116 << Attr << Attr.isRegularKeywordAttribute() << "non-static data members and global variables";
14117 return false;
14118 }
14119 return true;
14120}
14121
14122bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14123 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14124 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14125 return false;
14126}
14127
14128bool isParamExpr(size_t N) const override {
14129 return (N == 0) || false;
14130}
14131
14132static const ParsedAttrInfoPtGuardedBy Instance;
14133};
14134const ParsedAttrInfoPtGuardedBy ParsedAttrInfoPtGuardedBy::Instance;
14135static constexpr ParsedAttrInfo::Spelling PtGuardedVarSpellings[] = {
14136 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "pt_guarded_var"},
14137 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::pt_guarded_var"},
14138};
14139struct ParsedAttrInfoPtGuardedVar final : public ParsedAttrInfo {
14140 constexpr ParsedAttrInfoPtGuardedVar() : ParsedAttrInfo(
14141 /*AttrKind=*/ParsedAttr::AT_PtGuardedVar,
14142 /*NumArgs=*/0,
14143 /*OptArgs=*/0,
14144 /*NumArgMembers=*/0,
14145 /*HasCustomParsing=*/0,
14146 /*AcceptsExprPack=*/0,
14147 /*IsTargetSpecific=*/0,
14148 /*IsType=*/0,
14149 /*IsStmt=*/0,
14150 /*IsKnownToGCC=*/0,
14151 /*IsSupportedByPragmaAttribute=*/0,
14152 /*Spellings=*/PtGuardedVarSpellings,
14153 /*ArgNames=*/{}) {}
14154bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14155 if (!isa<FieldDecl>(Val: D) && !isSharedVar(D)) {
14156 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14157 << Attr << Attr.isRegularKeywordAttribute() << "non-static data members and global variables";
14158 return false;
14159 }
14160 return true;
14161}
14162
14163bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14164 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14165 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14166 return false;
14167}
14168
14169bool isParamExpr(size_t N) const override {
14170 return false;
14171}
14172
14173static const ParsedAttrInfoPtGuardedVar Instance;
14174};
14175const ParsedAttrInfoPtGuardedVar ParsedAttrInfoPtGuardedVar::Instance;
14176static constexpr ParsedAttrInfo::Spelling Ptr32Spellings[] = {
14177 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__ptr32"},
14178};
14179struct ParsedAttrInfoPtr32 final : public ParsedAttrInfo {
14180 constexpr ParsedAttrInfoPtr32() : ParsedAttrInfo(
14181 /*AttrKind=*/ParsedAttr::AT_Ptr32,
14182 /*NumArgs=*/0,
14183 /*OptArgs=*/0,
14184 /*NumArgMembers=*/0,
14185 /*HasCustomParsing=*/0,
14186 /*AcceptsExprPack=*/0,
14187 /*IsTargetSpecific=*/0,
14188 /*IsType=*/1,
14189 /*IsStmt=*/0,
14190 /*IsKnownToGCC=*/0,
14191 /*IsSupportedByPragmaAttribute=*/0,
14192 /*Spellings=*/Ptr32Spellings,
14193 /*ArgNames=*/{}) {}
14194bool isParamExpr(size_t N) const override {
14195 return false;
14196}
14197
14198static const ParsedAttrInfoPtr32 Instance;
14199};
14200const ParsedAttrInfoPtr32 ParsedAttrInfoPtr32::Instance;
14201static constexpr ParsedAttrInfo::Spelling Ptr64Spellings[] = {
14202 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__ptr64"},
14203};
14204struct ParsedAttrInfoPtr64 final : public ParsedAttrInfo {
14205 constexpr ParsedAttrInfoPtr64() : ParsedAttrInfo(
14206 /*AttrKind=*/ParsedAttr::AT_Ptr64,
14207 /*NumArgs=*/0,
14208 /*OptArgs=*/0,
14209 /*NumArgMembers=*/0,
14210 /*HasCustomParsing=*/0,
14211 /*AcceptsExprPack=*/0,
14212 /*IsTargetSpecific=*/0,
14213 /*IsType=*/1,
14214 /*IsStmt=*/0,
14215 /*IsKnownToGCC=*/0,
14216 /*IsSupportedByPragmaAttribute=*/0,
14217 /*Spellings=*/Ptr64Spellings,
14218 /*ArgNames=*/{}) {}
14219bool isParamExpr(size_t N) const override {
14220 return false;
14221}
14222
14223static const ParsedAttrInfoPtr64 Instance;
14224};
14225const ParsedAttrInfoPtr64 ParsedAttrInfoPtr64::Instance;
14226static constexpr ParsedAttrInfo::Spelling PureSpellings[] = {
14227 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "pure"},
14228 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::pure"},
14229 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::pure"},
14230};
14231struct ParsedAttrInfoPure final : public ParsedAttrInfo {
14232 constexpr ParsedAttrInfoPure() : ParsedAttrInfo(
14233 /*AttrKind=*/ParsedAttr::AT_Pure,
14234 /*NumArgs=*/0,
14235 /*OptArgs=*/0,
14236 /*NumArgMembers=*/0,
14237 /*HasCustomParsing=*/0,
14238 /*AcceptsExprPack=*/0,
14239 /*IsTargetSpecific=*/0,
14240 /*IsType=*/0,
14241 /*IsStmt=*/0,
14242 /*IsKnownToGCC=*/1,
14243 /*IsSupportedByPragmaAttribute=*/0,
14244 /*Spellings=*/PureSpellings,
14245 /*ArgNames=*/{}) {}
14246AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
14247 D->addAttr(A: ::new (S.Context) PureAttr(S.Context, Attr));
14248 return AttributeApplied;
14249}
14250
14251bool isParamExpr(size_t N) const override {
14252 return false;
14253}
14254
14255static const ParsedAttrInfoPure Instance;
14256};
14257const ParsedAttrInfoPure ParsedAttrInfoPure::Instance;
14258static constexpr ParsedAttrInfo::Spelling RISCVRVVVectorBitsSpellings[] = {
14259 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "riscv_rvv_vector_bits"},
14260};
14261static constexpr const char *RISCVRVVVectorBitsArgNames[] = {
14262"NumBits",};
14263struct ParsedAttrInfoRISCVRVVVectorBits final : public ParsedAttrInfo {
14264 constexpr ParsedAttrInfoRISCVRVVVectorBits() : ParsedAttrInfo(
14265 /*AttrKind=*/ParsedAttr::AT_RISCVRVVVectorBits,
14266 /*NumArgs=*/1,
14267 /*OptArgs=*/0,
14268 /*NumArgMembers=*/1,
14269 /*HasCustomParsing=*/0,
14270 /*AcceptsExprPack=*/0,
14271 /*IsTargetSpecific=*/0,
14272 /*IsType=*/1,
14273 /*IsStmt=*/0,
14274 /*IsKnownToGCC=*/0,
14275 /*IsSupportedByPragmaAttribute=*/0,
14276 /*Spellings=*/RISCVRVVVectorBitsSpellings,
14277 /*ArgNames=*/RISCVRVVVectorBitsArgNames) {}
14278bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14279 if (!isa<TypedefNameDecl>(Val: D)) {
14280 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
14281 << Attr << Attr.isRegularKeywordAttribute() << "typedefs";
14282 return false;
14283 }
14284 return true;
14285}
14286
14287bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14288 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14289 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14290 return false;
14291}
14292
14293bool isParamExpr(size_t N) const override {
14294 return false;
14295}
14296
14297static const ParsedAttrInfoRISCVRVVVectorBits Instance;
14298};
14299const ParsedAttrInfoRISCVRVVVectorBits ParsedAttrInfoRISCVRVVVectorBits::Instance;
14300static constexpr ParsedAttrInfo::Spelling RISCVVectorCCSpellings[] = {
14301 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "riscv::vector_cc"},
14302 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "riscv::vector_cc"},
14303 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "riscv_vector_cc"},
14304 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::riscv_vector_cc"},
14305 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::riscv_vector_cc"},
14306};
14307struct ParsedAttrInfoRISCVVectorCC final : public ParsedAttrInfo {
14308 constexpr ParsedAttrInfoRISCVVectorCC() : ParsedAttrInfo(
14309 /*AttrKind=*/ParsedAttr::AT_RISCVVectorCC,
14310 /*NumArgs=*/0,
14311 /*OptArgs=*/0,
14312 /*NumArgMembers=*/0,
14313 /*HasCustomParsing=*/0,
14314 /*AcceptsExprPack=*/0,
14315 /*IsTargetSpecific=*/1,
14316 /*IsType=*/1,
14317 /*IsStmt=*/0,
14318 /*IsKnownToGCC=*/0,
14319 /*IsSupportedByPragmaAttribute=*/0,
14320 /*Spellings=*/RISCVVectorCCSpellings,
14321 /*ArgNames=*/{}) {}
14322bool existsInTarget(const TargetInfo &Target) const override {
14323 const llvm::Triple &T = Target.getTriple(); (void)T;
14324 return true && (T.getArch() == llvm::Triple::riscv32 || T.getArch() == llvm::Triple::riscv64);
14325}
14326
14327unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
14328 enum Spelling {
14329 CXX11_riscv_vector_cc = 0,
14330 C23_riscv_vector_cc = 1,
14331 GNU_riscv_vector_cc = 2,
14332 CXX11_clang_riscv_vector_cc = 3,
14333 C23_clang_riscv_vector_cc = 4,
14334 SpellingNotCalculated = 15
14335
14336 };
14337
14338 unsigned Idx = Attr.getAttributeSpellingListIndex();
14339 switch (Idx) {
14340 default: llvm_unreachable("Unknown spelling list index");
14341 case 0: return CXX11_riscv_vector_cc;
14342 case 1: return C23_riscv_vector_cc;
14343 case 2: return GNU_riscv_vector_cc;
14344 case 3: return CXX11_clang_riscv_vector_cc;
14345 case 4: return C23_clang_riscv_vector_cc;
14346 }
14347}
14348
14349bool isParamExpr(size_t N) const override {
14350 return false;
14351}
14352
14353static const ParsedAttrInfoRISCVVectorCC Instance;
14354};
14355const ParsedAttrInfoRISCVVectorCC ParsedAttrInfoRISCVVectorCC::Instance;
14356static constexpr ParsedAttrInfo::Spelling RandomizeLayoutSpellings[] = {
14357 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "randomize_layout"},
14358 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::randomize_layout"},
14359 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::randomize_layout"},
14360};
14361struct ParsedAttrInfoRandomizeLayout final : public ParsedAttrInfo {
14362 constexpr ParsedAttrInfoRandomizeLayout() : ParsedAttrInfo(
14363 /*AttrKind=*/ParsedAttr::AT_RandomizeLayout,
14364 /*NumArgs=*/0,
14365 /*OptArgs=*/0,
14366 /*NumArgMembers=*/0,
14367 /*HasCustomParsing=*/0,
14368 /*AcceptsExprPack=*/0,
14369 /*IsTargetSpecific=*/0,
14370 /*IsType=*/0,
14371 /*IsStmt=*/0,
14372 /*IsKnownToGCC=*/1,
14373 /*IsSupportedByPragmaAttribute=*/1,
14374 /*Spellings=*/RandomizeLayoutSpellings,
14375 /*ArgNames=*/{}) {}
14376bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14377 if (!isa<RecordDecl>(Val: D)) {
14378 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14379 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
14380 return false;
14381 }
14382 return true;
14383}
14384
14385bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14386 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14387 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14388 return false;
14389}
14390
14391 using ParsedAttrInfo::diagMutualExclusion;
14392
14393 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
14394 if (const auto *A = D->getAttr<NoRandomizeLayoutAttr>()) {
14395 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
14396 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
14397return false;
14398 }
14399 return true;
14400 }
14401
14402bool acceptsLangOpts(const LangOptions &LangOpts) const override {
14403 return (!LangOpts.CPlusPlus);
14404}
14405
14406void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
14407 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
14408}
14409
14410bool isParamExpr(size_t N) const override {
14411 return false;
14412}
14413
14414static const ParsedAttrInfoRandomizeLayout Instance;
14415};
14416const ParsedAttrInfoRandomizeLayout ParsedAttrInfoRandomizeLayout::Instance;
14417static constexpr ParsedAttrInfo::Spelling ReadOnlyPlacementSpellings[] = {
14418 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "enforce_read_only_placement"},
14419 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::enforce_read_only_placement"},
14420 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::enforce_read_only_placement"},
14421};
14422struct ParsedAttrInfoReadOnlyPlacement final : public ParsedAttrInfo {
14423 constexpr ParsedAttrInfoReadOnlyPlacement() : ParsedAttrInfo(
14424 /*AttrKind=*/ParsedAttr::AT_ReadOnlyPlacement,
14425 /*NumArgs=*/0,
14426 /*OptArgs=*/0,
14427 /*NumArgMembers=*/0,
14428 /*HasCustomParsing=*/0,
14429 /*AcceptsExprPack=*/0,
14430 /*IsTargetSpecific=*/0,
14431 /*IsType=*/0,
14432 /*IsStmt=*/0,
14433 /*IsKnownToGCC=*/0,
14434 /*IsSupportedByPragmaAttribute=*/1,
14435 /*Spellings=*/ReadOnlyPlacementSpellings,
14436 /*ArgNames=*/{}) {}
14437bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14438 if (!isa<RecordDecl>(Val: D)) {
14439 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14440 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
14441 return false;
14442 }
14443 return true;
14444}
14445
14446bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14447 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14448 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14449 return false;
14450}
14451
14452void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
14453 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
14454}
14455
14456bool isParamExpr(size_t N) const override {
14457 return false;
14458}
14459
14460static const ParsedAttrInfoReadOnlyPlacement Instance;
14461};
14462const ParsedAttrInfoReadOnlyPlacement ParsedAttrInfoReadOnlyPlacement::Instance;
14463static constexpr ParsedAttrInfo::Spelling RegCallSpellings[] = {
14464 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "regcall"},
14465 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::regcall"},
14466 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::regcall"},
14467 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__regcall"},
14468};
14469struct ParsedAttrInfoRegCall final : public ParsedAttrInfo {
14470 constexpr ParsedAttrInfoRegCall() : ParsedAttrInfo(
14471 /*AttrKind=*/ParsedAttr::AT_RegCall,
14472 /*NumArgs=*/0,
14473 /*OptArgs=*/0,
14474 /*NumArgMembers=*/0,
14475 /*HasCustomParsing=*/0,
14476 /*AcceptsExprPack=*/0,
14477 /*IsTargetSpecific=*/0,
14478 /*IsType=*/1,
14479 /*IsStmt=*/0,
14480 /*IsKnownToGCC=*/1,
14481 /*IsSupportedByPragmaAttribute=*/0,
14482 /*Spellings=*/RegCallSpellings,
14483 /*ArgNames=*/{}) {}
14484bool isParamExpr(size_t N) const override {
14485 return false;
14486}
14487
14488static const ParsedAttrInfoRegCall Instance;
14489};
14490const ParsedAttrInfoRegCall ParsedAttrInfoRegCall::Instance;
14491static constexpr ParsedAttrInfo::Spelling RegparmSpellings[] = {
14492 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "regparm"},
14493 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::regparm"},
14494 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::regparm"},
14495};
14496static constexpr const char *RegparmArgNames[] = {
14497"NumParams",};
14498struct ParsedAttrInfoRegparm final : public ParsedAttrInfo {
14499 constexpr ParsedAttrInfoRegparm() : ParsedAttrInfo(
14500 /*AttrKind=*/ParsedAttr::AT_Regparm,
14501 /*NumArgs=*/1,
14502 /*OptArgs=*/0,
14503 /*NumArgMembers=*/1,
14504 /*HasCustomParsing=*/0,
14505 /*AcceptsExprPack=*/0,
14506 /*IsTargetSpecific=*/0,
14507 /*IsType=*/1,
14508 /*IsStmt=*/0,
14509 /*IsKnownToGCC=*/1,
14510 /*IsSupportedByPragmaAttribute=*/0,
14511 /*Spellings=*/RegparmSpellings,
14512 /*ArgNames=*/RegparmArgNames) {}
14513bool isParamExpr(size_t N) const override {
14514 return false;
14515}
14516
14517static const ParsedAttrInfoRegparm Instance;
14518};
14519const ParsedAttrInfoRegparm ParsedAttrInfoRegparm::Instance;
14520static constexpr ParsedAttrInfo::Spelling ReinitializesSpellings[] = {
14521 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "reinitializes"},
14522 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::reinitializes"},
14523};
14524struct ParsedAttrInfoReinitializes final : public ParsedAttrInfo {
14525 constexpr ParsedAttrInfoReinitializes() : ParsedAttrInfo(
14526 /*AttrKind=*/ParsedAttr::AT_Reinitializes,
14527 /*NumArgs=*/0,
14528 /*OptArgs=*/0,
14529 /*NumArgMembers=*/0,
14530 /*HasCustomParsing=*/0,
14531 /*AcceptsExprPack=*/0,
14532 /*IsTargetSpecific=*/0,
14533 /*IsType=*/0,
14534 /*IsStmt=*/0,
14535 /*IsKnownToGCC=*/0,
14536 /*IsSupportedByPragmaAttribute=*/0,
14537 /*Spellings=*/ReinitializesSpellings,
14538 /*ArgNames=*/{}) {}
14539bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14540 if (!isNonStaticNonConstCXXMethod(D)) {
14541 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
14542 << Attr << Attr.isRegularKeywordAttribute() << "non-static non-const member functions";
14543 return false;
14544 }
14545 return true;
14546}
14547
14548bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14549 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14550 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14551 return false;
14552}
14553
14554AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
14555 D->addAttr(A: ::new (S.Context) ReinitializesAttr(S.Context, Attr));
14556 return AttributeApplied;
14557}
14558
14559bool isParamExpr(size_t N) const override {
14560 return false;
14561}
14562
14563static const ParsedAttrInfoReinitializes Instance;
14564};
14565const ParsedAttrInfoReinitializes ParsedAttrInfoReinitializes::Instance;
14566static constexpr ParsedAttrInfo::Spelling ReleaseCapabilitySpellings[] = {
14567 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "release_capability"},
14568 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::release_capability"},
14569 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "release_shared_capability"},
14570 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::release_shared_capability"},
14571 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "release_generic_capability"},
14572 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::release_generic_capability"},
14573 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "unlock_function"},
14574 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::unlock_function"},
14575};
14576static constexpr const char *ReleaseCapabilityArgNames[] = {
14577"Args...",};
14578struct ParsedAttrInfoReleaseCapability final : public ParsedAttrInfo {
14579 constexpr ParsedAttrInfoReleaseCapability() : ParsedAttrInfo(
14580 /*AttrKind=*/ParsedAttr::AT_ReleaseCapability,
14581 /*NumArgs=*/0,
14582 /*OptArgs=*/15,
14583 /*NumArgMembers=*/1,
14584 /*HasCustomParsing=*/0,
14585 /*AcceptsExprPack=*/0,
14586 /*IsTargetSpecific=*/0,
14587 /*IsType=*/0,
14588 /*IsStmt=*/0,
14589 /*IsKnownToGCC=*/0,
14590 /*IsSupportedByPragmaAttribute=*/0,
14591 /*Spellings=*/ReleaseCapabilitySpellings,
14592 /*ArgNames=*/ReleaseCapabilityArgNames) {}
14593bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14594 if (!isa<FunctionDecl>(Val: D)) {
14595 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14596 << Attr << Attr.isRegularKeywordAttribute() << "functions";
14597 return false;
14598 }
14599 return true;
14600}
14601
14602bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14603 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14604 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14605 return false;
14606}
14607
14608unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
14609 enum Spelling {
14610 GNU_release_capability = 0,
14611 CXX11_clang_release_capability = 1,
14612 GNU_release_shared_capability = 2,
14613 CXX11_clang_release_shared_capability = 3,
14614 GNU_release_generic_capability = 4,
14615 CXX11_clang_release_generic_capability = 5,
14616 GNU_unlock_function = 6,
14617 CXX11_clang_unlock_function = 7,
14618 SpellingNotCalculated = 15
14619
14620 };
14621
14622 unsigned Idx = Attr.getAttributeSpellingListIndex();
14623 switch (Idx) {
14624 default: llvm_unreachable("Unknown spelling list index");
14625 case 0: return GNU_release_capability;
14626 case 1: return CXX11_clang_release_capability;
14627 case 2: return GNU_release_shared_capability;
14628 case 3: return CXX11_clang_release_shared_capability;
14629 case 4: return GNU_release_generic_capability;
14630 case 5: return CXX11_clang_release_generic_capability;
14631 case 6: return GNU_unlock_function;
14632 case 7: return CXX11_clang_unlock_function;
14633 }
14634}
14635
14636bool isParamExpr(size_t N) const override {
14637 return (N == 0) || false;
14638}
14639
14640static const ParsedAttrInfoReleaseCapability Instance;
14641};
14642const ParsedAttrInfoReleaseCapability ParsedAttrInfoReleaseCapability::Instance;
14643static constexpr ParsedAttrInfo::Spelling ReleaseHandleSpellings[] = {
14644 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "release_handle"},
14645 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::release_handle"},
14646 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::release_handle"},
14647};
14648static constexpr const char *ReleaseHandleArgNames[] = {
14649"HandleType",};
14650struct ParsedAttrInfoReleaseHandle final : public ParsedAttrInfo {
14651 constexpr ParsedAttrInfoReleaseHandle() : ParsedAttrInfo(
14652 /*AttrKind=*/ParsedAttr::AT_ReleaseHandle,
14653 /*NumArgs=*/1,
14654 /*OptArgs=*/0,
14655 /*NumArgMembers=*/1,
14656 /*HasCustomParsing=*/0,
14657 /*AcceptsExprPack=*/0,
14658 /*IsTargetSpecific=*/0,
14659 /*IsType=*/0,
14660 /*IsStmt=*/0,
14661 /*IsKnownToGCC=*/0,
14662 /*IsSupportedByPragmaAttribute=*/1,
14663 /*Spellings=*/ReleaseHandleSpellings,
14664 /*ArgNames=*/ReleaseHandleArgNames) {}
14665bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14666 if (!isa<ParmVarDecl>(Val: D)) {
14667 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14668 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
14669 return false;
14670 }
14671 return true;
14672}
14673
14674bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14675 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14676 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14677 return false;
14678}
14679
14680void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
14681 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
14682}
14683
14684bool isParamExpr(size_t N) const override {
14685 return false;
14686}
14687
14688static const ParsedAttrInfoReleaseHandle Instance;
14689};
14690const ParsedAttrInfoReleaseHandle ParsedAttrInfoReleaseHandle::Instance;
14691static constexpr ParsedAttrInfo::Spelling RenderScriptKernelSpellings[] = {
14692 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "kernel"},
14693};
14694struct ParsedAttrInfoRenderScriptKernel final : public ParsedAttrInfo {
14695 constexpr ParsedAttrInfoRenderScriptKernel() : ParsedAttrInfo(
14696 /*AttrKind=*/ParsedAttr::AT_RenderScriptKernel,
14697 /*NumArgs=*/0,
14698 /*OptArgs=*/0,
14699 /*NumArgMembers=*/0,
14700 /*HasCustomParsing=*/0,
14701 /*AcceptsExprPack=*/0,
14702 /*IsTargetSpecific=*/0,
14703 /*IsType=*/0,
14704 /*IsStmt=*/0,
14705 /*IsKnownToGCC=*/0,
14706 /*IsSupportedByPragmaAttribute=*/1,
14707 /*Spellings=*/RenderScriptKernelSpellings,
14708 /*ArgNames=*/{}) {}
14709bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14710 if (!isa<FunctionDecl>(Val: D)) {
14711 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14712 << Attr << Attr.isRegularKeywordAttribute() << "functions";
14713 return false;
14714 }
14715 return true;
14716}
14717
14718bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14719 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14720 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14721 return false;
14722}
14723
14724bool acceptsLangOpts(const LangOptions &LangOpts) const override {
14725 return LangOpts.RenderScript;
14726}
14727
14728void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
14729 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
14730}
14731
14732AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
14733 D->addAttr(A: ::new (S.Context) RenderScriptKernelAttr(S.Context, Attr));
14734 return AttributeApplied;
14735}
14736
14737bool isParamExpr(size_t N) const override {
14738 return false;
14739}
14740
14741static const ParsedAttrInfoRenderScriptKernel Instance;
14742};
14743const ParsedAttrInfoRenderScriptKernel ParsedAttrInfoRenderScriptKernel::Instance;
14744static constexpr ParsedAttrInfo::Spelling ReqdWorkGroupSizeSpellings[] = {
14745 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "reqd_work_group_size"},
14746};
14747static constexpr const char *ReqdWorkGroupSizeArgNames[] = {
14748"XDim","YDim","ZDim",};
14749struct ParsedAttrInfoReqdWorkGroupSize final : public ParsedAttrInfo {
14750 constexpr ParsedAttrInfoReqdWorkGroupSize() : ParsedAttrInfo(
14751 /*AttrKind=*/ParsedAttr::AT_ReqdWorkGroupSize,
14752 /*NumArgs=*/3,
14753 /*OptArgs=*/0,
14754 /*NumArgMembers=*/3,
14755 /*HasCustomParsing=*/0,
14756 /*AcceptsExprPack=*/0,
14757 /*IsTargetSpecific=*/0,
14758 /*IsType=*/0,
14759 /*IsStmt=*/0,
14760 /*IsKnownToGCC=*/0,
14761 /*IsSupportedByPragmaAttribute=*/1,
14762 /*Spellings=*/ReqdWorkGroupSizeSpellings,
14763 /*ArgNames=*/ReqdWorkGroupSizeArgNames) {}
14764bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14765 if (!isa<FunctionDecl>(Val: D)) {
14766 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
14767 << Attr << Attr.isRegularKeywordAttribute() << "functions";
14768 return false;
14769 }
14770 return true;
14771}
14772
14773bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14774 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14775 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14776 return false;
14777}
14778
14779void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
14780 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
14781}
14782
14783bool isParamExpr(size_t N) const override {
14784 return false;
14785}
14786
14787static const ParsedAttrInfoReqdWorkGroupSize Instance;
14788};
14789const ParsedAttrInfoReqdWorkGroupSize ParsedAttrInfoReqdWorkGroupSize::Instance;
14790static constexpr ParsedAttrInfo::Spelling RequiresCapabilitySpellings[] = {
14791 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "requires_capability"},
14792 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::requires_capability"},
14793 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "exclusive_locks_required"},
14794 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::exclusive_locks_required"},
14795 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "requires_shared_capability"},
14796 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::requires_shared_capability"},
14797 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "shared_locks_required"},
14798 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::shared_locks_required"},
14799};
14800static constexpr const char *RequiresCapabilityArgNames[] = {
14801"Args...",};
14802struct ParsedAttrInfoRequiresCapability final : public ParsedAttrInfo {
14803 constexpr ParsedAttrInfoRequiresCapability() : ParsedAttrInfo(
14804 /*AttrKind=*/ParsedAttr::AT_RequiresCapability,
14805 /*NumArgs=*/0,
14806 /*OptArgs=*/15,
14807 /*NumArgMembers=*/1,
14808 /*HasCustomParsing=*/0,
14809 /*AcceptsExprPack=*/0,
14810 /*IsTargetSpecific=*/0,
14811 /*IsType=*/0,
14812 /*IsStmt=*/0,
14813 /*IsKnownToGCC=*/0,
14814 /*IsSupportedByPragmaAttribute=*/0,
14815 /*Spellings=*/RequiresCapabilitySpellings,
14816 /*ArgNames=*/RequiresCapabilityArgNames) {}
14817bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14818 if (!isa<FunctionDecl>(Val: D)) {
14819 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14820 << Attr << Attr.isRegularKeywordAttribute() << "functions";
14821 return false;
14822 }
14823 return true;
14824}
14825
14826bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14827 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14828 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14829 return false;
14830}
14831
14832unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
14833 enum Spelling {
14834 GNU_requires_capability = 0,
14835 CXX11_clang_requires_capability = 1,
14836 GNU_exclusive_locks_required = 2,
14837 CXX11_clang_exclusive_locks_required = 3,
14838 GNU_requires_shared_capability = 4,
14839 CXX11_clang_requires_shared_capability = 5,
14840 GNU_shared_locks_required = 6,
14841 CXX11_clang_shared_locks_required = 7,
14842 SpellingNotCalculated = 15
14843
14844 };
14845
14846 unsigned Idx = Attr.getAttributeSpellingListIndex();
14847 switch (Idx) {
14848 default: llvm_unreachable("Unknown spelling list index");
14849 case 0: return GNU_requires_capability;
14850 case 1: return CXX11_clang_requires_capability;
14851 case 2: return GNU_exclusive_locks_required;
14852 case 3: return CXX11_clang_exclusive_locks_required;
14853 case 4: return GNU_requires_shared_capability;
14854 case 5: return CXX11_clang_requires_shared_capability;
14855 case 6: return GNU_shared_locks_required;
14856 case 7: return CXX11_clang_shared_locks_required;
14857 }
14858}
14859
14860bool isParamExpr(size_t N) const override {
14861 return (N == 0) || false;
14862}
14863
14864static const ParsedAttrInfoRequiresCapability Instance;
14865};
14866const ParsedAttrInfoRequiresCapability ParsedAttrInfoRequiresCapability::Instance;
14867static constexpr ParsedAttrInfo::Spelling RestrictSpellings[] = {
14868 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "restrict"},
14869 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "malloc"},
14870 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::malloc"},
14871 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::malloc"},
14872};
14873struct ParsedAttrInfoRestrict final : public ParsedAttrInfo {
14874 constexpr ParsedAttrInfoRestrict() : ParsedAttrInfo(
14875 /*AttrKind=*/ParsedAttr::AT_Restrict,
14876 /*NumArgs=*/0,
14877 /*OptArgs=*/0,
14878 /*NumArgMembers=*/0,
14879 /*HasCustomParsing=*/0,
14880 /*AcceptsExprPack=*/0,
14881 /*IsTargetSpecific=*/0,
14882 /*IsType=*/0,
14883 /*IsStmt=*/0,
14884 /*IsKnownToGCC=*/1,
14885 /*IsSupportedByPragmaAttribute=*/1,
14886 /*Spellings=*/RestrictSpellings,
14887 /*ArgNames=*/{}) {}
14888bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14889 if (!isa<FunctionDecl>(Val: D)) {
14890 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14891 << Attr << Attr.isRegularKeywordAttribute() << "functions";
14892 return false;
14893 }
14894 return true;
14895}
14896
14897bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14898 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14899 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14900 return false;
14901}
14902
14903unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
14904 enum Spelling {
14905 Declspec_restrict = 0,
14906 GNU_malloc = 1,
14907 CXX11_gnu_malloc = 2,
14908 C23_gnu_malloc = 3,
14909 SpellingNotCalculated = 15
14910
14911 };
14912
14913 unsigned Idx = Attr.getAttributeSpellingListIndex();
14914 switch (Idx) {
14915 default: llvm_unreachable("Unknown spelling list index");
14916 case 0: return Declspec_restrict;
14917 case 1: return GNU_malloc;
14918 case 2: return CXX11_gnu_malloc;
14919 case 3: return C23_gnu_malloc;
14920 }
14921}
14922
14923void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
14924 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
14925}
14926
14927bool isParamExpr(size_t N) const override {
14928 return false;
14929}
14930
14931static const ParsedAttrInfoRestrict Instance;
14932};
14933const ParsedAttrInfoRestrict ParsedAttrInfoRestrict::Instance;
14934static constexpr ParsedAttrInfo::Spelling RetainSpellings[] = {
14935 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "retain"},
14936 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::retain"},
14937 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::retain"},
14938};
14939struct ParsedAttrInfoRetain final : public ParsedAttrInfo {
14940 constexpr ParsedAttrInfoRetain() : ParsedAttrInfo(
14941 /*AttrKind=*/ParsedAttr::AT_Retain,
14942 /*NumArgs=*/0,
14943 /*OptArgs=*/0,
14944 /*NumArgMembers=*/0,
14945 /*HasCustomParsing=*/0,
14946 /*AcceptsExprPack=*/0,
14947 /*IsTargetSpecific=*/0,
14948 /*IsType=*/0,
14949 /*IsStmt=*/0,
14950 /*IsKnownToGCC=*/1,
14951 /*IsSupportedByPragmaAttribute=*/0,
14952 /*Spellings=*/RetainSpellings,
14953 /*ArgNames=*/{}) {}
14954bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
14955 if (!isNonLocalVar(D) && !isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
14956 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
14957 << Attr << Attr.isRegularKeywordAttribute() << "variables with non-local storage, functions, and Objective-C methods";
14958 return false;
14959 }
14960 return true;
14961}
14962
14963bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
14964 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
14965 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
14966 return false;
14967}
14968
14969AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
14970 D->addAttr(A: ::new (S.Context) RetainAttr(S.Context, Attr));
14971 return AttributeApplied;
14972}
14973
14974bool isParamExpr(size_t N) const override {
14975 return false;
14976}
14977
14978static const ParsedAttrInfoRetain Instance;
14979};
14980const ParsedAttrInfoRetain ParsedAttrInfoRetain::Instance;
14981static constexpr ParsedAttrInfo::Spelling ReturnTypestateSpellings[] = {
14982 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "return_typestate"},
14983 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::return_typestate"},
14984};
14985static constexpr const char *ReturnTypestateArgNames[] = {
14986"State",};
14987struct ParsedAttrInfoReturnTypestate final : public ParsedAttrInfo {
14988 constexpr ParsedAttrInfoReturnTypestate() : ParsedAttrInfo(
14989 /*AttrKind=*/ParsedAttr::AT_ReturnTypestate,
14990 /*NumArgs=*/1,
14991 /*OptArgs=*/0,
14992 /*NumArgMembers=*/1,
14993 /*HasCustomParsing=*/0,
14994 /*AcceptsExprPack=*/0,
14995 /*IsTargetSpecific=*/0,
14996 /*IsType=*/0,
14997 /*IsStmt=*/0,
14998 /*IsKnownToGCC=*/0,
14999 /*IsSupportedByPragmaAttribute=*/1,
15000 /*Spellings=*/ReturnTypestateSpellings,
15001 /*ArgNames=*/ReturnTypestateArgNames) {}
15002bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15003 if (!isa<FunctionDecl>(Val: D) && !isa<ParmVarDecl>(Val: D)) {
15004 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15005 << Attr << Attr.isRegularKeywordAttribute() << "functions and parameters";
15006 return false;
15007 }
15008 return true;
15009}
15010
15011bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15012 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15013 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15014 return false;
15015}
15016
15017void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
15018 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
15019 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
15020}
15021
15022bool isParamExpr(size_t N) const override {
15023 return false;
15024}
15025
15026static const ParsedAttrInfoReturnTypestate Instance;
15027};
15028const ParsedAttrInfoReturnTypestate ParsedAttrInfoReturnTypestate::Instance;
15029static constexpr ParsedAttrInfo::Spelling ReturnsNonNullSpellings[] = {
15030 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "returns_nonnull"},
15031 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::returns_nonnull"},
15032 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::returns_nonnull"},
15033};
15034struct ParsedAttrInfoReturnsNonNull final : public ParsedAttrInfo {
15035 constexpr ParsedAttrInfoReturnsNonNull() : ParsedAttrInfo(
15036 /*AttrKind=*/ParsedAttr::AT_ReturnsNonNull,
15037 /*NumArgs=*/0,
15038 /*OptArgs=*/0,
15039 /*NumArgMembers=*/0,
15040 /*HasCustomParsing=*/0,
15041 /*AcceptsExprPack=*/0,
15042 /*IsTargetSpecific=*/0,
15043 /*IsType=*/0,
15044 /*IsStmt=*/0,
15045 /*IsKnownToGCC=*/1,
15046 /*IsSupportedByPragmaAttribute=*/1,
15047 /*Spellings=*/ReturnsNonNullSpellings,
15048 /*ArgNames=*/{}) {}
15049bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15050 if (!isa<ObjCMethodDecl>(Val: D) && !isa<FunctionDecl>(Val: D)) {
15051 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15052 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods and functions";
15053 return false;
15054 }
15055 return true;
15056}
15057
15058bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15059 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15060 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15061 return false;
15062}
15063
15064void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
15065 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
15066 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
15067}
15068
15069bool isParamExpr(size_t N) const override {
15070 return false;
15071}
15072
15073static const ParsedAttrInfoReturnsNonNull Instance;
15074};
15075const ParsedAttrInfoReturnsNonNull ParsedAttrInfoReturnsNonNull::Instance;
15076static constexpr ParsedAttrInfo::Spelling ReturnsTwiceSpellings[] = {
15077 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "returns_twice"},
15078 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::returns_twice"},
15079 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::returns_twice"},
15080};
15081struct ParsedAttrInfoReturnsTwice final : public ParsedAttrInfo {
15082 constexpr ParsedAttrInfoReturnsTwice() : ParsedAttrInfo(
15083 /*AttrKind=*/ParsedAttr::AT_ReturnsTwice,
15084 /*NumArgs=*/0,
15085 /*OptArgs=*/0,
15086 /*NumArgMembers=*/0,
15087 /*HasCustomParsing=*/0,
15088 /*AcceptsExprPack=*/0,
15089 /*IsTargetSpecific=*/0,
15090 /*IsType=*/0,
15091 /*IsStmt=*/0,
15092 /*IsKnownToGCC=*/1,
15093 /*IsSupportedByPragmaAttribute=*/1,
15094 /*Spellings=*/ReturnsTwiceSpellings,
15095 /*ArgNames=*/{}) {}
15096bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15097 if (!isa<FunctionDecl>(Val: D)) {
15098 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15099 << Attr << Attr.isRegularKeywordAttribute() << "functions";
15100 return false;
15101 }
15102 return true;
15103}
15104
15105bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15106 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15107 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15108 return false;
15109}
15110
15111void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
15112 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
15113}
15114
15115AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
15116 D->addAttr(A: ::new (S.Context) ReturnsTwiceAttr(S.Context, Attr));
15117 return AttributeApplied;
15118}
15119
15120bool isParamExpr(size_t N) const override {
15121 return false;
15122}
15123
15124static const ParsedAttrInfoReturnsTwice Instance;
15125};
15126const ParsedAttrInfoReturnsTwice ParsedAttrInfoReturnsTwice::Instance;
15127static constexpr ParsedAttrInfo::Spelling SPtrSpellings[] = {
15128 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__sptr"},
15129};
15130struct ParsedAttrInfoSPtr final : public ParsedAttrInfo {
15131 constexpr ParsedAttrInfoSPtr() : ParsedAttrInfo(
15132 /*AttrKind=*/ParsedAttr::AT_SPtr,
15133 /*NumArgs=*/0,
15134 /*OptArgs=*/0,
15135 /*NumArgMembers=*/0,
15136 /*HasCustomParsing=*/0,
15137 /*AcceptsExprPack=*/0,
15138 /*IsTargetSpecific=*/0,
15139 /*IsType=*/1,
15140 /*IsStmt=*/0,
15141 /*IsKnownToGCC=*/0,
15142 /*IsSupportedByPragmaAttribute=*/0,
15143 /*Spellings=*/SPtrSpellings,
15144 /*ArgNames=*/{}) {}
15145bool isParamExpr(size_t N) const override {
15146 return false;
15147}
15148
15149static const ParsedAttrInfoSPtr Instance;
15150};
15151const ParsedAttrInfoSPtr ParsedAttrInfoSPtr::Instance;
15152static constexpr ParsedAttrInfo::Spelling SYCLKernelSpellings[] = {
15153 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "sycl_kernel"},
15154 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::sycl_kernel"},
15155 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::sycl_kernel"},
15156};
15157struct ParsedAttrInfoSYCLKernel final : public ParsedAttrInfo {
15158 constexpr ParsedAttrInfoSYCLKernel() : ParsedAttrInfo(
15159 /*AttrKind=*/ParsedAttr::AT_SYCLKernel,
15160 /*NumArgs=*/0,
15161 /*OptArgs=*/0,
15162 /*NumArgMembers=*/0,
15163 /*HasCustomParsing=*/0,
15164 /*AcceptsExprPack=*/0,
15165 /*IsTargetSpecific=*/0,
15166 /*IsType=*/0,
15167 /*IsStmt=*/0,
15168 /*IsKnownToGCC=*/0,
15169 /*IsSupportedByPragmaAttribute=*/0,
15170 /*Spellings=*/SYCLKernelSpellings,
15171 /*ArgNames=*/{}) {}
15172bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15173 if (!isFunctionTmpl(D)) {
15174 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15175 << Attr << Attr.isRegularKeywordAttribute() << "function templates";
15176 return false;
15177 }
15178 return true;
15179}
15180
15181bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15182 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15183 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15184 return false;
15185}
15186
15187bool acceptsLangOpts(const LangOptions &LangOpts) const override {
15188 return LangOpts.SYCLIsDevice;
15189}
15190
15191bool isParamExpr(size_t N) const override {
15192 return false;
15193}
15194
15195static const ParsedAttrInfoSYCLKernel Instance;
15196};
15197const ParsedAttrInfoSYCLKernel ParsedAttrInfoSYCLKernel::Instance;
15198static constexpr ParsedAttrInfo::Spelling SYCLSpecialClassSpellings[] = {
15199 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "sycl_special_class"},
15200 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::sycl_special_class"},
15201 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::sycl_special_class"},
15202};
15203struct ParsedAttrInfoSYCLSpecialClass final : public ParsedAttrInfo {
15204 constexpr ParsedAttrInfoSYCLSpecialClass() : ParsedAttrInfo(
15205 /*AttrKind=*/ParsedAttr::AT_SYCLSpecialClass,
15206 /*NumArgs=*/0,
15207 /*OptArgs=*/0,
15208 /*NumArgMembers=*/0,
15209 /*HasCustomParsing=*/0,
15210 /*AcceptsExprPack=*/0,
15211 /*IsTargetSpecific=*/0,
15212 /*IsType=*/0,
15213 /*IsStmt=*/0,
15214 /*IsKnownToGCC=*/0,
15215 /*IsSupportedByPragmaAttribute=*/1,
15216 /*Spellings=*/SYCLSpecialClassSpellings,
15217 /*ArgNames=*/{}) {}
15218bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15219 if (!isa<CXXRecordDecl>(Val: D)) {
15220 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15221 << Attr << Attr.isRegularKeywordAttribute() << "classes";
15222 return false;
15223 }
15224 return true;
15225}
15226
15227bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15228 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15229 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15230 return false;
15231}
15232
15233bool acceptsLangOpts(const LangOptions &LangOpts) const override {
15234 return LangOpts.SYCLIsDevice;
15235}
15236
15237void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
15238 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
15239}
15240
15241bool isParamExpr(size_t N) const override {
15242 return false;
15243}
15244
15245static const ParsedAttrInfoSYCLSpecialClass Instance;
15246};
15247const ParsedAttrInfoSYCLSpecialClass ParsedAttrInfoSYCLSpecialClass::Instance;
15248static constexpr ParsedAttrInfo::Spelling ScopedLockableSpellings[] = {
15249 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "scoped_lockable"},
15250 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::scoped_lockable"},
15251};
15252struct ParsedAttrInfoScopedLockable final : public ParsedAttrInfo {
15253 constexpr ParsedAttrInfoScopedLockable() : ParsedAttrInfo(
15254 /*AttrKind=*/ParsedAttr::AT_ScopedLockable,
15255 /*NumArgs=*/0,
15256 /*OptArgs=*/0,
15257 /*NumArgMembers=*/0,
15258 /*HasCustomParsing=*/0,
15259 /*AcceptsExprPack=*/0,
15260 /*IsTargetSpecific=*/0,
15261 /*IsType=*/0,
15262 /*IsStmt=*/0,
15263 /*IsKnownToGCC=*/0,
15264 /*IsSupportedByPragmaAttribute=*/1,
15265 /*Spellings=*/ScopedLockableSpellings,
15266 /*ArgNames=*/{}) {}
15267bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15268 if (!isa<RecordDecl>(Val: D)) {
15269 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15270 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
15271 return false;
15272 }
15273 return true;
15274}
15275
15276bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15277 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15278 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15279 return false;
15280}
15281
15282void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
15283 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
15284}
15285
15286AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
15287 D->addAttr(A: ::new (S.Context) ScopedLockableAttr(S.Context, Attr));
15288 return AttributeApplied;
15289}
15290
15291bool isParamExpr(size_t N) const override {
15292 return false;
15293}
15294
15295static const ParsedAttrInfoScopedLockable Instance;
15296};
15297const ParsedAttrInfoScopedLockable ParsedAttrInfoScopedLockable::Instance;
15298static constexpr ParsedAttrInfo::Spelling SectionSpellings[] = {
15299 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "section"},
15300 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::section"},
15301 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::section"},
15302 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "allocate"},
15303};
15304static constexpr const char *SectionArgNames[] = {
15305"Name",};
15306struct ParsedAttrInfoSection final : public ParsedAttrInfo {
15307 constexpr ParsedAttrInfoSection() : ParsedAttrInfo(
15308 /*AttrKind=*/ParsedAttr::AT_Section,
15309 /*NumArgs=*/1,
15310 /*OptArgs=*/0,
15311 /*NumArgMembers=*/1,
15312 /*HasCustomParsing=*/0,
15313 /*AcceptsExprPack=*/0,
15314 /*IsTargetSpecific=*/0,
15315 /*IsType=*/0,
15316 /*IsStmt=*/0,
15317 /*IsKnownToGCC=*/1,
15318 /*IsSupportedByPragmaAttribute=*/1,
15319 /*Spellings=*/SectionSpellings,
15320 /*ArgNames=*/SectionArgNames) {}
15321bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15322 if (!isa<FunctionDecl>(Val: D) && !isGlobalVar(D) && !isa<ObjCMethodDecl>(Val: D) && !isa<ObjCPropertyDecl>(Val: D)) {
15323 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
15324 << Attr << Attr.isRegularKeywordAttribute() << "functions, global variables, Objective-C methods, and Objective-C properties";
15325 return false;
15326 }
15327 return true;
15328}
15329
15330bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15331 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15332 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15333 return false;
15334}
15335
15336unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
15337 enum Spelling {
15338 GNU_section = 0,
15339 CXX11_gnu_section = 1,
15340 C23_gnu_section = 2,
15341 Declspec_allocate = 3,
15342 SpellingNotCalculated = 15
15343
15344 };
15345
15346 unsigned Idx = Attr.getAttributeSpellingListIndex();
15347 switch (Idx) {
15348 default: llvm_unreachable("Unknown spelling list index");
15349 case 0: return GNU_section;
15350 case 1: return CXX11_gnu_section;
15351 case 2: return C23_gnu_section;
15352 case 3: return Declspec_allocate;
15353 }
15354}
15355
15356void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
15357 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
15358 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_global, /*IsSupported=*/y: true));
15359 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
15360 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_property, /*IsSupported=*/y: LangOpts.ObjC));
15361}
15362
15363bool isParamExpr(size_t N) const override {
15364 return false;
15365}
15366
15367static const ParsedAttrInfoSection Instance;
15368};
15369const ParsedAttrInfoSection ParsedAttrInfoSection::Instance;
15370static constexpr ParsedAttrInfo::Spelling SelectAnySpellings[] = {
15371 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "selectany"},
15372 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "selectany"},
15373 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::selectany"},
15374 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::selectany"},
15375};
15376struct ParsedAttrInfoSelectAny final : public ParsedAttrInfo {
15377 constexpr ParsedAttrInfoSelectAny() : ParsedAttrInfo(
15378 /*AttrKind=*/ParsedAttr::AT_SelectAny,
15379 /*NumArgs=*/0,
15380 /*OptArgs=*/0,
15381 /*NumArgMembers=*/0,
15382 /*HasCustomParsing=*/0,
15383 /*AcceptsExprPack=*/0,
15384 /*IsTargetSpecific=*/0,
15385 /*IsType=*/0,
15386 /*IsStmt=*/0,
15387 /*IsKnownToGCC=*/1,
15388 /*IsSupportedByPragmaAttribute=*/0,
15389 /*Spellings=*/SelectAnySpellings,
15390 /*ArgNames=*/{}) {}
15391AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
15392 D->addAttr(A: ::new (S.Context) SelectAnyAttr(S.Context, Attr));
15393 return AttributeApplied;
15394}
15395
15396bool isParamExpr(size_t N) const override {
15397 return false;
15398}
15399
15400static const ParsedAttrInfoSelectAny Instance;
15401};
15402const ParsedAttrInfoSelectAny ParsedAttrInfoSelectAny::Instance;
15403static constexpr ParsedAttrInfo::Spelling SentinelSpellings[] = {
15404 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "sentinel"},
15405 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::sentinel"},
15406 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::sentinel"},
15407};
15408static constexpr const char *SentinelArgNames[] = {
15409"Sentinel","NullPos",};
15410struct ParsedAttrInfoSentinel final : public ParsedAttrInfo {
15411 constexpr ParsedAttrInfoSentinel() : ParsedAttrInfo(
15412 /*AttrKind=*/ParsedAttr::AT_Sentinel,
15413 /*NumArgs=*/0,
15414 /*OptArgs=*/2,
15415 /*NumArgMembers=*/2,
15416 /*HasCustomParsing=*/0,
15417 /*AcceptsExprPack=*/0,
15418 /*IsTargetSpecific=*/0,
15419 /*IsType=*/0,
15420 /*IsStmt=*/0,
15421 /*IsKnownToGCC=*/1,
15422 /*IsSupportedByPragmaAttribute=*/0,
15423 /*Spellings=*/SentinelSpellings,
15424 /*ArgNames=*/SentinelArgNames) {}
15425bool isParamExpr(size_t N) const override {
15426 return false;
15427}
15428
15429static const ParsedAttrInfoSentinel Instance;
15430};
15431const ParsedAttrInfoSentinel ParsedAttrInfoSentinel::Instance;
15432static constexpr ParsedAttrInfo::Spelling SetTypestateSpellings[] = {
15433 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "set_typestate"},
15434 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::set_typestate"},
15435};
15436static constexpr const char *SetTypestateArgNames[] = {
15437"NewState",};
15438struct ParsedAttrInfoSetTypestate final : public ParsedAttrInfo {
15439 constexpr ParsedAttrInfoSetTypestate() : ParsedAttrInfo(
15440 /*AttrKind=*/ParsedAttr::AT_SetTypestate,
15441 /*NumArgs=*/1,
15442 /*OptArgs=*/0,
15443 /*NumArgMembers=*/1,
15444 /*HasCustomParsing=*/0,
15445 /*AcceptsExprPack=*/0,
15446 /*IsTargetSpecific=*/0,
15447 /*IsType=*/0,
15448 /*IsStmt=*/0,
15449 /*IsKnownToGCC=*/0,
15450 /*IsSupportedByPragmaAttribute=*/1,
15451 /*Spellings=*/SetTypestateSpellings,
15452 /*ArgNames=*/SetTypestateArgNames) {}
15453bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15454 if (!isa<CXXMethodDecl>(Val: D)) {
15455 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15456 << Attr << Attr.isRegularKeywordAttribute() << "functions";
15457 return false;
15458 }
15459 return true;
15460}
15461
15462bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15463 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15464 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15465 return false;
15466}
15467
15468void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
15469 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function_is_member, /*IsSupported=*/y: LangOpts.CPlusPlus));
15470}
15471
15472bool isParamExpr(size_t N) const override {
15473 return false;
15474}
15475
15476static const ParsedAttrInfoSetTypestate Instance;
15477};
15478const ParsedAttrInfoSetTypestate ParsedAttrInfoSetTypestate::Instance;
15479static constexpr ParsedAttrInfo::Spelling SharedTrylockFunctionSpellings[] = {
15480 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "shared_trylock_function"},
15481};
15482static constexpr const char *SharedTrylockFunctionArgNames[] = {
15483"SuccessValue","Args...",};
15484struct ParsedAttrInfoSharedTrylockFunction final : public ParsedAttrInfo {
15485 constexpr ParsedAttrInfoSharedTrylockFunction() : ParsedAttrInfo(
15486 /*AttrKind=*/ParsedAttr::AT_SharedTrylockFunction,
15487 /*NumArgs=*/1,
15488 /*OptArgs=*/15,
15489 /*NumArgMembers=*/2,
15490 /*HasCustomParsing=*/0,
15491 /*AcceptsExprPack=*/0,
15492 /*IsTargetSpecific=*/0,
15493 /*IsType=*/0,
15494 /*IsStmt=*/0,
15495 /*IsKnownToGCC=*/0,
15496 /*IsSupportedByPragmaAttribute=*/0,
15497 /*Spellings=*/SharedTrylockFunctionSpellings,
15498 /*ArgNames=*/SharedTrylockFunctionArgNames) {}
15499bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15500 if (!isa<FunctionDecl>(Val: D)) {
15501 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15502 << Attr << Attr.isRegularKeywordAttribute() << "functions";
15503 return false;
15504 }
15505 return true;
15506}
15507
15508bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15509 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15510 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15511 return false;
15512}
15513
15514bool isParamExpr(size_t N) const override {
15515 return (N == 0) || (N == 1) || false;
15516}
15517
15518static const ParsedAttrInfoSharedTrylockFunction Instance;
15519};
15520const ParsedAttrInfoSharedTrylockFunction ParsedAttrInfoSharedTrylockFunction::Instance;
15521static constexpr ParsedAttrInfo::Spelling SizedBySpellings[] = {
15522 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "sized_by"},
15523 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::sized_by"},
15524 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::sized_by"},
15525};
15526static constexpr const char *SizedByArgNames[] = {
15527"Size","NestedLevel",};
15528struct ParsedAttrInfoSizedBy final : public ParsedAttrInfo {
15529 constexpr ParsedAttrInfoSizedBy() : ParsedAttrInfo(
15530 /*AttrKind=*/ParsedAttr::AT_SizedBy,
15531 /*NumArgs=*/1,
15532 /*OptArgs=*/1,
15533 /*NumArgMembers=*/2,
15534 /*HasCustomParsing=*/0,
15535 /*AcceptsExprPack=*/0,
15536 /*IsTargetSpecific=*/0,
15537 /*IsType=*/1,
15538 /*IsStmt=*/0,
15539 /*IsKnownToGCC=*/0,
15540 /*IsSupportedByPragmaAttribute=*/0,
15541 /*Spellings=*/SizedBySpellings,
15542 /*ArgNames=*/SizedByArgNames) {}
15543bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15544 if (!isa<FieldDecl>(Val: D)) {
15545 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
15546 << Attr << Attr.isRegularKeywordAttribute() << "non-static data members";
15547 return false;
15548 }
15549 return true;
15550}
15551
15552bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15553 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15554 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15555 return false;
15556}
15557
15558bool acceptsLangOpts(const LangOptions &LangOpts) const override {
15559 return (!LangOpts.CPlusPlus);
15560}
15561
15562bool isParamExpr(size_t N) const override {
15563 return (N == 0) || false;
15564}
15565
15566static const ParsedAttrInfoSizedBy Instance;
15567};
15568const ParsedAttrInfoSizedBy ParsedAttrInfoSizedBy::Instance;
15569static constexpr ParsedAttrInfo::Spelling SizedByOrNullSpellings[] = {
15570 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "sized_by_or_null"},
15571 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::sized_by_or_null"},
15572 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::sized_by_or_null"},
15573};
15574static constexpr const char *SizedByOrNullArgNames[] = {
15575"Size","NestedLevel",};
15576struct ParsedAttrInfoSizedByOrNull final : public ParsedAttrInfo {
15577 constexpr ParsedAttrInfoSizedByOrNull() : ParsedAttrInfo(
15578 /*AttrKind=*/ParsedAttr::AT_SizedByOrNull,
15579 /*NumArgs=*/1,
15580 /*OptArgs=*/1,
15581 /*NumArgMembers=*/2,
15582 /*HasCustomParsing=*/0,
15583 /*AcceptsExprPack=*/0,
15584 /*IsTargetSpecific=*/0,
15585 /*IsType=*/1,
15586 /*IsStmt=*/0,
15587 /*IsKnownToGCC=*/0,
15588 /*IsSupportedByPragmaAttribute=*/0,
15589 /*Spellings=*/SizedByOrNullSpellings,
15590 /*ArgNames=*/SizedByOrNullArgNames) {}
15591bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15592 if (!isa<FieldDecl>(Val: D)) {
15593 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
15594 << Attr << Attr.isRegularKeywordAttribute() << "non-static data members";
15595 return false;
15596 }
15597 return true;
15598}
15599
15600bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15601 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15602 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15603 return false;
15604}
15605
15606bool acceptsLangOpts(const LangOptions &LangOpts) const override {
15607 return (!LangOpts.CPlusPlus);
15608}
15609
15610bool isParamExpr(size_t N) const override {
15611 return (N == 0) || false;
15612}
15613
15614static const ParsedAttrInfoSizedByOrNull Instance;
15615};
15616const ParsedAttrInfoSizedByOrNull ParsedAttrInfoSizedByOrNull::Instance;
15617static constexpr ParsedAttrInfo::Spelling SpeculativeLoadHardeningSpellings[] = {
15618 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "speculative_load_hardening"},
15619 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::speculative_load_hardening"},
15620 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::speculative_load_hardening"},
15621};
15622struct ParsedAttrInfoSpeculativeLoadHardening final : public ParsedAttrInfo {
15623 constexpr ParsedAttrInfoSpeculativeLoadHardening() : ParsedAttrInfo(
15624 /*AttrKind=*/ParsedAttr::AT_SpeculativeLoadHardening,
15625 /*NumArgs=*/0,
15626 /*OptArgs=*/0,
15627 /*NumArgMembers=*/0,
15628 /*HasCustomParsing=*/0,
15629 /*AcceptsExprPack=*/0,
15630 /*IsTargetSpecific=*/0,
15631 /*IsType=*/0,
15632 /*IsStmt=*/0,
15633 /*IsKnownToGCC=*/0,
15634 /*IsSupportedByPragmaAttribute=*/1,
15635 /*Spellings=*/SpeculativeLoadHardeningSpellings,
15636 /*ArgNames=*/{}) {}
15637bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15638 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
15639 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
15640 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
15641 return false;
15642 }
15643 return true;
15644}
15645
15646bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15647 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15648 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15649 return false;
15650}
15651
15652 using ParsedAttrInfo::diagMutualExclusion;
15653
15654 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
15655 if (const auto *A = D->getAttr<NoSpeculativeLoadHardeningAttr>()) {
15656 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
15657 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
15658return false;
15659 }
15660 return true;
15661 }
15662
15663void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
15664 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
15665 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
15666}
15667
15668AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
15669 D->addAttr(A: ::new (S.Context) SpeculativeLoadHardeningAttr(S.Context, Attr));
15670 return AttributeApplied;
15671}
15672
15673bool isParamExpr(size_t N) const override {
15674 return false;
15675}
15676
15677static const ParsedAttrInfoSpeculativeLoadHardening Instance;
15678};
15679const ParsedAttrInfoSpeculativeLoadHardening ParsedAttrInfoSpeculativeLoadHardening::Instance;
15680static constexpr ParsedAttrInfo::Spelling StandaloneDebugSpellings[] = {
15681 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "standalone_debug"},
15682 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::standalone_debug"},
15683};
15684struct ParsedAttrInfoStandaloneDebug final : public ParsedAttrInfo {
15685 constexpr ParsedAttrInfoStandaloneDebug() : ParsedAttrInfo(
15686 /*AttrKind=*/ParsedAttr::AT_StandaloneDebug,
15687 /*NumArgs=*/0,
15688 /*OptArgs=*/0,
15689 /*NumArgMembers=*/0,
15690 /*HasCustomParsing=*/0,
15691 /*AcceptsExprPack=*/0,
15692 /*IsTargetSpecific=*/0,
15693 /*IsType=*/0,
15694 /*IsStmt=*/0,
15695 /*IsKnownToGCC=*/0,
15696 /*IsSupportedByPragmaAttribute=*/1,
15697 /*Spellings=*/StandaloneDebugSpellings,
15698 /*ArgNames=*/{}) {}
15699bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15700 if (!isa<CXXRecordDecl>(Val: D)) {
15701 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15702 << Attr << Attr.isRegularKeywordAttribute() << "classes";
15703 return false;
15704 }
15705 return true;
15706}
15707
15708bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15709 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15710 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15711 return false;
15712}
15713
15714bool acceptsLangOpts(const LangOptions &LangOpts) const override {
15715 return LangOpts.CPlusPlus;
15716}
15717
15718void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
15719 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
15720}
15721
15722AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
15723 D->addAttr(A: ::new (S.Context) StandaloneDebugAttr(S.Context, Attr));
15724 return AttributeApplied;
15725}
15726
15727bool isParamExpr(size_t N) const override {
15728 return false;
15729}
15730
15731static const ParsedAttrInfoStandaloneDebug Instance;
15732};
15733const ParsedAttrInfoStandaloneDebug ParsedAttrInfoStandaloneDebug::Instance;
15734static constexpr ParsedAttrInfo::Spelling StdCallSpellings[] = {
15735 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "stdcall"},
15736 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::stdcall"},
15737 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::stdcall"},
15738 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__stdcall"},
15739 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_stdcall"},
15740};
15741struct ParsedAttrInfoStdCall final : public ParsedAttrInfo {
15742 constexpr ParsedAttrInfoStdCall() : ParsedAttrInfo(
15743 /*AttrKind=*/ParsedAttr::AT_StdCall,
15744 /*NumArgs=*/0,
15745 /*OptArgs=*/0,
15746 /*NumArgMembers=*/0,
15747 /*HasCustomParsing=*/0,
15748 /*AcceptsExprPack=*/0,
15749 /*IsTargetSpecific=*/0,
15750 /*IsType=*/1,
15751 /*IsStmt=*/0,
15752 /*IsKnownToGCC=*/1,
15753 /*IsSupportedByPragmaAttribute=*/0,
15754 /*Spellings=*/StdCallSpellings,
15755 /*ArgNames=*/{}) {}
15756bool isParamExpr(size_t N) const override {
15757 return false;
15758}
15759
15760static const ParsedAttrInfoStdCall Instance;
15761};
15762const ParsedAttrInfoStdCall ParsedAttrInfoStdCall::Instance;
15763struct ParsedAttrInfoStrictFP final : public ParsedAttrInfo {
15764 constexpr ParsedAttrInfoStrictFP() : ParsedAttrInfo(
15765 /*AttrKind=*/ParsedAttr::AT_StrictFP,
15766 /*NumArgs=*/0,
15767 /*OptArgs=*/0,
15768 /*NumArgMembers=*/0,
15769 /*HasCustomParsing=*/0,
15770 /*AcceptsExprPack=*/0,
15771 /*IsTargetSpecific=*/0,
15772 /*IsType=*/0,
15773 /*IsStmt=*/0,
15774 /*IsKnownToGCC=*/0,
15775 /*IsSupportedByPragmaAttribute=*/0,
15776 /*Spellings=*/{},
15777 /*ArgNames=*/{}) {}
15778bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15779 if (!isa<FunctionDecl>(Val: D)) {
15780 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15781 << Attr << Attr.isRegularKeywordAttribute() << "functions";
15782 return false;
15783 }
15784 return true;
15785}
15786
15787bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15788 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15789 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15790 return false;
15791}
15792
15793bool isParamExpr(size_t N) const override {
15794 return false;
15795}
15796
15797static const ParsedAttrInfoStrictFP Instance;
15798};
15799const ParsedAttrInfoStrictFP ParsedAttrInfoStrictFP::Instance;
15800static constexpr ParsedAttrInfo::Spelling StrictGuardStackCheckSpellings[] = {
15801 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "strict_gs_check"},
15802};
15803struct ParsedAttrInfoStrictGuardStackCheck final : public ParsedAttrInfo {
15804 constexpr ParsedAttrInfoStrictGuardStackCheck() : ParsedAttrInfo(
15805 /*AttrKind=*/ParsedAttr::AT_StrictGuardStackCheck,
15806 /*NumArgs=*/0,
15807 /*OptArgs=*/0,
15808 /*NumArgMembers=*/0,
15809 /*HasCustomParsing=*/0,
15810 /*AcceptsExprPack=*/0,
15811 /*IsTargetSpecific=*/0,
15812 /*IsType=*/0,
15813 /*IsStmt=*/0,
15814 /*IsKnownToGCC=*/0,
15815 /*IsSupportedByPragmaAttribute=*/0,
15816 /*Spellings=*/StrictGuardStackCheckSpellings,
15817 /*ArgNames=*/{}) {}
15818bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15819 if (!isa<FunctionDecl>(Val: D)) {
15820 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15821 << Attr << Attr.isRegularKeywordAttribute() << "functions";
15822 return false;
15823 }
15824 return true;
15825}
15826
15827bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15828 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15829 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15830 return false;
15831}
15832
15833AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
15834 D->addAttr(A: ::new (S.Context) StrictGuardStackCheckAttr(S.Context, Attr));
15835 return AttributeApplied;
15836}
15837
15838bool isParamExpr(size_t N) const override {
15839 return false;
15840}
15841
15842static const ParsedAttrInfoStrictGuardStackCheck Instance;
15843};
15844const ParsedAttrInfoStrictGuardStackCheck ParsedAttrInfoStrictGuardStackCheck::Instance;
15845static constexpr ParsedAttrInfo::Spelling SuppressSpellings[] = {
15846 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gsl::suppress"},
15847 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "suppress"},
15848 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::suppress"},
15849 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::suppress"},
15850};
15851static constexpr const char *SuppressArgNames[] = {
15852"DiagnosticIdentifiers...",};
15853struct ParsedAttrInfoSuppress final : public ParsedAttrInfo {
15854 constexpr ParsedAttrInfoSuppress() : ParsedAttrInfo(
15855 /*AttrKind=*/ParsedAttr::AT_Suppress,
15856 /*NumArgs=*/0,
15857 /*OptArgs=*/15,
15858 /*NumArgMembers=*/1,
15859 /*HasCustomParsing=*/0,
15860 /*AcceptsExprPack=*/0,
15861 /*IsTargetSpecific=*/0,
15862 /*IsType=*/0,
15863 /*IsStmt=*/1,
15864 /*IsKnownToGCC=*/0,
15865 /*IsSupportedByPragmaAttribute=*/0,
15866 /*Spellings=*/SuppressSpellings,
15867 /*ArgNames=*/SuppressArgNames) {}
15868bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15869 if (!isa<VarDecl>(Val: D) && !isa<FieldDecl>(Val: D) && !isa<ObjCPropertyDecl>(Val: D) && !isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D) && !isa<RecordDecl>(Val: D) && !isa<ObjCInterfaceDecl>(Val: D) && !isa<ObjCImplementationDecl>(Val: D) && !isa<NamespaceDecl>(Val: D) && !isa<EmptyDecl>(Val: D)) {
15870 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
15871 << Attr << Attr.isRegularKeywordAttribute() << "variables, functions, structs, interfaces, and namespaces";
15872 return false;
15873 }
15874 return true;
15875}
15876
15877bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const override {
15878 if (!isa<Stmt>(Val: St)) {
15879 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
15880 << Attr << Attr.isRegularKeywordAttribute() << "variables, functions, structs, interfaces, and namespaces";
15881 return false;
15882 }
15883 return true;
15884}
15885
15886bool isParamExpr(size_t N) const override {
15887 return false;
15888}
15889
15890static const ParsedAttrInfoSuppress Instance;
15891};
15892const ParsedAttrInfoSuppress ParsedAttrInfoSuppress::Instance;
15893static constexpr ParsedAttrInfo::Spelling SwiftAsyncSpellings[] = {
15894 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_async"},
15895 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::swift_async"},
15896 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::swift_async"},
15897};
15898static constexpr const char *SwiftAsyncArgNames[] = {
15899"Kind","CompletionHandlerIndex",};
15900struct ParsedAttrInfoSwiftAsync final : public ParsedAttrInfo {
15901 constexpr ParsedAttrInfoSwiftAsync() : ParsedAttrInfo(
15902 /*AttrKind=*/ParsedAttr::AT_SwiftAsync,
15903 /*NumArgs=*/1,
15904 /*OptArgs=*/1,
15905 /*NumArgMembers=*/2,
15906 /*HasCustomParsing=*/0,
15907 /*AcceptsExprPack=*/0,
15908 /*IsTargetSpecific=*/0,
15909 /*IsType=*/0,
15910 /*IsStmt=*/0,
15911 /*IsKnownToGCC=*/0,
15912 /*IsSupportedByPragmaAttribute=*/1,
15913 /*Spellings=*/SwiftAsyncSpellings,
15914 /*ArgNames=*/SwiftAsyncArgNames) {}
15915bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15916 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
15917 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15918 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
15919 return false;
15920 }
15921 return true;
15922}
15923
15924bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15925 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
15926 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
15927 return false;
15928}
15929
15930void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
15931 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
15932 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
15933}
15934
15935bool isParamExpr(size_t N) const override {
15936 return false;
15937}
15938
15939static const ParsedAttrInfoSwiftAsync Instance;
15940};
15941const ParsedAttrInfoSwiftAsync ParsedAttrInfoSwiftAsync::Instance;
15942static constexpr ParsedAttrInfo::Spelling SwiftAsyncCallSpellings[] = {
15943 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swiftasynccall"},
15944 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::swiftasynccall"},
15945 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::swiftasynccall"},
15946};
15947struct ParsedAttrInfoSwiftAsyncCall final : public ParsedAttrInfo {
15948 constexpr ParsedAttrInfoSwiftAsyncCall() : ParsedAttrInfo(
15949 /*AttrKind=*/ParsedAttr::AT_SwiftAsyncCall,
15950 /*NumArgs=*/0,
15951 /*OptArgs=*/0,
15952 /*NumArgMembers=*/0,
15953 /*HasCustomParsing=*/0,
15954 /*AcceptsExprPack=*/0,
15955 /*IsTargetSpecific=*/0,
15956 /*IsType=*/1,
15957 /*IsStmt=*/0,
15958 /*IsKnownToGCC=*/0,
15959 /*IsSupportedByPragmaAttribute=*/0,
15960 /*Spellings=*/SwiftAsyncCallSpellings,
15961 /*ArgNames=*/{}) {}
15962bool isParamExpr(size_t N) const override {
15963 return false;
15964}
15965
15966static const ParsedAttrInfoSwiftAsyncCall Instance;
15967};
15968const ParsedAttrInfoSwiftAsyncCall ParsedAttrInfoSwiftAsyncCall::Instance;
15969static constexpr ParsedAttrInfo::Spelling SwiftAsyncContextSpellings[] = {
15970 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_async_context"},
15971 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::swift_async_context"},
15972 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::swift_async_context"},
15973};
15974struct ParsedAttrInfoSwiftAsyncContext final : public ParsedAttrInfo {
15975 constexpr ParsedAttrInfoSwiftAsyncContext() : ParsedAttrInfo(
15976 /*AttrKind=*/ParsedAttr::AT_SwiftAsyncContext,
15977 /*NumArgs=*/0,
15978 /*OptArgs=*/0,
15979 /*NumArgMembers=*/0,
15980 /*HasCustomParsing=*/0,
15981 /*AcceptsExprPack=*/0,
15982 /*IsTargetSpecific=*/0,
15983 /*IsType=*/0,
15984 /*IsStmt=*/0,
15985 /*IsKnownToGCC=*/0,
15986 /*IsSupportedByPragmaAttribute=*/1,
15987 /*Spellings=*/SwiftAsyncContextSpellings,
15988 /*ArgNames=*/{}) {}
15989bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
15990 if (!isa<ParmVarDecl>(Val: D)) {
15991 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
15992 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
15993 return false;
15994 }
15995 return true;
15996}
15997
15998bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
15999 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16000 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16001 return false;
16002}
16003
16004void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16005 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
16006}
16007
16008bool isParamExpr(size_t N) const override {
16009 return false;
16010}
16011
16012static const ParsedAttrInfoSwiftAsyncContext Instance;
16013};
16014const ParsedAttrInfoSwiftAsyncContext ParsedAttrInfoSwiftAsyncContext::Instance;
16015static constexpr ParsedAttrInfo::Spelling SwiftAsyncErrorSpellings[] = {
16016 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_async_error"},
16017 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::swift_async_error"},
16018 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::swift_async_error"},
16019};
16020static constexpr const char *SwiftAsyncErrorArgNames[] = {
16021"Convention","HandlerParamIdx",};
16022struct ParsedAttrInfoSwiftAsyncError final : public ParsedAttrInfo {
16023 constexpr ParsedAttrInfoSwiftAsyncError() : ParsedAttrInfo(
16024 /*AttrKind=*/ParsedAttr::AT_SwiftAsyncError,
16025 /*NumArgs=*/1,
16026 /*OptArgs=*/1,
16027 /*NumArgMembers=*/2,
16028 /*HasCustomParsing=*/0,
16029 /*AcceptsExprPack=*/0,
16030 /*IsTargetSpecific=*/0,
16031 /*IsType=*/0,
16032 /*IsStmt=*/0,
16033 /*IsKnownToGCC=*/0,
16034 /*IsSupportedByPragmaAttribute=*/1,
16035 /*Spellings=*/SwiftAsyncErrorSpellings,
16036 /*ArgNames=*/SwiftAsyncErrorArgNames) {}
16037bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16038 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
16039 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
16040 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
16041 return false;
16042 }
16043 return true;
16044}
16045
16046bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16047 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16048 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16049 return false;
16050}
16051
16052void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16053 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
16054 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
16055}
16056
16057bool isParamExpr(size_t N) const override {
16058 return false;
16059}
16060
16061static const ParsedAttrInfoSwiftAsyncError Instance;
16062};
16063const ParsedAttrInfoSwiftAsyncError ParsedAttrInfoSwiftAsyncError::Instance;
16064static constexpr ParsedAttrInfo::Spelling SwiftAsyncNameSpellings[] = {
16065 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_async_name"},
16066};
16067static constexpr const char *SwiftAsyncNameArgNames[] = {
16068"Name",};
16069struct ParsedAttrInfoSwiftAsyncName final : public ParsedAttrInfo {
16070 constexpr ParsedAttrInfoSwiftAsyncName() : ParsedAttrInfo(
16071 /*AttrKind=*/ParsedAttr::AT_SwiftAsyncName,
16072 /*NumArgs=*/1,
16073 /*OptArgs=*/0,
16074 /*NumArgMembers=*/1,
16075 /*HasCustomParsing=*/0,
16076 /*AcceptsExprPack=*/0,
16077 /*IsTargetSpecific=*/0,
16078 /*IsType=*/0,
16079 /*IsStmt=*/0,
16080 /*IsKnownToGCC=*/0,
16081 /*IsSupportedByPragmaAttribute=*/1,
16082 /*Spellings=*/SwiftAsyncNameSpellings,
16083 /*ArgNames=*/SwiftAsyncNameArgNames) {}
16084bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16085 if (!isa<ObjCMethodDecl>(Val: D) && !isa<FunctionDecl>(Val: D)) {
16086 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
16087 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods and functions";
16088 return false;
16089 }
16090 return true;
16091}
16092
16093bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16094 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16095 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16096 return false;
16097}
16098
16099void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16100 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
16101 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
16102}
16103
16104bool isParamExpr(size_t N) const override {
16105 return false;
16106}
16107
16108static const ParsedAttrInfoSwiftAsyncName Instance;
16109};
16110const ParsedAttrInfoSwiftAsyncName ParsedAttrInfoSwiftAsyncName::Instance;
16111static constexpr ParsedAttrInfo::Spelling SwiftAttrSpellings[] = {
16112 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_attr"},
16113};
16114static constexpr const char *SwiftAttrArgNames[] = {
16115"Attribute",};
16116struct ParsedAttrInfoSwiftAttr final : public ParsedAttrInfo {
16117 constexpr ParsedAttrInfoSwiftAttr() : ParsedAttrInfo(
16118 /*AttrKind=*/ParsedAttr::AT_SwiftAttr,
16119 /*NumArgs=*/1,
16120 /*OptArgs=*/0,
16121 /*NumArgMembers=*/1,
16122 /*HasCustomParsing=*/0,
16123 /*AcceptsExprPack=*/0,
16124 /*IsTargetSpecific=*/0,
16125 /*IsType=*/0,
16126 /*IsStmt=*/0,
16127 /*IsKnownToGCC=*/0,
16128 /*IsSupportedByPragmaAttribute=*/1,
16129 /*Spellings=*/SwiftAttrSpellings,
16130 /*ArgNames=*/SwiftAttrArgNames) {}
16131bool isParamExpr(size_t N) const override {
16132 return false;
16133}
16134
16135static const ParsedAttrInfoSwiftAttr Instance;
16136};
16137const ParsedAttrInfoSwiftAttr ParsedAttrInfoSwiftAttr::Instance;
16138static constexpr ParsedAttrInfo::Spelling SwiftBridgeSpellings[] = {
16139 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_bridge"},
16140};
16141static constexpr const char *SwiftBridgeArgNames[] = {
16142"SwiftType",};
16143struct ParsedAttrInfoSwiftBridge final : public ParsedAttrInfo {
16144 constexpr ParsedAttrInfoSwiftBridge() : ParsedAttrInfo(
16145 /*AttrKind=*/ParsedAttr::AT_SwiftBridge,
16146 /*NumArgs=*/1,
16147 /*OptArgs=*/0,
16148 /*NumArgMembers=*/1,
16149 /*HasCustomParsing=*/0,
16150 /*AcceptsExprPack=*/0,
16151 /*IsTargetSpecific=*/0,
16152 /*IsType=*/0,
16153 /*IsStmt=*/0,
16154 /*IsKnownToGCC=*/0,
16155 /*IsSupportedByPragmaAttribute=*/0,
16156 /*Spellings=*/SwiftBridgeSpellings,
16157 /*ArgNames=*/SwiftBridgeArgNames) {}
16158bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16159 if (!isa<TagDecl>(Val: D) && !isa<TypedefNameDecl>(Val: D) && !isa<ObjCInterfaceDecl>(Val: D) && !isa<ObjCProtocolDecl>(Val: D)) {
16160 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
16161 << Attr << Attr.isRegularKeywordAttribute() << "tag types, typedefs, Objective-C interfaces, and Objective-C protocols";
16162 return false;
16163 }
16164 return true;
16165}
16166
16167bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16168 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16169 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16170 return false;
16171}
16172
16173bool isParamExpr(size_t N) const override {
16174 return false;
16175}
16176
16177static const ParsedAttrInfoSwiftBridge Instance;
16178};
16179const ParsedAttrInfoSwiftBridge ParsedAttrInfoSwiftBridge::Instance;
16180static constexpr ParsedAttrInfo::Spelling SwiftBridgedTypedefSpellings[] = {
16181 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_bridged_typedef"},
16182};
16183struct ParsedAttrInfoSwiftBridgedTypedef final : public ParsedAttrInfo {
16184 constexpr ParsedAttrInfoSwiftBridgedTypedef() : ParsedAttrInfo(
16185 /*AttrKind=*/ParsedAttr::AT_SwiftBridgedTypedef,
16186 /*NumArgs=*/0,
16187 /*OptArgs=*/0,
16188 /*NumArgMembers=*/0,
16189 /*HasCustomParsing=*/0,
16190 /*AcceptsExprPack=*/0,
16191 /*IsTargetSpecific=*/0,
16192 /*IsType=*/0,
16193 /*IsStmt=*/0,
16194 /*IsKnownToGCC=*/0,
16195 /*IsSupportedByPragmaAttribute=*/1,
16196 /*Spellings=*/SwiftBridgedTypedefSpellings,
16197 /*ArgNames=*/{}) {}
16198bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16199 if (!isa<TypedefNameDecl>(Val: D)) {
16200 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
16201 << Attr << Attr.isRegularKeywordAttribute() << "typedefs";
16202 return false;
16203 }
16204 return true;
16205}
16206
16207bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16208 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16209 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16210 return false;
16211}
16212
16213void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16214 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
16215}
16216
16217AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
16218 D->addAttr(A: ::new (S.Context) SwiftBridgedTypedefAttr(S.Context, Attr));
16219 return AttributeApplied;
16220}
16221
16222bool isParamExpr(size_t N) const override {
16223 return false;
16224}
16225
16226static const ParsedAttrInfoSwiftBridgedTypedef Instance;
16227};
16228const ParsedAttrInfoSwiftBridgedTypedef ParsedAttrInfoSwiftBridgedTypedef::Instance;
16229static constexpr ParsedAttrInfo::Spelling SwiftCallSpellings[] = {
16230 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swiftcall"},
16231 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::swiftcall"},
16232 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::swiftcall"},
16233};
16234struct ParsedAttrInfoSwiftCall final : public ParsedAttrInfo {
16235 constexpr ParsedAttrInfoSwiftCall() : ParsedAttrInfo(
16236 /*AttrKind=*/ParsedAttr::AT_SwiftCall,
16237 /*NumArgs=*/0,
16238 /*OptArgs=*/0,
16239 /*NumArgMembers=*/0,
16240 /*HasCustomParsing=*/0,
16241 /*AcceptsExprPack=*/0,
16242 /*IsTargetSpecific=*/0,
16243 /*IsType=*/1,
16244 /*IsStmt=*/0,
16245 /*IsKnownToGCC=*/0,
16246 /*IsSupportedByPragmaAttribute=*/0,
16247 /*Spellings=*/SwiftCallSpellings,
16248 /*ArgNames=*/{}) {}
16249bool isParamExpr(size_t N) const override {
16250 return false;
16251}
16252
16253static const ParsedAttrInfoSwiftCall Instance;
16254};
16255const ParsedAttrInfoSwiftCall ParsedAttrInfoSwiftCall::Instance;
16256static constexpr ParsedAttrInfo::Spelling SwiftContextSpellings[] = {
16257 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_context"},
16258 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::swift_context"},
16259 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::swift_context"},
16260};
16261struct ParsedAttrInfoSwiftContext final : public ParsedAttrInfo {
16262 constexpr ParsedAttrInfoSwiftContext() : ParsedAttrInfo(
16263 /*AttrKind=*/ParsedAttr::AT_SwiftContext,
16264 /*NumArgs=*/0,
16265 /*OptArgs=*/0,
16266 /*NumArgMembers=*/0,
16267 /*HasCustomParsing=*/0,
16268 /*AcceptsExprPack=*/0,
16269 /*IsTargetSpecific=*/0,
16270 /*IsType=*/0,
16271 /*IsStmt=*/0,
16272 /*IsKnownToGCC=*/0,
16273 /*IsSupportedByPragmaAttribute=*/1,
16274 /*Spellings=*/SwiftContextSpellings,
16275 /*ArgNames=*/{}) {}
16276bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16277 if (!isa<ParmVarDecl>(Val: D)) {
16278 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
16279 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
16280 return false;
16281 }
16282 return true;
16283}
16284
16285bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16286 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16287 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16288 return false;
16289}
16290
16291void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16292 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
16293}
16294
16295bool isParamExpr(size_t N) const override {
16296 return false;
16297}
16298
16299static const ParsedAttrInfoSwiftContext Instance;
16300};
16301const ParsedAttrInfoSwiftContext ParsedAttrInfoSwiftContext::Instance;
16302static constexpr ParsedAttrInfo::Spelling SwiftErrorSpellings[] = {
16303 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_error"},
16304};
16305static constexpr const char *SwiftErrorArgNames[] = {
16306"Convention",};
16307struct ParsedAttrInfoSwiftError final : public ParsedAttrInfo {
16308 constexpr ParsedAttrInfoSwiftError() : ParsedAttrInfo(
16309 /*AttrKind=*/ParsedAttr::AT_SwiftError,
16310 /*NumArgs=*/1,
16311 /*OptArgs=*/0,
16312 /*NumArgMembers=*/1,
16313 /*HasCustomParsing=*/0,
16314 /*AcceptsExprPack=*/0,
16315 /*IsTargetSpecific=*/0,
16316 /*IsType=*/0,
16317 /*IsStmt=*/0,
16318 /*IsKnownToGCC=*/0,
16319 /*IsSupportedByPragmaAttribute=*/1,
16320 /*Spellings=*/SwiftErrorSpellings,
16321 /*ArgNames=*/SwiftErrorArgNames) {}
16322bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16323 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
16324 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
16325 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
16326 return false;
16327 }
16328 return true;
16329}
16330
16331bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16332 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16333 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16334 return false;
16335}
16336
16337void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16338 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
16339 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
16340}
16341
16342bool isParamExpr(size_t N) const override {
16343 return false;
16344}
16345
16346static const ParsedAttrInfoSwiftError Instance;
16347};
16348const ParsedAttrInfoSwiftError ParsedAttrInfoSwiftError::Instance;
16349static constexpr ParsedAttrInfo::Spelling SwiftErrorResultSpellings[] = {
16350 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_error_result"},
16351 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::swift_error_result"},
16352 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::swift_error_result"},
16353};
16354struct ParsedAttrInfoSwiftErrorResult final : public ParsedAttrInfo {
16355 constexpr ParsedAttrInfoSwiftErrorResult() : ParsedAttrInfo(
16356 /*AttrKind=*/ParsedAttr::AT_SwiftErrorResult,
16357 /*NumArgs=*/0,
16358 /*OptArgs=*/0,
16359 /*NumArgMembers=*/0,
16360 /*HasCustomParsing=*/0,
16361 /*AcceptsExprPack=*/0,
16362 /*IsTargetSpecific=*/0,
16363 /*IsType=*/0,
16364 /*IsStmt=*/0,
16365 /*IsKnownToGCC=*/0,
16366 /*IsSupportedByPragmaAttribute=*/1,
16367 /*Spellings=*/SwiftErrorResultSpellings,
16368 /*ArgNames=*/{}) {}
16369bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16370 if (!isa<ParmVarDecl>(Val: D)) {
16371 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
16372 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
16373 return false;
16374 }
16375 return true;
16376}
16377
16378bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16379 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16380 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16381 return false;
16382}
16383
16384void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16385 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
16386}
16387
16388bool isParamExpr(size_t N) const override {
16389 return false;
16390}
16391
16392static const ParsedAttrInfoSwiftErrorResult Instance;
16393};
16394const ParsedAttrInfoSwiftErrorResult ParsedAttrInfoSwiftErrorResult::Instance;
16395static constexpr ParsedAttrInfo::Spelling SwiftIndirectResultSpellings[] = {
16396 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_indirect_result"},
16397 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::swift_indirect_result"},
16398 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::swift_indirect_result"},
16399};
16400struct ParsedAttrInfoSwiftIndirectResult final : public ParsedAttrInfo {
16401 constexpr ParsedAttrInfoSwiftIndirectResult() : ParsedAttrInfo(
16402 /*AttrKind=*/ParsedAttr::AT_SwiftIndirectResult,
16403 /*NumArgs=*/0,
16404 /*OptArgs=*/0,
16405 /*NumArgMembers=*/0,
16406 /*HasCustomParsing=*/0,
16407 /*AcceptsExprPack=*/0,
16408 /*IsTargetSpecific=*/0,
16409 /*IsType=*/0,
16410 /*IsStmt=*/0,
16411 /*IsKnownToGCC=*/0,
16412 /*IsSupportedByPragmaAttribute=*/1,
16413 /*Spellings=*/SwiftIndirectResultSpellings,
16414 /*ArgNames=*/{}) {}
16415bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16416 if (!isa<ParmVarDecl>(Val: D)) {
16417 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
16418 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
16419 return false;
16420 }
16421 return true;
16422}
16423
16424bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16425 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16426 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16427 return false;
16428}
16429
16430void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16431 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
16432}
16433
16434bool isParamExpr(size_t N) const override {
16435 return false;
16436}
16437
16438static const ParsedAttrInfoSwiftIndirectResult Instance;
16439};
16440const ParsedAttrInfoSwiftIndirectResult ParsedAttrInfoSwiftIndirectResult::Instance;
16441static constexpr ParsedAttrInfo::Spelling SwiftNameSpellings[] = {
16442 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_name"},
16443};
16444static constexpr const char *SwiftNameArgNames[] = {
16445"Name",};
16446struct ParsedAttrInfoSwiftName final : public ParsedAttrInfo {
16447 constexpr ParsedAttrInfoSwiftName() : ParsedAttrInfo(
16448 /*AttrKind=*/ParsedAttr::AT_SwiftName,
16449 /*NumArgs=*/1,
16450 /*OptArgs=*/0,
16451 /*NumArgMembers=*/1,
16452 /*HasCustomParsing=*/0,
16453 /*AcceptsExprPack=*/0,
16454 /*IsTargetSpecific=*/0,
16455 /*IsType=*/0,
16456 /*IsStmt=*/0,
16457 /*IsKnownToGCC=*/0,
16458 /*IsSupportedByPragmaAttribute=*/0,
16459 /*Spellings=*/SwiftNameSpellings,
16460 /*ArgNames=*/SwiftNameArgNames) {}
16461bool isParamExpr(size_t N) const override {
16462 return false;
16463}
16464
16465static const ParsedAttrInfoSwiftName Instance;
16466};
16467const ParsedAttrInfoSwiftName ParsedAttrInfoSwiftName::Instance;
16468static constexpr ParsedAttrInfo::Spelling SwiftNewTypeSpellings[] = {
16469 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_newtype"},
16470 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_wrapper"},
16471};
16472static constexpr const char *SwiftNewTypeArgNames[] = {
16473"NewtypeKind",};
16474struct ParsedAttrInfoSwiftNewType final : public ParsedAttrInfo {
16475 constexpr ParsedAttrInfoSwiftNewType() : ParsedAttrInfo(
16476 /*AttrKind=*/ParsedAttr::AT_SwiftNewType,
16477 /*NumArgs=*/1,
16478 /*OptArgs=*/0,
16479 /*NumArgMembers=*/1,
16480 /*HasCustomParsing=*/1,
16481 /*AcceptsExprPack=*/0,
16482 /*IsTargetSpecific=*/0,
16483 /*IsType=*/0,
16484 /*IsStmt=*/0,
16485 /*IsKnownToGCC=*/0,
16486 /*IsSupportedByPragmaAttribute=*/1,
16487 /*Spellings=*/SwiftNewTypeSpellings,
16488 /*ArgNames=*/SwiftNewTypeArgNames) {}
16489bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16490 if (!isa<TypedefNameDecl>(Val: D)) {
16491 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
16492 << Attr << Attr.isRegularKeywordAttribute() << "typedefs";
16493 return false;
16494 }
16495 return true;
16496}
16497
16498bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16499 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16500 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16501 return false;
16502}
16503
16504unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
16505 enum Spelling {
16506 GNU_swift_newtype = 0,
16507 GNU_swift_wrapper = 1,
16508 SpellingNotCalculated = 15
16509
16510 };
16511
16512 unsigned Idx = Attr.getAttributeSpellingListIndex();
16513 switch (Idx) {
16514 default: llvm_unreachable("Unknown spelling list index");
16515 case 0: return GNU_swift_newtype;
16516 case 1: return GNU_swift_wrapper;
16517 }
16518}
16519
16520void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16521 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
16522}
16523
16524bool isParamExpr(size_t N) const override {
16525 return false;
16526}
16527
16528static const ParsedAttrInfoSwiftNewType Instance;
16529};
16530const ParsedAttrInfoSwiftNewType ParsedAttrInfoSwiftNewType::Instance;
16531static constexpr ParsedAttrInfo::Spelling SwiftObjCMembersSpellings[] = {
16532 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_objc_members"},
16533};
16534struct ParsedAttrInfoSwiftObjCMembers final : public ParsedAttrInfo {
16535 constexpr ParsedAttrInfoSwiftObjCMembers() : ParsedAttrInfo(
16536 /*AttrKind=*/ParsedAttr::AT_SwiftObjCMembers,
16537 /*NumArgs=*/0,
16538 /*OptArgs=*/0,
16539 /*NumArgMembers=*/0,
16540 /*HasCustomParsing=*/0,
16541 /*AcceptsExprPack=*/0,
16542 /*IsTargetSpecific=*/0,
16543 /*IsType=*/0,
16544 /*IsStmt=*/0,
16545 /*IsKnownToGCC=*/0,
16546 /*IsSupportedByPragmaAttribute=*/1,
16547 /*Spellings=*/SwiftObjCMembersSpellings,
16548 /*ArgNames=*/{}) {}
16549bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16550 if (!isa<ObjCInterfaceDecl>(Val: D)) {
16551 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
16552 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C interfaces";
16553 return false;
16554 }
16555 return true;
16556}
16557
16558bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16559 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16560 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16561 return false;
16562}
16563
16564void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16565 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_interface, /*IsSupported=*/y: LangOpts.ObjC));
16566}
16567
16568AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
16569 D->addAttr(A: ::new (S.Context) SwiftObjCMembersAttr(S.Context, Attr));
16570 return AttributeApplied;
16571}
16572
16573bool isParamExpr(size_t N) const override {
16574 return false;
16575}
16576
16577static const ParsedAttrInfoSwiftObjCMembers Instance;
16578};
16579const ParsedAttrInfoSwiftObjCMembers ParsedAttrInfoSwiftObjCMembers::Instance;
16580static constexpr ParsedAttrInfo::Spelling SwiftPrivateSpellings[] = {
16581 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "swift_private"},
16582};
16583struct ParsedAttrInfoSwiftPrivate final : public ParsedAttrInfo {
16584 constexpr ParsedAttrInfoSwiftPrivate() : ParsedAttrInfo(
16585 /*AttrKind=*/ParsedAttr::AT_SwiftPrivate,
16586 /*NumArgs=*/0,
16587 /*OptArgs=*/0,
16588 /*NumArgMembers=*/0,
16589 /*HasCustomParsing=*/0,
16590 /*AcceptsExprPack=*/0,
16591 /*IsTargetSpecific=*/0,
16592 /*IsType=*/0,
16593 /*IsStmt=*/0,
16594 /*IsKnownToGCC=*/0,
16595 /*IsSupportedByPragmaAttribute=*/0,
16596 /*Spellings=*/SwiftPrivateSpellings,
16597 /*ArgNames=*/{}) {}
16598AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
16599 D->addAttr(A: ::new (S.Context) SwiftPrivateAttr(S.Context, Attr));
16600 return AttributeApplied;
16601}
16602
16603bool isParamExpr(size_t N) const override {
16604 return false;
16605}
16606
16607static const ParsedAttrInfoSwiftPrivate Instance;
16608};
16609const ParsedAttrInfoSwiftPrivate ParsedAttrInfoSwiftPrivate::Instance;
16610static constexpr ParsedAttrInfo::Spelling SysVABISpellings[] = {
16611 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "sysv_abi"},
16612 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::sysv_abi"},
16613 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::sysv_abi"},
16614};
16615struct ParsedAttrInfoSysVABI final : public ParsedAttrInfo {
16616 constexpr ParsedAttrInfoSysVABI() : ParsedAttrInfo(
16617 /*AttrKind=*/ParsedAttr::AT_SysVABI,
16618 /*NumArgs=*/0,
16619 /*OptArgs=*/0,
16620 /*NumArgMembers=*/0,
16621 /*HasCustomParsing=*/0,
16622 /*AcceptsExprPack=*/0,
16623 /*IsTargetSpecific=*/0,
16624 /*IsType=*/1,
16625 /*IsStmt=*/0,
16626 /*IsKnownToGCC=*/1,
16627 /*IsSupportedByPragmaAttribute=*/0,
16628 /*Spellings=*/SysVABISpellings,
16629 /*ArgNames=*/{}) {}
16630bool isParamExpr(size_t N) const override {
16631 return false;
16632}
16633
16634static const ParsedAttrInfoSysVABI Instance;
16635};
16636const ParsedAttrInfoSysVABI ParsedAttrInfoSysVABI::Instance;
16637static constexpr ParsedAttrInfo::Spelling TLSModelSpellings[] = {
16638 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "tls_model"},
16639 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::tls_model"},
16640 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::tls_model"},
16641};
16642static constexpr const char *TLSModelArgNames[] = {
16643"Model",};
16644struct ParsedAttrInfoTLSModel final : public ParsedAttrInfo {
16645 constexpr ParsedAttrInfoTLSModel() : ParsedAttrInfo(
16646 /*AttrKind=*/ParsedAttr::AT_TLSModel,
16647 /*NumArgs=*/1,
16648 /*OptArgs=*/0,
16649 /*NumArgMembers=*/1,
16650 /*HasCustomParsing=*/0,
16651 /*AcceptsExprPack=*/0,
16652 /*IsTargetSpecific=*/0,
16653 /*IsType=*/0,
16654 /*IsStmt=*/0,
16655 /*IsKnownToGCC=*/1,
16656 /*IsSupportedByPragmaAttribute=*/1,
16657 /*Spellings=*/TLSModelSpellings,
16658 /*ArgNames=*/TLSModelArgNames) {}
16659bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16660 if (!isTLSVar(D)) {
16661 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
16662 << Attr << Attr.isRegularKeywordAttribute() << "thread-local variables";
16663 return false;
16664 }
16665 return true;
16666}
16667
16668bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16669 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16670 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16671 return false;
16672}
16673
16674void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16675 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_thread_local, /*IsSupported=*/y: true));
16676}
16677
16678bool isParamExpr(size_t N) const override {
16679 return false;
16680}
16681
16682static const ParsedAttrInfoTLSModel Instance;
16683};
16684const ParsedAttrInfoTLSModel ParsedAttrInfoTLSModel::Instance;
16685static constexpr ParsedAttrInfo::Spelling TargetSpellings[] = {
16686 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "target"},
16687 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::target"},
16688 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::target"},
16689};
16690static constexpr const char *TargetArgNames[] = {
16691"featuresStr",};
16692struct ParsedAttrInfoTarget final : public ParsedAttrInfo {
16693 constexpr ParsedAttrInfoTarget() : ParsedAttrInfo(
16694 /*AttrKind=*/ParsedAttr::AT_Target,
16695 /*NumArgs=*/1,
16696 /*OptArgs=*/0,
16697 /*NumArgMembers=*/1,
16698 /*HasCustomParsing=*/0,
16699 /*AcceptsExprPack=*/0,
16700 /*IsTargetSpecific=*/0,
16701 /*IsType=*/0,
16702 /*IsStmt=*/0,
16703 /*IsKnownToGCC=*/1,
16704 /*IsSupportedByPragmaAttribute=*/1,
16705 /*Spellings=*/TargetSpellings,
16706 /*ArgNames=*/TargetArgNames) {}
16707bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16708 if (!isa<FunctionDecl>(Val: D)) {
16709 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
16710 << Attr << Attr.isRegularKeywordAttribute() << "functions";
16711 return false;
16712 }
16713 return true;
16714}
16715
16716bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16717 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16718 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16719 return false;
16720}
16721
16722 using ParsedAttrInfo::diagMutualExclusion;
16723
16724 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
16725 if (const auto *A = D->getAttr<TargetClonesAttr>()) {
16726 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16727 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16728return false;
16729 }
16730 if (const auto *A = D->getAttr<TargetVersionAttr>()) {
16731 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16732 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16733return false;
16734 }
16735 if (const auto *A = D->getAttr<CPUDispatchAttr>()) {
16736 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16737 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16738return false;
16739 }
16740 if (const auto *A = D->getAttr<CPUSpecificAttr>()) {
16741 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16742 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16743return false;
16744 }
16745 return true;
16746 }
16747
16748void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16749 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
16750}
16751
16752bool isParamExpr(size_t N) const override {
16753 return false;
16754}
16755
16756static const ParsedAttrInfoTarget Instance;
16757};
16758const ParsedAttrInfoTarget ParsedAttrInfoTarget::Instance;
16759static constexpr ParsedAttrInfo::Spelling TargetClonesSpellings[] = {
16760 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "target_clones"},
16761 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::target_clones"},
16762 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::target_clones"},
16763};
16764static constexpr const char *TargetClonesArgNames[] = {
16765"featuresStrs...",};
16766struct ParsedAttrInfoTargetClones final : public ParsedAttrInfo {
16767 constexpr ParsedAttrInfoTargetClones() : ParsedAttrInfo(
16768 /*AttrKind=*/ParsedAttr::AT_TargetClones,
16769 /*NumArgs=*/0,
16770 /*OptArgs=*/15,
16771 /*NumArgMembers=*/1,
16772 /*HasCustomParsing=*/0,
16773 /*AcceptsExprPack=*/0,
16774 /*IsTargetSpecific=*/0,
16775 /*IsType=*/0,
16776 /*IsStmt=*/0,
16777 /*IsKnownToGCC=*/1,
16778 /*IsSupportedByPragmaAttribute=*/1,
16779 /*Spellings=*/TargetClonesSpellings,
16780 /*ArgNames=*/TargetClonesArgNames) {}
16781bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16782 if (!isa<FunctionDecl>(Val: D)) {
16783 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
16784 << Attr << Attr.isRegularKeywordAttribute() << "functions";
16785 return false;
16786 }
16787 return true;
16788}
16789
16790bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16791 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16792 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16793 return false;
16794}
16795
16796 using ParsedAttrInfo::diagMutualExclusion;
16797
16798 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
16799 if (const auto *A = D->getAttr<TargetVersionAttr>()) {
16800 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16801 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16802return false;
16803 }
16804 if (const auto *A = D->getAttr<TargetAttr>()) {
16805 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16806 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16807return false;
16808 }
16809 if (const auto *A = D->getAttr<CPUDispatchAttr>()) {
16810 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16811 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16812return false;
16813 }
16814 if (const auto *A = D->getAttr<CPUSpecificAttr>()) {
16815 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16816 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16817return false;
16818 }
16819 return true;
16820 }
16821
16822void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16823 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
16824}
16825
16826bool isParamExpr(size_t N) const override {
16827 return false;
16828}
16829
16830static const ParsedAttrInfoTargetClones Instance;
16831};
16832const ParsedAttrInfoTargetClones ParsedAttrInfoTargetClones::Instance;
16833static constexpr ParsedAttrInfo::Spelling TargetVersionSpellings[] = {
16834 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "target_version"},
16835 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::target_version"},
16836 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::target_version"},
16837};
16838static constexpr const char *TargetVersionArgNames[] = {
16839"NamesStr",};
16840struct ParsedAttrInfoTargetVersion final : public ParsedAttrInfo {
16841 constexpr ParsedAttrInfoTargetVersion() : ParsedAttrInfo(
16842 /*AttrKind=*/ParsedAttr::AT_TargetVersion,
16843 /*NumArgs=*/1,
16844 /*OptArgs=*/0,
16845 /*NumArgMembers=*/1,
16846 /*HasCustomParsing=*/0,
16847 /*AcceptsExprPack=*/0,
16848 /*IsTargetSpecific=*/0,
16849 /*IsType=*/0,
16850 /*IsStmt=*/0,
16851 /*IsKnownToGCC=*/1,
16852 /*IsSupportedByPragmaAttribute=*/1,
16853 /*Spellings=*/TargetVersionSpellings,
16854 /*ArgNames=*/TargetVersionArgNames) {}
16855bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16856 if (!isa<FunctionDecl>(Val: D)) {
16857 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
16858 << Attr << Attr.isRegularKeywordAttribute() << "functions";
16859 return false;
16860 }
16861 return true;
16862}
16863
16864bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16865 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16866 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16867 return false;
16868}
16869
16870 using ParsedAttrInfo::diagMutualExclusion;
16871
16872 bool diagMutualExclusion(Sema &S, const ParsedAttr &AL, const Decl *D) const override {
16873 if (const auto *A = D->getAttr<TargetClonesAttr>()) {
16874 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16875 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16876return false;
16877 }
16878 if (const auto *A = D->getAttr<TargetAttr>()) {
16879 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16880 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16881return false;
16882 }
16883 if (const auto *A = D->getAttr<CPUDispatchAttr>()) {
16884 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16885 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16886return false;
16887 }
16888 if (const auto *A = D->getAttr<CPUSpecificAttr>()) {
16889 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_attributes_are_not_compatible) << AL << A << (AL.isRegularKeywordAttribute() || A->isRegularKeywordAttribute());
16890 S.Diag(Loc: A->getLocation(), DiagID: diag::note_conflicting_attribute);
16891return false;
16892 }
16893 return true;
16894 }
16895
16896void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16897 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
16898}
16899
16900bool isParamExpr(size_t N) const override {
16901 return false;
16902}
16903
16904static const ParsedAttrInfoTargetVersion Instance;
16905};
16906const ParsedAttrInfoTargetVersion ParsedAttrInfoTargetVersion::Instance;
16907static constexpr ParsedAttrInfo::Spelling TestTypestateSpellings[] = {
16908 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "test_typestate"},
16909 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::test_typestate"},
16910};
16911static constexpr const char *TestTypestateArgNames[] = {
16912"TestState",};
16913struct ParsedAttrInfoTestTypestate final : public ParsedAttrInfo {
16914 constexpr ParsedAttrInfoTestTypestate() : ParsedAttrInfo(
16915 /*AttrKind=*/ParsedAttr::AT_TestTypestate,
16916 /*NumArgs=*/1,
16917 /*OptArgs=*/0,
16918 /*NumArgMembers=*/1,
16919 /*HasCustomParsing=*/0,
16920 /*AcceptsExprPack=*/0,
16921 /*IsTargetSpecific=*/0,
16922 /*IsType=*/0,
16923 /*IsStmt=*/0,
16924 /*IsKnownToGCC=*/0,
16925 /*IsSupportedByPragmaAttribute=*/1,
16926 /*Spellings=*/TestTypestateSpellings,
16927 /*ArgNames=*/TestTypestateArgNames) {}
16928bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
16929 if (!isa<CXXMethodDecl>(Val: D)) {
16930 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
16931 << Attr << Attr.isRegularKeywordAttribute() << "functions";
16932 return false;
16933 }
16934 return true;
16935}
16936
16937bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
16938 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
16939 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
16940 return false;
16941}
16942
16943void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
16944 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function_is_member, /*IsSupported=*/y: LangOpts.CPlusPlus));
16945}
16946
16947bool isParamExpr(size_t N) const override {
16948 return false;
16949}
16950
16951static const ParsedAttrInfoTestTypestate Instance;
16952};
16953const ParsedAttrInfoTestTypestate ParsedAttrInfoTestTypestate::Instance;
16954static constexpr ParsedAttrInfo::Spelling ThisCallSpellings[] = {
16955 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "thiscall"},
16956 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::thiscall"},
16957 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::thiscall"},
16958 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__thiscall"},
16959 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_thiscall"},
16960};
16961struct ParsedAttrInfoThisCall final : public ParsedAttrInfo {
16962 constexpr ParsedAttrInfoThisCall() : ParsedAttrInfo(
16963 /*AttrKind=*/ParsedAttr::AT_ThisCall,
16964 /*NumArgs=*/0,
16965 /*OptArgs=*/0,
16966 /*NumArgMembers=*/0,
16967 /*HasCustomParsing=*/0,
16968 /*AcceptsExprPack=*/0,
16969 /*IsTargetSpecific=*/0,
16970 /*IsType=*/1,
16971 /*IsStmt=*/0,
16972 /*IsKnownToGCC=*/1,
16973 /*IsSupportedByPragmaAttribute=*/0,
16974 /*Spellings=*/ThisCallSpellings,
16975 /*ArgNames=*/{}) {}
16976bool isParamExpr(size_t N) const override {
16977 return false;
16978}
16979
16980static const ParsedAttrInfoThisCall Instance;
16981};
16982const ParsedAttrInfoThisCall ParsedAttrInfoThisCall::Instance;
16983static constexpr ParsedAttrInfo::Spelling ThreadSpellings[] = {
16984 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "thread"},
16985};
16986struct ParsedAttrInfoThread final : public ParsedAttrInfo {
16987 constexpr ParsedAttrInfoThread() : ParsedAttrInfo(
16988 /*AttrKind=*/ParsedAttr::AT_Thread,
16989 /*NumArgs=*/0,
16990 /*OptArgs=*/0,
16991 /*NumArgMembers=*/0,
16992 /*HasCustomParsing=*/0,
16993 /*AcceptsExprPack=*/0,
16994 /*IsTargetSpecific=*/0,
16995 /*IsType=*/0,
16996 /*IsStmt=*/0,
16997 /*IsKnownToGCC=*/0,
16998 /*IsSupportedByPragmaAttribute=*/0,
16999 /*Spellings=*/ThreadSpellings,
17000 /*ArgNames=*/{}) {}
17001bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17002 if (!isa<VarDecl>(Val: D)) {
17003 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
17004 << Attr << Attr.isRegularKeywordAttribute() << "variables";
17005 return false;
17006 }
17007 return true;
17008}
17009
17010bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17011 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17012 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17013 return false;
17014}
17015
17016bool acceptsLangOpts(const LangOptions &LangOpts) const override {
17017 return LangOpts.MicrosoftExt;
17018}
17019
17020bool isParamExpr(size_t N) const override {
17021 return false;
17022}
17023
17024static const ParsedAttrInfoThread Instance;
17025};
17026const ParsedAttrInfoThread ParsedAttrInfoThread::Instance;
17027static constexpr ParsedAttrInfo::Spelling TransparentUnionSpellings[] = {
17028 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "transparent_union"},
17029 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::transparent_union"},
17030 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::transparent_union"},
17031};
17032struct ParsedAttrInfoTransparentUnion final : public ParsedAttrInfo {
17033 constexpr ParsedAttrInfoTransparentUnion() : ParsedAttrInfo(
17034 /*AttrKind=*/ParsedAttr::AT_TransparentUnion,
17035 /*NumArgs=*/0,
17036 /*OptArgs=*/0,
17037 /*NumArgMembers=*/0,
17038 /*HasCustomParsing=*/0,
17039 /*AcceptsExprPack=*/0,
17040 /*IsTargetSpecific=*/0,
17041 /*IsType=*/0,
17042 /*IsStmt=*/0,
17043 /*IsKnownToGCC=*/1,
17044 /*IsSupportedByPragmaAttribute=*/0,
17045 /*Spellings=*/TransparentUnionSpellings,
17046 /*ArgNames=*/{}) {}
17047bool acceptsLangOpts(const LangOptions &LangOpts) const override {
17048 return (!LangOpts.CPlusPlus);
17049}
17050
17051bool isParamExpr(size_t N) const override {
17052 return false;
17053}
17054
17055static const ParsedAttrInfoTransparentUnion Instance;
17056};
17057const ParsedAttrInfoTransparentUnion ParsedAttrInfoTransparentUnion::Instance;
17058static constexpr ParsedAttrInfo::Spelling TrivialABISpellings[] = {
17059 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "trivial_abi"},
17060 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::trivial_abi"},
17061};
17062struct ParsedAttrInfoTrivialABI final : public ParsedAttrInfo {
17063 constexpr ParsedAttrInfoTrivialABI() : ParsedAttrInfo(
17064 /*AttrKind=*/ParsedAttr::AT_TrivialABI,
17065 /*NumArgs=*/0,
17066 /*OptArgs=*/0,
17067 /*NumArgMembers=*/0,
17068 /*HasCustomParsing=*/0,
17069 /*AcceptsExprPack=*/0,
17070 /*IsTargetSpecific=*/0,
17071 /*IsType=*/0,
17072 /*IsStmt=*/0,
17073 /*IsKnownToGCC=*/0,
17074 /*IsSupportedByPragmaAttribute=*/1,
17075 /*Spellings=*/TrivialABISpellings,
17076 /*ArgNames=*/{}) {}
17077bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17078 if (!isa<CXXRecordDecl>(Val: D)) {
17079 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
17080 << Attr << Attr.isRegularKeywordAttribute() << "classes";
17081 return false;
17082 }
17083 return true;
17084}
17085
17086bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17087 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17088 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17089 return false;
17090}
17091
17092bool acceptsLangOpts(const LangOptions &LangOpts) const override {
17093 return LangOpts.CPlusPlus;
17094}
17095
17096void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
17097 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
17098}
17099
17100AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
17101 D->addAttr(A: ::new (S.Context) TrivialABIAttr(S.Context, Attr));
17102 return AttributeApplied;
17103}
17104
17105bool isParamExpr(size_t N) const override {
17106 return false;
17107}
17108
17109static const ParsedAttrInfoTrivialABI Instance;
17110};
17111const ParsedAttrInfoTrivialABI ParsedAttrInfoTrivialABI::Instance;
17112static constexpr ParsedAttrInfo::Spelling TryAcquireCapabilitySpellings[] = {
17113 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "try_acquire_capability"},
17114 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::try_acquire_capability"},
17115 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "try_acquire_shared_capability"},
17116 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::try_acquire_shared_capability"},
17117};
17118static constexpr const char *TryAcquireCapabilityArgNames[] = {
17119"SuccessValue","Args...",};
17120struct ParsedAttrInfoTryAcquireCapability final : public ParsedAttrInfo {
17121 constexpr ParsedAttrInfoTryAcquireCapability() : ParsedAttrInfo(
17122 /*AttrKind=*/ParsedAttr::AT_TryAcquireCapability,
17123 /*NumArgs=*/1,
17124 /*OptArgs=*/15,
17125 /*NumArgMembers=*/2,
17126 /*HasCustomParsing=*/0,
17127 /*AcceptsExprPack=*/0,
17128 /*IsTargetSpecific=*/0,
17129 /*IsType=*/0,
17130 /*IsStmt=*/0,
17131 /*IsKnownToGCC=*/0,
17132 /*IsSupportedByPragmaAttribute=*/0,
17133 /*Spellings=*/TryAcquireCapabilitySpellings,
17134 /*ArgNames=*/TryAcquireCapabilityArgNames) {}
17135bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17136 if (!isa<FunctionDecl>(Val: D)) {
17137 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
17138 << Attr << Attr.isRegularKeywordAttribute() << "functions";
17139 return false;
17140 }
17141 return true;
17142}
17143
17144bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17145 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17146 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17147 return false;
17148}
17149
17150unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
17151 enum Spelling {
17152 GNU_try_acquire_capability = 0,
17153 CXX11_clang_try_acquire_capability = 1,
17154 GNU_try_acquire_shared_capability = 2,
17155 CXX11_clang_try_acquire_shared_capability = 3,
17156 SpellingNotCalculated = 15
17157
17158 };
17159
17160 unsigned Idx = Attr.getAttributeSpellingListIndex();
17161 switch (Idx) {
17162 default: llvm_unreachable("Unknown spelling list index");
17163 case 0: return GNU_try_acquire_capability;
17164 case 1: return CXX11_clang_try_acquire_capability;
17165 case 2: return GNU_try_acquire_shared_capability;
17166 case 3: return CXX11_clang_try_acquire_shared_capability;
17167 }
17168}
17169
17170bool isParamExpr(size_t N) const override {
17171 return (N == 0) || (N == 1) || false;
17172}
17173
17174static const ParsedAttrInfoTryAcquireCapability Instance;
17175};
17176const ParsedAttrInfoTryAcquireCapability ParsedAttrInfoTryAcquireCapability::Instance;
17177static constexpr ParsedAttrInfo::Spelling TypeNonNullSpellings[] = {
17178 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_Nonnull"},
17179};
17180struct ParsedAttrInfoTypeNonNull final : public ParsedAttrInfo {
17181 constexpr ParsedAttrInfoTypeNonNull() : ParsedAttrInfo(
17182 /*AttrKind=*/ParsedAttr::AT_TypeNonNull,
17183 /*NumArgs=*/0,
17184 /*OptArgs=*/0,
17185 /*NumArgMembers=*/0,
17186 /*HasCustomParsing=*/0,
17187 /*AcceptsExprPack=*/0,
17188 /*IsTargetSpecific=*/0,
17189 /*IsType=*/1,
17190 /*IsStmt=*/0,
17191 /*IsKnownToGCC=*/0,
17192 /*IsSupportedByPragmaAttribute=*/0,
17193 /*Spellings=*/TypeNonNullSpellings,
17194 /*ArgNames=*/{}) {}
17195bool isParamExpr(size_t N) const override {
17196 return false;
17197}
17198
17199static const ParsedAttrInfoTypeNonNull Instance;
17200};
17201const ParsedAttrInfoTypeNonNull ParsedAttrInfoTypeNonNull::Instance;
17202static constexpr ParsedAttrInfo::Spelling TypeNullUnspecifiedSpellings[] = {
17203 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_Null_unspecified"},
17204};
17205struct ParsedAttrInfoTypeNullUnspecified final : public ParsedAttrInfo {
17206 constexpr ParsedAttrInfoTypeNullUnspecified() : ParsedAttrInfo(
17207 /*AttrKind=*/ParsedAttr::AT_TypeNullUnspecified,
17208 /*NumArgs=*/0,
17209 /*OptArgs=*/0,
17210 /*NumArgMembers=*/0,
17211 /*HasCustomParsing=*/0,
17212 /*AcceptsExprPack=*/0,
17213 /*IsTargetSpecific=*/0,
17214 /*IsType=*/1,
17215 /*IsStmt=*/0,
17216 /*IsKnownToGCC=*/0,
17217 /*IsSupportedByPragmaAttribute=*/0,
17218 /*Spellings=*/TypeNullUnspecifiedSpellings,
17219 /*ArgNames=*/{}) {}
17220bool isParamExpr(size_t N) const override {
17221 return false;
17222}
17223
17224static const ParsedAttrInfoTypeNullUnspecified Instance;
17225};
17226const ParsedAttrInfoTypeNullUnspecified ParsedAttrInfoTypeNullUnspecified::Instance;
17227static constexpr ParsedAttrInfo::Spelling TypeNullableSpellings[] = {
17228 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_Nullable"},
17229};
17230struct ParsedAttrInfoTypeNullable final : public ParsedAttrInfo {
17231 constexpr ParsedAttrInfoTypeNullable() : ParsedAttrInfo(
17232 /*AttrKind=*/ParsedAttr::AT_TypeNullable,
17233 /*NumArgs=*/0,
17234 /*OptArgs=*/0,
17235 /*NumArgMembers=*/0,
17236 /*HasCustomParsing=*/0,
17237 /*AcceptsExprPack=*/0,
17238 /*IsTargetSpecific=*/0,
17239 /*IsType=*/1,
17240 /*IsStmt=*/0,
17241 /*IsKnownToGCC=*/0,
17242 /*IsSupportedByPragmaAttribute=*/0,
17243 /*Spellings=*/TypeNullableSpellings,
17244 /*ArgNames=*/{}) {}
17245bool isParamExpr(size_t N) const override {
17246 return false;
17247}
17248
17249static const ParsedAttrInfoTypeNullable Instance;
17250};
17251const ParsedAttrInfoTypeNullable ParsedAttrInfoTypeNullable::Instance;
17252static constexpr ParsedAttrInfo::Spelling TypeNullableResultSpellings[] = {
17253 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_Nullable_result"},
17254};
17255struct ParsedAttrInfoTypeNullableResult final : public ParsedAttrInfo {
17256 constexpr ParsedAttrInfoTypeNullableResult() : ParsedAttrInfo(
17257 /*AttrKind=*/ParsedAttr::AT_TypeNullableResult,
17258 /*NumArgs=*/0,
17259 /*OptArgs=*/0,
17260 /*NumArgMembers=*/0,
17261 /*HasCustomParsing=*/0,
17262 /*AcceptsExprPack=*/0,
17263 /*IsTargetSpecific=*/0,
17264 /*IsType=*/1,
17265 /*IsStmt=*/0,
17266 /*IsKnownToGCC=*/0,
17267 /*IsSupportedByPragmaAttribute=*/0,
17268 /*Spellings=*/TypeNullableResultSpellings,
17269 /*ArgNames=*/{}) {}
17270bool isParamExpr(size_t N) const override {
17271 return false;
17272}
17273
17274static const ParsedAttrInfoTypeNullableResult Instance;
17275};
17276const ParsedAttrInfoTypeNullableResult ParsedAttrInfoTypeNullableResult::Instance;
17277static constexpr ParsedAttrInfo::Spelling TypeTagForDatatypeSpellings[] = {
17278 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "type_tag_for_datatype"},
17279 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::type_tag_for_datatype"},
17280 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::type_tag_for_datatype"},
17281};
17282static constexpr const char *TypeTagForDatatypeArgNames[] = {
17283"ArgumentKind","MatchingCType","LayoutCompatible","MustBeNull",};
17284struct ParsedAttrInfoTypeTagForDatatype final : public ParsedAttrInfo {
17285 constexpr ParsedAttrInfoTypeTagForDatatype() : ParsedAttrInfo(
17286 /*AttrKind=*/ParsedAttr::AT_TypeTagForDatatype,
17287 /*NumArgs=*/4,
17288 /*OptArgs=*/0,
17289 /*NumArgMembers=*/4,
17290 /*HasCustomParsing=*/1,
17291 /*AcceptsExprPack=*/0,
17292 /*IsTargetSpecific=*/0,
17293 /*IsType=*/0,
17294 /*IsStmt=*/0,
17295 /*IsKnownToGCC=*/0,
17296 /*IsSupportedByPragmaAttribute=*/0,
17297 /*Spellings=*/TypeTagForDatatypeSpellings,
17298 /*ArgNames=*/TypeTagForDatatypeArgNames) {}
17299bool isParamExpr(size_t N) const override {
17300 return false;
17301}
17302
17303static const ParsedAttrInfoTypeTagForDatatype Instance;
17304};
17305const ParsedAttrInfoTypeTagForDatatype ParsedAttrInfoTypeTagForDatatype::Instance;
17306static constexpr ParsedAttrInfo::Spelling TypeVisibilitySpellings[] = {
17307 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "type_visibility"},
17308 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::type_visibility"},
17309 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::type_visibility"},
17310};
17311static constexpr const char *TypeVisibilityArgNames[] = {
17312"Visibility",};
17313struct ParsedAttrInfoTypeVisibility final : public ParsedAttrInfo {
17314 constexpr ParsedAttrInfoTypeVisibility() : ParsedAttrInfo(
17315 /*AttrKind=*/ParsedAttr::AT_TypeVisibility,
17316 /*NumArgs=*/1,
17317 /*OptArgs=*/0,
17318 /*NumArgMembers=*/1,
17319 /*HasCustomParsing=*/0,
17320 /*AcceptsExprPack=*/0,
17321 /*IsTargetSpecific=*/0,
17322 /*IsType=*/0,
17323 /*IsStmt=*/0,
17324 /*IsKnownToGCC=*/0,
17325 /*IsSupportedByPragmaAttribute=*/0,
17326 /*Spellings=*/TypeVisibilitySpellings,
17327 /*ArgNames=*/TypeVisibilityArgNames) {}
17328bool isParamExpr(size_t N) const override {
17329 return false;
17330}
17331
17332static const ParsedAttrInfoTypeVisibility Instance;
17333};
17334const ParsedAttrInfoTypeVisibility ParsedAttrInfoTypeVisibility::Instance;
17335static constexpr ParsedAttrInfo::Spelling UPtrSpellings[] = {
17336 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__uptr"},
17337};
17338struct ParsedAttrInfoUPtr final : public ParsedAttrInfo {
17339 constexpr ParsedAttrInfoUPtr() : ParsedAttrInfo(
17340 /*AttrKind=*/ParsedAttr::AT_UPtr,
17341 /*NumArgs=*/0,
17342 /*OptArgs=*/0,
17343 /*NumArgMembers=*/0,
17344 /*HasCustomParsing=*/0,
17345 /*AcceptsExprPack=*/0,
17346 /*IsTargetSpecific=*/0,
17347 /*IsType=*/1,
17348 /*IsStmt=*/0,
17349 /*IsKnownToGCC=*/0,
17350 /*IsSupportedByPragmaAttribute=*/0,
17351 /*Spellings=*/UPtrSpellings,
17352 /*ArgNames=*/{}) {}
17353bool isParamExpr(size_t N) const override {
17354 return false;
17355}
17356
17357static const ParsedAttrInfoUPtr Instance;
17358};
17359const ParsedAttrInfoUPtr ParsedAttrInfoUPtr::Instance;
17360static constexpr ParsedAttrInfo::Spelling UnavailableSpellings[] = {
17361 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "unavailable"},
17362 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::unavailable"},
17363 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::unavailable"},
17364};
17365static constexpr const char *UnavailableArgNames[] = {
17366"Message",};
17367struct ParsedAttrInfoUnavailable final : public ParsedAttrInfo {
17368 constexpr ParsedAttrInfoUnavailable() : ParsedAttrInfo(
17369 /*AttrKind=*/ParsedAttr::AT_Unavailable,
17370 /*NumArgs=*/0,
17371 /*OptArgs=*/1,
17372 /*NumArgMembers=*/1,
17373 /*HasCustomParsing=*/0,
17374 /*AcceptsExprPack=*/0,
17375 /*IsTargetSpecific=*/0,
17376 /*IsType=*/0,
17377 /*IsStmt=*/0,
17378 /*IsKnownToGCC=*/0,
17379 /*IsSupportedByPragmaAttribute=*/0,
17380 /*Spellings=*/UnavailableSpellings,
17381 /*ArgNames=*/UnavailableArgNames) {}
17382bool isParamExpr(size_t N) const override {
17383 return false;
17384}
17385
17386static const ParsedAttrInfoUnavailable Instance;
17387};
17388const ParsedAttrInfoUnavailable ParsedAttrInfoUnavailable::Instance;
17389static constexpr ParsedAttrInfo::Spelling UninitializedSpellings[] = {
17390 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "uninitialized"},
17391 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::uninitialized"},
17392};
17393struct ParsedAttrInfoUninitialized final : public ParsedAttrInfo {
17394 constexpr ParsedAttrInfoUninitialized() : ParsedAttrInfo(
17395 /*AttrKind=*/ParsedAttr::AT_Uninitialized,
17396 /*NumArgs=*/0,
17397 /*OptArgs=*/0,
17398 /*NumArgMembers=*/0,
17399 /*HasCustomParsing=*/0,
17400 /*AcceptsExprPack=*/0,
17401 /*IsTargetSpecific=*/0,
17402 /*IsType=*/0,
17403 /*IsStmt=*/0,
17404 /*IsKnownToGCC=*/0,
17405 /*IsSupportedByPragmaAttribute=*/1,
17406 /*Spellings=*/UninitializedSpellings,
17407 /*ArgNames=*/{}) {}
17408bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17409 if (!isLocalVar(D)) {
17410 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
17411 << Attr << Attr.isRegularKeywordAttribute() << "local variables";
17412 return false;
17413 }
17414 return true;
17415}
17416
17417bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17418 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17419 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17420 return false;
17421}
17422
17423void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
17424 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_local, /*IsSupported=*/y: true));
17425}
17426
17427bool isParamExpr(size_t N) const override {
17428 return false;
17429}
17430
17431static const ParsedAttrInfoUninitialized Instance;
17432};
17433const ParsedAttrInfoUninitialized ParsedAttrInfoUninitialized::Instance;
17434static constexpr ParsedAttrInfo::Spelling UnlikelySpellings[] = {
17435 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "unlikely"},
17436 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::unlikely"},
17437};
17438struct ParsedAttrInfoUnlikely final : public ParsedAttrInfo {
17439 constexpr ParsedAttrInfoUnlikely() : ParsedAttrInfo(
17440 /*AttrKind=*/ParsedAttr::AT_Unlikely,
17441 /*NumArgs=*/0,
17442 /*OptArgs=*/0,
17443 /*NumArgMembers=*/0,
17444 /*HasCustomParsing=*/0,
17445 /*AcceptsExprPack=*/0,
17446 /*IsTargetSpecific=*/0,
17447 /*IsType=*/0,
17448 /*IsStmt=*/1,
17449 /*IsKnownToGCC=*/0,
17450 /*IsSupportedByPragmaAttribute=*/0,
17451 /*Spellings=*/UnlikelySpellings,
17452 /*ArgNames=*/{}) {}
17453 using ParsedAttrInfo::diagMutualExclusion;
17454
17455bool isParamExpr(size_t N) const override {
17456 return false;
17457}
17458
17459static const ParsedAttrInfoUnlikely Instance;
17460};
17461const ParsedAttrInfoUnlikely ParsedAttrInfoUnlikely::Instance;
17462static constexpr ParsedAttrInfo::Spelling UnsafeBufferUsageSpellings[] = {
17463 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "unsafe_buffer_usage"},
17464 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::unsafe_buffer_usage"},
17465 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::unsafe_buffer_usage"},
17466};
17467struct ParsedAttrInfoUnsafeBufferUsage final : public ParsedAttrInfo {
17468 constexpr ParsedAttrInfoUnsafeBufferUsage() : ParsedAttrInfo(
17469 /*AttrKind=*/ParsedAttr::AT_UnsafeBufferUsage,
17470 /*NumArgs=*/0,
17471 /*OptArgs=*/0,
17472 /*NumArgMembers=*/0,
17473 /*HasCustomParsing=*/0,
17474 /*AcceptsExprPack=*/0,
17475 /*IsTargetSpecific=*/0,
17476 /*IsType=*/0,
17477 /*IsStmt=*/0,
17478 /*IsKnownToGCC=*/0,
17479 /*IsSupportedByPragmaAttribute=*/1,
17480 /*Spellings=*/UnsafeBufferUsageSpellings,
17481 /*ArgNames=*/{}) {}
17482bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17483 if (!isa<FunctionDecl>(Val: D)) {
17484 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
17485 << Attr << Attr.isRegularKeywordAttribute() << "functions";
17486 return false;
17487 }
17488 return true;
17489}
17490
17491bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17492 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17493 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17494 return false;
17495}
17496
17497void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
17498 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
17499}
17500
17501bool isParamExpr(size_t N) const override {
17502 return false;
17503}
17504
17505static const ParsedAttrInfoUnsafeBufferUsage Instance;
17506};
17507const ParsedAttrInfoUnsafeBufferUsage ParsedAttrInfoUnsafeBufferUsage::Instance;
17508static constexpr ParsedAttrInfo::Spelling UnusedSpellings[] = {
17509 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "maybe_unused"},
17510 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "unused"},
17511 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::unused"},
17512 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::unused"},
17513 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "maybe_unused"},
17514};
17515struct ParsedAttrInfoUnused final : public ParsedAttrInfo {
17516 constexpr ParsedAttrInfoUnused() : ParsedAttrInfo(
17517 /*AttrKind=*/ParsedAttr::AT_Unused,
17518 /*NumArgs=*/0,
17519 /*OptArgs=*/0,
17520 /*NumArgMembers=*/0,
17521 /*HasCustomParsing=*/0,
17522 /*AcceptsExprPack=*/0,
17523 /*IsTargetSpecific=*/0,
17524 /*IsType=*/0,
17525 /*IsStmt=*/0,
17526 /*IsKnownToGCC=*/1,
17527 /*IsSupportedByPragmaAttribute=*/0,
17528 /*Spellings=*/UnusedSpellings,
17529 /*ArgNames=*/{}) {}
17530bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17531 if (!isa<VarDecl>(Val: D) && !isa<BindingDecl>(Val: D) && !isa<ObjCIvarDecl>(Val: D) && !isa<TypeDecl>(Val: D) && !isa<EnumDecl>(Val: D) && !isa<EnumConstantDecl>(Val: D) && !isa<LabelDecl>(Val: D) && !isa<FieldDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D) && !isFunctionLike(D)) {
17532 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
17533 << Attr << Attr.isRegularKeywordAttribute() << "variables, value declarations, non-static data members, types, enums, enumerators, labels, non-static data members, Objective-C methods, functions, and function pointers";
17534 return false;
17535 }
17536 return true;
17537}
17538
17539bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17540 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17541 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17542 return false;
17543}
17544
17545unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
17546 enum Spelling {
17547 CXX11_maybe_unused = 0,
17548 GNU_unused = 1,
17549 CXX11_gnu_unused = 2,
17550 C23_gnu_unused = 3,
17551 C23_maybe_unused = 4,
17552 SpellingNotCalculated = 15
17553
17554 };
17555
17556 unsigned Idx = Attr.getAttributeSpellingListIndex();
17557 switch (Idx) {
17558 default: llvm_unreachable("Unknown spelling list index");
17559 case 0: return CXX11_maybe_unused;
17560 case 1: return GNU_unused;
17561 case 2: return CXX11_gnu_unused;
17562 case 3: return C23_gnu_unused;
17563 case 4: return C23_maybe_unused;
17564 }
17565}
17566
17567bool isParamExpr(size_t N) const override {
17568 return false;
17569}
17570
17571static const ParsedAttrInfoUnused Instance;
17572};
17573const ParsedAttrInfoUnused ParsedAttrInfoUnused::Instance;
17574static constexpr ParsedAttrInfo::Spelling UseHandleSpellings[] = {
17575 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "use_handle"},
17576 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::use_handle"},
17577 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::use_handle"},
17578};
17579static constexpr const char *UseHandleArgNames[] = {
17580"HandleType",};
17581struct ParsedAttrInfoUseHandle final : public ParsedAttrInfo {
17582 constexpr ParsedAttrInfoUseHandle() : ParsedAttrInfo(
17583 /*AttrKind=*/ParsedAttr::AT_UseHandle,
17584 /*NumArgs=*/1,
17585 /*OptArgs=*/0,
17586 /*NumArgMembers=*/1,
17587 /*HasCustomParsing=*/0,
17588 /*AcceptsExprPack=*/0,
17589 /*IsTargetSpecific=*/0,
17590 /*IsType=*/0,
17591 /*IsStmt=*/0,
17592 /*IsKnownToGCC=*/0,
17593 /*IsSupportedByPragmaAttribute=*/1,
17594 /*Spellings=*/UseHandleSpellings,
17595 /*ArgNames=*/UseHandleArgNames) {}
17596bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17597 if (!isa<ParmVarDecl>(Val: D)) {
17598 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
17599 << Attr << Attr.isRegularKeywordAttribute() << "parameters";
17600 return false;
17601 }
17602 return true;
17603}
17604
17605bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17606 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17607 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17608 return false;
17609}
17610
17611void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
17612 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable_is_parameter, /*IsSupported=*/y: true));
17613}
17614
17615bool isParamExpr(size_t N) const override {
17616 return false;
17617}
17618
17619static const ParsedAttrInfoUseHandle Instance;
17620};
17621const ParsedAttrInfoUseHandle ParsedAttrInfoUseHandle::Instance;
17622static constexpr ParsedAttrInfo::Spelling UsedSpellings[] = {
17623 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "used"},
17624 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::used"},
17625 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::used"},
17626};
17627struct ParsedAttrInfoUsed final : public ParsedAttrInfo {
17628 constexpr ParsedAttrInfoUsed() : ParsedAttrInfo(
17629 /*AttrKind=*/ParsedAttr::AT_Used,
17630 /*NumArgs=*/0,
17631 /*OptArgs=*/0,
17632 /*NumArgMembers=*/0,
17633 /*HasCustomParsing=*/0,
17634 /*AcceptsExprPack=*/0,
17635 /*IsTargetSpecific=*/0,
17636 /*IsType=*/0,
17637 /*IsStmt=*/0,
17638 /*IsKnownToGCC=*/1,
17639 /*IsSupportedByPragmaAttribute=*/0,
17640 /*Spellings=*/UsedSpellings,
17641 /*ArgNames=*/{}) {}
17642bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17643 if (!isNonLocalVar(D) && !isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
17644 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
17645 << Attr << Attr.isRegularKeywordAttribute() << "variables with non-local storage, functions, and Objective-C methods";
17646 return false;
17647 }
17648 return true;
17649}
17650
17651bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17652 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17653 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17654 return false;
17655}
17656
17657AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
17658 D->addAttr(A: ::new (S.Context) UsedAttr(S.Context, Attr));
17659 return AttributeApplied;
17660}
17661
17662bool isParamExpr(size_t N) const override {
17663 return false;
17664}
17665
17666static const ParsedAttrInfoUsed Instance;
17667};
17668const ParsedAttrInfoUsed ParsedAttrInfoUsed::Instance;
17669static constexpr ParsedAttrInfo::Spelling UsingIfExistsSpellings[] = {
17670 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "using_if_exists"},
17671 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::using_if_exists"},
17672};
17673struct ParsedAttrInfoUsingIfExists final : public ParsedAttrInfo {
17674 constexpr ParsedAttrInfoUsingIfExists() : ParsedAttrInfo(
17675 /*AttrKind=*/ParsedAttr::AT_UsingIfExists,
17676 /*NumArgs=*/0,
17677 /*OptArgs=*/0,
17678 /*NumArgMembers=*/0,
17679 /*HasCustomParsing=*/0,
17680 /*AcceptsExprPack=*/0,
17681 /*IsTargetSpecific=*/0,
17682 /*IsType=*/0,
17683 /*IsStmt=*/0,
17684 /*IsKnownToGCC=*/0,
17685 /*IsSupportedByPragmaAttribute=*/0,
17686 /*Spellings=*/UsingIfExistsSpellings,
17687 /*ArgNames=*/{}) {}
17688bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17689 if (!isa<UsingDecl>(Val: D) && !isa<UnresolvedUsingTypenameDecl>(Val: D) && !isa<UnresolvedUsingValueDecl>(Val: D)) {
17690 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
17691 << Attr << Attr.isRegularKeywordAttribute() << "named declarations, types, and value declarations";
17692 return false;
17693 }
17694 return true;
17695}
17696
17697bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17698 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17699 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17700 return false;
17701}
17702
17703bool isParamExpr(size_t N) const override {
17704 return false;
17705}
17706
17707static const ParsedAttrInfoUsingIfExists Instance;
17708};
17709const ParsedAttrInfoUsingIfExists ParsedAttrInfoUsingIfExists::Instance;
17710static constexpr ParsedAttrInfo::Spelling UuidSpellings[] = {
17711 {.Syntax: AttributeCommonInfo::AS_Declspec, .NormalizedFullName: "uuid"},
17712 {.Syntax: AttributeCommonInfo::AS_Microsoft, .NormalizedFullName: "uuid"},
17713};
17714static constexpr const char *UuidArgNames[] = {
17715"Guid",};
17716struct ParsedAttrInfoUuid final : public ParsedAttrInfo {
17717 constexpr ParsedAttrInfoUuid() : ParsedAttrInfo(
17718 /*AttrKind=*/ParsedAttr::AT_Uuid,
17719 /*NumArgs=*/1,
17720 /*OptArgs=*/0,
17721 /*NumArgMembers=*/1,
17722 /*HasCustomParsing=*/0,
17723 /*AcceptsExprPack=*/0,
17724 /*IsTargetSpecific=*/0,
17725 /*IsType=*/0,
17726 /*IsStmt=*/0,
17727 /*IsKnownToGCC=*/0,
17728 /*IsSupportedByPragmaAttribute=*/0,
17729 /*Spellings=*/UuidSpellings,
17730 /*ArgNames=*/UuidArgNames) {}
17731bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17732 if (!isa<RecordDecl>(Val: D) && !isa<EnumDecl>(Val: D)) {
17733 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
17734 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, classes, and enums";
17735 return false;
17736 }
17737 return true;
17738}
17739
17740bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17741 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17742 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17743 return false;
17744}
17745
17746bool acceptsLangOpts(const LangOptions &LangOpts) const override {
17747 return LangOpts.MicrosoftExt || LangOpts.Borland;
17748}
17749
17750bool isParamExpr(size_t N) const override {
17751 return false;
17752}
17753
17754static const ParsedAttrInfoUuid Instance;
17755};
17756const ParsedAttrInfoUuid ParsedAttrInfoUuid::Instance;
17757static constexpr ParsedAttrInfo::Spelling VTablePointerAuthenticationSpellings[] = {
17758 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "ptrauth_vtable_pointer"},
17759 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::ptrauth_vtable_pointer"},
17760 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::ptrauth_vtable_pointer"},
17761};
17762static constexpr const char *VTablePointerAuthenticationArgNames[] = {
17763"Key","AddressDiscrimination","ExtraDiscrimination","CustomDiscriminationValue",};
17764struct ParsedAttrInfoVTablePointerAuthentication final : public ParsedAttrInfo {
17765 constexpr ParsedAttrInfoVTablePointerAuthentication() : ParsedAttrInfo(
17766 /*AttrKind=*/ParsedAttr::AT_VTablePointerAuthentication,
17767 /*NumArgs=*/3,
17768 /*OptArgs=*/1,
17769 /*NumArgMembers=*/4,
17770 /*HasCustomParsing=*/0,
17771 /*AcceptsExprPack=*/0,
17772 /*IsTargetSpecific=*/0,
17773 /*IsType=*/0,
17774 /*IsStmt=*/0,
17775 /*IsKnownToGCC=*/0,
17776 /*IsSupportedByPragmaAttribute=*/1,
17777 /*Spellings=*/VTablePointerAuthenticationSpellings,
17778 /*ArgNames=*/VTablePointerAuthenticationArgNames) {}
17779bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17780 if (!isa<CXXRecordDecl>(Val: D)) {
17781 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
17782 << Attr << Attr.isRegularKeywordAttribute() << "classes";
17783 return false;
17784 }
17785 return true;
17786}
17787
17788bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17789 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17790 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17791 return false;
17792}
17793
17794void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
17795 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
17796}
17797
17798bool isParamExpr(size_t N) const override {
17799 return false;
17800}
17801
17802static const ParsedAttrInfoVTablePointerAuthentication Instance;
17803};
17804const ParsedAttrInfoVTablePointerAuthentication ParsedAttrInfoVTablePointerAuthentication::Instance;
17805static constexpr ParsedAttrInfo::Spelling VecReturnSpellings[] = {
17806 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "vecreturn"},
17807 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::vecreturn"},
17808};
17809struct ParsedAttrInfoVecReturn final : public ParsedAttrInfo {
17810 constexpr ParsedAttrInfoVecReturn() : ParsedAttrInfo(
17811 /*AttrKind=*/ParsedAttr::AT_VecReturn,
17812 /*NumArgs=*/0,
17813 /*OptArgs=*/0,
17814 /*NumArgMembers=*/0,
17815 /*HasCustomParsing=*/0,
17816 /*AcceptsExprPack=*/0,
17817 /*IsTargetSpecific=*/0,
17818 /*IsType=*/0,
17819 /*IsStmt=*/0,
17820 /*IsKnownToGCC=*/0,
17821 /*IsSupportedByPragmaAttribute=*/1,
17822 /*Spellings=*/VecReturnSpellings,
17823 /*ArgNames=*/{}) {}
17824bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17825 if (!isa<CXXRecordDecl>(Val: D)) {
17826 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
17827 << Attr << Attr.isRegularKeywordAttribute() << "classes";
17828 return false;
17829 }
17830 return true;
17831}
17832
17833bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17834 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17835 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17836 return false;
17837}
17838
17839void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
17840 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
17841}
17842
17843bool isParamExpr(size_t N) const override {
17844 return false;
17845}
17846
17847static const ParsedAttrInfoVecReturn Instance;
17848};
17849const ParsedAttrInfoVecReturn ParsedAttrInfoVecReturn::Instance;
17850static constexpr ParsedAttrInfo::Spelling VecTypeHintSpellings[] = {
17851 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "vec_type_hint"},
17852};
17853static constexpr const char *VecTypeHintArgNames[] = {
17854"TypeHint",};
17855struct ParsedAttrInfoVecTypeHint final : public ParsedAttrInfo {
17856 constexpr ParsedAttrInfoVecTypeHint() : ParsedAttrInfo(
17857 /*AttrKind=*/ParsedAttr::AT_VecTypeHint,
17858 /*NumArgs=*/1,
17859 /*OptArgs=*/0,
17860 /*NumArgMembers=*/1,
17861 /*HasCustomParsing=*/0,
17862 /*AcceptsExprPack=*/0,
17863 /*IsTargetSpecific=*/0,
17864 /*IsType=*/0,
17865 /*IsStmt=*/0,
17866 /*IsKnownToGCC=*/0,
17867 /*IsSupportedByPragmaAttribute=*/1,
17868 /*Spellings=*/VecTypeHintSpellings,
17869 /*ArgNames=*/VecTypeHintArgNames) {}
17870bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
17871 if (!isa<FunctionDecl>(Val: D)) {
17872 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
17873 << Attr << Attr.isRegularKeywordAttribute() << "functions";
17874 return false;
17875 }
17876 return true;
17877}
17878
17879bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
17880 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
17881 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
17882 return false;
17883}
17884
17885void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
17886 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
17887}
17888
17889bool isParamExpr(size_t N) const override {
17890 return false;
17891}
17892
17893static const ParsedAttrInfoVecTypeHint Instance;
17894};
17895const ParsedAttrInfoVecTypeHint ParsedAttrInfoVecTypeHint::Instance;
17896static constexpr ParsedAttrInfo::Spelling VectorCallSpellings[] = {
17897 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "vectorcall"},
17898 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::vectorcall"},
17899 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::vectorcall"},
17900 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__vectorcall"},
17901 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "_vectorcall"},
17902};
17903struct ParsedAttrInfoVectorCall final : public ParsedAttrInfo {
17904 constexpr ParsedAttrInfoVectorCall() : ParsedAttrInfo(
17905 /*AttrKind=*/ParsedAttr::AT_VectorCall,
17906 /*NumArgs=*/0,
17907 /*OptArgs=*/0,
17908 /*NumArgMembers=*/0,
17909 /*HasCustomParsing=*/0,
17910 /*AcceptsExprPack=*/0,
17911 /*IsTargetSpecific=*/0,
17912 /*IsType=*/1,
17913 /*IsStmt=*/0,
17914 /*IsKnownToGCC=*/0,
17915 /*IsSupportedByPragmaAttribute=*/0,
17916 /*Spellings=*/VectorCallSpellings,
17917 /*ArgNames=*/{}) {}
17918bool isParamExpr(size_t N) const override {
17919 return false;
17920}
17921
17922static const ParsedAttrInfoVectorCall Instance;
17923};
17924const ParsedAttrInfoVectorCall ParsedAttrInfoVectorCall::Instance;
17925static constexpr ParsedAttrInfo::Spelling VectorSizeSpellings[] = {
17926 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "vector_size"},
17927 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::vector_size"},
17928 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::vector_size"},
17929};
17930static constexpr const char *VectorSizeArgNames[] = {
17931"NumBytes",};
17932struct ParsedAttrInfoVectorSize final : public ParsedAttrInfo {
17933 constexpr ParsedAttrInfoVectorSize() : ParsedAttrInfo(
17934 /*AttrKind=*/ParsedAttr::AT_VectorSize,
17935 /*NumArgs=*/1,
17936 /*OptArgs=*/0,
17937 /*NumArgMembers=*/1,
17938 /*HasCustomParsing=*/0,
17939 /*AcceptsExprPack=*/0,
17940 /*IsTargetSpecific=*/0,
17941 /*IsType=*/1,
17942 /*IsStmt=*/0,
17943 /*IsKnownToGCC=*/1,
17944 /*IsSupportedByPragmaAttribute=*/0,
17945 /*Spellings=*/VectorSizeSpellings,
17946 /*ArgNames=*/VectorSizeArgNames) {}
17947bool isParamExpr(size_t N) const override {
17948 return (N == 0) || false;
17949}
17950
17951static const ParsedAttrInfoVectorSize Instance;
17952};
17953const ParsedAttrInfoVectorSize ParsedAttrInfoVectorSize::Instance;
17954static constexpr ParsedAttrInfo::Spelling VisibilitySpellings[] = {
17955 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "visibility"},
17956 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::visibility"},
17957 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::visibility"},
17958};
17959static constexpr const char *VisibilityArgNames[] = {
17960"Visibility",};
17961struct ParsedAttrInfoVisibility final : public ParsedAttrInfo {
17962 constexpr ParsedAttrInfoVisibility() : ParsedAttrInfo(
17963 /*AttrKind=*/ParsedAttr::AT_Visibility,
17964 /*NumArgs=*/1,
17965 /*OptArgs=*/0,
17966 /*NumArgMembers=*/1,
17967 /*HasCustomParsing=*/0,
17968 /*AcceptsExprPack=*/0,
17969 /*IsTargetSpecific=*/0,
17970 /*IsType=*/0,
17971 /*IsStmt=*/0,
17972 /*IsKnownToGCC=*/1,
17973 /*IsSupportedByPragmaAttribute=*/0,
17974 /*Spellings=*/VisibilitySpellings,
17975 /*ArgNames=*/VisibilityArgNames) {}
17976bool isParamExpr(size_t N) const override {
17977 return false;
17978}
17979
17980static const ParsedAttrInfoVisibility Instance;
17981};
17982const ParsedAttrInfoVisibility ParsedAttrInfoVisibility::Instance;
17983static constexpr ParsedAttrInfo::Spelling WarnUnusedSpellings[] = {
17984 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "warn_unused"},
17985 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::warn_unused"},
17986 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::warn_unused"},
17987};
17988struct ParsedAttrInfoWarnUnused final : public ParsedAttrInfo {
17989 constexpr ParsedAttrInfoWarnUnused() : ParsedAttrInfo(
17990 /*AttrKind=*/ParsedAttr::AT_WarnUnused,
17991 /*NumArgs=*/0,
17992 /*OptArgs=*/0,
17993 /*NumArgMembers=*/0,
17994 /*HasCustomParsing=*/0,
17995 /*AcceptsExprPack=*/0,
17996 /*IsTargetSpecific=*/0,
17997 /*IsType=*/0,
17998 /*IsStmt=*/0,
17999 /*IsKnownToGCC=*/1,
18000 /*IsSupportedByPragmaAttribute=*/1,
18001 /*Spellings=*/WarnUnusedSpellings,
18002 /*ArgNames=*/{}) {}
18003bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18004 if (!isa<RecordDecl>(Val: D)) {
18005 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
18006 << Attr << Attr.isRegularKeywordAttribute() << "structs, unions, and classes";
18007 return false;
18008 }
18009 return true;
18010}
18011
18012bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18013 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18014 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18015 return false;
18016}
18017
18018void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18019 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
18020}
18021
18022AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
18023 D->addAttr(A: ::new (S.Context) WarnUnusedAttr(S.Context, Attr));
18024 return AttributeApplied;
18025}
18026
18027bool isParamExpr(size_t N) const override {
18028 return false;
18029}
18030
18031static const ParsedAttrInfoWarnUnused Instance;
18032};
18033const ParsedAttrInfoWarnUnused ParsedAttrInfoWarnUnused::Instance;
18034static constexpr ParsedAttrInfo::Spelling WarnUnusedResultSpellings[] = {
18035 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "nodiscard"},
18036 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "nodiscard"},
18037 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::warn_unused_result"},
18038 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "warn_unused_result"},
18039 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::warn_unused_result"},
18040 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::warn_unused_result"},
18041};
18042static constexpr const char *WarnUnusedResultArgNames[] = {
18043"Message",};
18044struct ParsedAttrInfoWarnUnusedResult final : public ParsedAttrInfo {
18045 constexpr ParsedAttrInfoWarnUnusedResult() : ParsedAttrInfo(
18046 /*AttrKind=*/ParsedAttr::AT_WarnUnusedResult,
18047 /*NumArgs=*/0,
18048 /*OptArgs=*/1,
18049 /*NumArgMembers=*/1,
18050 /*HasCustomParsing=*/0,
18051 /*AcceptsExprPack=*/0,
18052 /*IsTargetSpecific=*/0,
18053 /*IsType=*/0,
18054 /*IsStmt=*/0,
18055 /*IsKnownToGCC=*/1,
18056 /*IsSupportedByPragmaAttribute=*/1,
18057 /*Spellings=*/WarnUnusedResultSpellings,
18058 /*ArgNames=*/WarnUnusedResultArgNames) {}
18059bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18060 if (!isa<ObjCMethodDecl>(Val: D) && !isa<EnumDecl>(Val: D) && !isa<RecordDecl>(Val: D) && !isFunctionLike(D) && !isa<TypedefNameDecl>(Val: D)) {
18061 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
18062 << Attr << Attr.isRegularKeywordAttribute() << "Objective-C methods, enums, structs, unions, classes, functions, function pointers, and typedefs";
18063 return false;
18064 }
18065 return true;
18066}
18067
18068bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18069 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18070 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18071 return false;
18072}
18073
18074unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
18075 enum Spelling {
18076 CXX11_nodiscard = 0,
18077 C23_nodiscard = 1,
18078 CXX11_clang_warn_unused_result = 2,
18079 GNU_warn_unused_result = 3,
18080 CXX11_gnu_warn_unused_result = 4,
18081 C23_gnu_warn_unused_result = 5,
18082 SpellingNotCalculated = 15
18083
18084 };
18085
18086 unsigned Idx = Attr.getAttributeSpellingListIndex();
18087 switch (Idx) {
18088 default: llvm_unreachable("Unknown spelling list index");
18089 case 0: return CXX11_nodiscard;
18090 case 1: return C23_nodiscard;
18091 case 2: return CXX11_clang_warn_unused_result;
18092 case 3: return GNU_warn_unused_result;
18093 case 4: return CXX11_gnu_warn_unused_result;
18094 case 5: return C23_gnu_warn_unused_result;
18095 }
18096}
18097
18098void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18099 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
18100 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_enum, /*IsSupported=*/y: true));
18101 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
18102 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_hasType_functionType, /*IsSupported=*/y: true));
18103 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_type_alias, /*IsSupported=*/y: true));
18104}
18105
18106bool isParamExpr(size_t N) const override {
18107 return false;
18108}
18109
18110static const ParsedAttrInfoWarnUnusedResult Instance;
18111};
18112const ParsedAttrInfoWarnUnusedResult ParsedAttrInfoWarnUnusedResult::Instance;
18113static constexpr ParsedAttrInfo::Spelling WeakSpellings[] = {
18114 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "weak"},
18115 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::weak"},
18116 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::weak"},
18117};
18118struct ParsedAttrInfoWeak final : public ParsedAttrInfo {
18119 constexpr ParsedAttrInfoWeak() : ParsedAttrInfo(
18120 /*AttrKind=*/ParsedAttr::AT_Weak,
18121 /*NumArgs=*/0,
18122 /*OptArgs=*/0,
18123 /*NumArgMembers=*/0,
18124 /*HasCustomParsing=*/0,
18125 /*AcceptsExprPack=*/0,
18126 /*IsTargetSpecific=*/0,
18127 /*IsType=*/0,
18128 /*IsStmt=*/0,
18129 /*IsKnownToGCC=*/1,
18130 /*IsSupportedByPragmaAttribute=*/1,
18131 /*Spellings=*/WeakSpellings,
18132 /*ArgNames=*/{}) {}
18133bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18134 if (!isa<VarDecl>(Val: D) && !isa<FunctionDecl>(Val: D) && !isa<CXXRecordDecl>(Val: D)) {
18135 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
18136 << Attr << Attr.isRegularKeywordAttribute() << "variables, functions, and classes";
18137 return false;
18138 }
18139 return true;
18140}
18141
18142bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18143 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18144 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18145 return false;
18146}
18147
18148void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18149 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
18150 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
18151 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_record, /*IsSupported=*/y: true));
18152}
18153
18154AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
18155 D->addAttr(A: ::new (S.Context) WeakAttr(S.Context, Attr));
18156 return AttributeApplied;
18157}
18158
18159bool isParamExpr(size_t N) const override {
18160 return false;
18161}
18162
18163static const ParsedAttrInfoWeak Instance;
18164};
18165const ParsedAttrInfoWeak ParsedAttrInfoWeak::Instance;
18166static constexpr ParsedAttrInfo::Spelling WeakImportSpellings[] = {
18167 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "weak_import"},
18168 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::weak_import"},
18169 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::weak_import"},
18170};
18171struct ParsedAttrInfoWeakImport final : public ParsedAttrInfo {
18172 constexpr ParsedAttrInfoWeakImport() : ParsedAttrInfo(
18173 /*AttrKind=*/ParsedAttr::AT_WeakImport,
18174 /*NumArgs=*/0,
18175 /*OptArgs=*/0,
18176 /*NumArgMembers=*/0,
18177 /*HasCustomParsing=*/0,
18178 /*AcceptsExprPack=*/0,
18179 /*IsTargetSpecific=*/0,
18180 /*IsType=*/0,
18181 /*IsStmt=*/0,
18182 /*IsKnownToGCC=*/0,
18183 /*IsSupportedByPragmaAttribute=*/0,
18184 /*Spellings=*/WeakImportSpellings,
18185 /*ArgNames=*/{}) {}
18186bool isParamExpr(size_t N) const override {
18187 return false;
18188}
18189
18190static const ParsedAttrInfoWeakImport Instance;
18191};
18192const ParsedAttrInfoWeakImport ParsedAttrInfoWeakImport::Instance;
18193static constexpr ParsedAttrInfo::Spelling WeakRefSpellings[] = {
18194 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "weakref"},
18195 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::weakref"},
18196 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::weakref"},
18197};
18198static constexpr const char *WeakRefArgNames[] = {
18199"Aliasee",};
18200struct ParsedAttrInfoWeakRef final : public ParsedAttrInfo {
18201 constexpr ParsedAttrInfoWeakRef() : ParsedAttrInfo(
18202 /*AttrKind=*/ParsedAttr::AT_WeakRef,
18203 /*NumArgs=*/0,
18204 /*OptArgs=*/1,
18205 /*NumArgMembers=*/1,
18206 /*HasCustomParsing=*/0,
18207 /*AcceptsExprPack=*/0,
18208 /*IsTargetSpecific=*/0,
18209 /*IsType=*/0,
18210 /*IsStmt=*/0,
18211 /*IsKnownToGCC=*/1,
18212 /*IsSupportedByPragmaAttribute=*/1,
18213 /*Spellings=*/WeakRefSpellings,
18214 /*ArgNames=*/WeakRefArgNames) {}
18215bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18216 if (!isa<VarDecl>(Val: D) && !isa<FunctionDecl>(Val: D)) {
18217 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
18218 << Attr << Attr.isRegularKeywordAttribute() << "variables and functions";
18219 return false;
18220 }
18221 return true;
18222}
18223
18224bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18225 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18226 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18227 return false;
18228}
18229
18230void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18231 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_variable, /*IsSupported=*/y: true));
18232 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
18233}
18234
18235bool isParamExpr(size_t N) const override {
18236 return false;
18237}
18238
18239static const ParsedAttrInfoWeakRef Instance;
18240};
18241const ParsedAttrInfoWeakRef ParsedAttrInfoWeakRef::Instance;
18242static constexpr ParsedAttrInfo::Spelling WebAssemblyExportNameSpellings[] = {
18243 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "export_name"},
18244 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::export_name"},
18245 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::export_name"},
18246};
18247static constexpr const char *WebAssemblyExportNameArgNames[] = {
18248"ExportName",};
18249struct ParsedAttrInfoWebAssemblyExportName final : public ParsedAttrInfo {
18250 constexpr ParsedAttrInfoWebAssemblyExportName() : ParsedAttrInfo(
18251 /*AttrKind=*/ParsedAttr::AT_WebAssemblyExportName,
18252 /*NumArgs=*/1,
18253 /*OptArgs=*/0,
18254 /*NumArgMembers=*/1,
18255 /*HasCustomParsing=*/0,
18256 /*AcceptsExprPack=*/0,
18257 /*IsTargetSpecific=*/1,
18258 /*IsType=*/0,
18259 /*IsStmt=*/0,
18260 /*IsKnownToGCC=*/0,
18261 /*IsSupportedByPragmaAttribute=*/1,
18262 /*Spellings=*/WebAssemblyExportNameSpellings,
18263 /*ArgNames=*/WebAssemblyExportNameArgNames) {}
18264bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18265 if (!isa<FunctionDecl>(Val: D)) {
18266 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
18267 << Attr << Attr.isRegularKeywordAttribute() << "functions";
18268 return false;
18269 }
18270 return true;
18271}
18272
18273bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18274 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18275 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18276 return false;
18277}
18278
18279bool existsInTarget(const TargetInfo &Target) const override {
18280 const llvm::Triple &T = Target.getTriple(); (void)T;
18281 return true && (T.getArch() == llvm::Triple::wasm32 || T.getArch() == llvm::Triple::wasm64);
18282}
18283
18284void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18285 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
18286}
18287
18288bool isParamExpr(size_t N) const override {
18289 return false;
18290}
18291
18292static const ParsedAttrInfoWebAssemblyExportName Instance;
18293};
18294const ParsedAttrInfoWebAssemblyExportName ParsedAttrInfoWebAssemblyExportName::Instance;
18295static constexpr ParsedAttrInfo::Spelling WebAssemblyFuncrefSpellings[] = {
18296 {.Syntax: AttributeCommonInfo::AS_Keyword, .NormalizedFullName: "__funcref"},
18297};
18298struct ParsedAttrInfoWebAssemblyFuncref final : public ParsedAttrInfo {
18299 constexpr ParsedAttrInfoWebAssemblyFuncref() : ParsedAttrInfo(
18300 /*AttrKind=*/ParsedAttr::AT_WebAssemblyFuncref,
18301 /*NumArgs=*/0,
18302 /*OptArgs=*/0,
18303 /*NumArgMembers=*/0,
18304 /*HasCustomParsing=*/0,
18305 /*AcceptsExprPack=*/0,
18306 /*IsTargetSpecific=*/1,
18307 /*IsType=*/1,
18308 /*IsStmt=*/0,
18309 /*IsKnownToGCC=*/0,
18310 /*IsSupportedByPragmaAttribute=*/0,
18311 /*Spellings=*/WebAssemblyFuncrefSpellings,
18312 /*ArgNames=*/{}) {}
18313bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18314 if (!isFunctionPointer(D)) {
18315 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
18316 << Attr << Attr.isRegularKeywordAttribute() << "functions pointers";
18317 return false;
18318 }
18319 return true;
18320}
18321
18322bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18323 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18324 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18325 return false;
18326}
18327
18328bool existsInTarget(const TargetInfo &Target) const override {
18329 const llvm::Triple &T = Target.getTriple(); (void)T;
18330 return true && (T.getArch() == llvm::Triple::wasm32 || T.getArch() == llvm::Triple::wasm64);
18331}
18332
18333bool isParamExpr(size_t N) const override {
18334 return false;
18335}
18336
18337static const ParsedAttrInfoWebAssemblyFuncref Instance;
18338};
18339const ParsedAttrInfoWebAssemblyFuncref ParsedAttrInfoWebAssemblyFuncref::Instance;
18340static constexpr ParsedAttrInfo::Spelling WebAssemblyImportModuleSpellings[] = {
18341 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "import_module"},
18342 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::import_module"},
18343 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::import_module"},
18344};
18345static constexpr const char *WebAssemblyImportModuleArgNames[] = {
18346"ImportModule",};
18347struct ParsedAttrInfoWebAssemblyImportModule final : public ParsedAttrInfo {
18348 constexpr ParsedAttrInfoWebAssemblyImportModule() : ParsedAttrInfo(
18349 /*AttrKind=*/ParsedAttr::AT_WebAssemblyImportModule,
18350 /*NumArgs=*/1,
18351 /*OptArgs=*/0,
18352 /*NumArgMembers=*/1,
18353 /*HasCustomParsing=*/0,
18354 /*AcceptsExprPack=*/0,
18355 /*IsTargetSpecific=*/1,
18356 /*IsType=*/0,
18357 /*IsStmt=*/0,
18358 /*IsKnownToGCC=*/0,
18359 /*IsSupportedByPragmaAttribute=*/1,
18360 /*Spellings=*/WebAssemblyImportModuleSpellings,
18361 /*ArgNames=*/WebAssemblyImportModuleArgNames) {}
18362bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18363 if (!isa<FunctionDecl>(Val: D)) {
18364 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
18365 << Attr << Attr.isRegularKeywordAttribute() << "functions";
18366 return false;
18367 }
18368 return true;
18369}
18370
18371bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18372 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18373 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18374 return false;
18375}
18376
18377bool existsInTarget(const TargetInfo &Target) const override {
18378 const llvm::Triple &T = Target.getTriple(); (void)T;
18379 return true && (T.getArch() == llvm::Triple::wasm32 || T.getArch() == llvm::Triple::wasm64);
18380}
18381
18382void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18383 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
18384}
18385
18386bool isParamExpr(size_t N) const override {
18387 return false;
18388}
18389
18390static const ParsedAttrInfoWebAssemblyImportModule Instance;
18391};
18392const ParsedAttrInfoWebAssemblyImportModule ParsedAttrInfoWebAssemblyImportModule::Instance;
18393static constexpr ParsedAttrInfo::Spelling WebAssemblyImportNameSpellings[] = {
18394 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "import_name"},
18395 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::import_name"},
18396 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::import_name"},
18397};
18398static constexpr const char *WebAssemblyImportNameArgNames[] = {
18399"ImportName",};
18400struct ParsedAttrInfoWebAssemblyImportName final : public ParsedAttrInfo {
18401 constexpr ParsedAttrInfoWebAssemblyImportName() : ParsedAttrInfo(
18402 /*AttrKind=*/ParsedAttr::AT_WebAssemblyImportName,
18403 /*NumArgs=*/1,
18404 /*OptArgs=*/0,
18405 /*NumArgMembers=*/1,
18406 /*HasCustomParsing=*/0,
18407 /*AcceptsExprPack=*/0,
18408 /*IsTargetSpecific=*/1,
18409 /*IsType=*/0,
18410 /*IsStmt=*/0,
18411 /*IsKnownToGCC=*/0,
18412 /*IsSupportedByPragmaAttribute=*/1,
18413 /*Spellings=*/WebAssemblyImportNameSpellings,
18414 /*ArgNames=*/WebAssemblyImportNameArgNames) {}
18415bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18416 if (!isa<FunctionDecl>(Val: D)) {
18417 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
18418 << Attr << Attr.isRegularKeywordAttribute() << "functions";
18419 return false;
18420 }
18421 return true;
18422}
18423
18424bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18425 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18426 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18427 return false;
18428}
18429
18430bool existsInTarget(const TargetInfo &Target) const override {
18431 const llvm::Triple &T = Target.getTriple(); (void)T;
18432 return true && (T.getArch() == llvm::Triple::wasm32 || T.getArch() == llvm::Triple::wasm64);
18433}
18434
18435void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18436 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
18437}
18438
18439bool isParamExpr(size_t N) const override {
18440 return false;
18441}
18442
18443static const ParsedAttrInfoWebAssemblyImportName Instance;
18444};
18445const ParsedAttrInfoWebAssemblyImportName ParsedAttrInfoWebAssemblyImportName::Instance;
18446static constexpr ParsedAttrInfo::Spelling WorkGroupSizeHintSpellings[] = {
18447 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "work_group_size_hint"},
18448};
18449static constexpr const char *WorkGroupSizeHintArgNames[] = {
18450"XDim","YDim","ZDim",};
18451struct ParsedAttrInfoWorkGroupSizeHint final : public ParsedAttrInfo {
18452 constexpr ParsedAttrInfoWorkGroupSizeHint() : ParsedAttrInfo(
18453 /*AttrKind=*/ParsedAttr::AT_WorkGroupSizeHint,
18454 /*NumArgs=*/3,
18455 /*OptArgs=*/0,
18456 /*NumArgMembers=*/3,
18457 /*HasCustomParsing=*/0,
18458 /*AcceptsExprPack=*/0,
18459 /*IsTargetSpecific=*/0,
18460 /*IsType=*/0,
18461 /*IsStmt=*/0,
18462 /*IsKnownToGCC=*/0,
18463 /*IsSupportedByPragmaAttribute=*/1,
18464 /*Spellings=*/WorkGroupSizeHintSpellings,
18465 /*ArgNames=*/WorkGroupSizeHintArgNames) {}
18466bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18467 if (!isa<FunctionDecl>(Val: D)) {
18468 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
18469 << Attr << Attr.isRegularKeywordAttribute() << "functions";
18470 return false;
18471 }
18472 return true;
18473}
18474
18475bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18476 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18477 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18478 return false;
18479}
18480
18481void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18482 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
18483}
18484
18485bool isParamExpr(size_t N) const override {
18486 return false;
18487}
18488
18489static const ParsedAttrInfoWorkGroupSizeHint Instance;
18490};
18491const ParsedAttrInfoWorkGroupSizeHint ParsedAttrInfoWorkGroupSizeHint::Instance;
18492static constexpr ParsedAttrInfo::Spelling X86ForceAlignArgPointerSpellings[] = {
18493 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "force_align_arg_pointer"},
18494 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::force_align_arg_pointer"},
18495 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::force_align_arg_pointer"},
18496};
18497struct ParsedAttrInfoX86ForceAlignArgPointer final : public ParsedAttrInfo {
18498 constexpr ParsedAttrInfoX86ForceAlignArgPointer() : ParsedAttrInfo(
18499 /*AttrKind=*/ParsedAttr::AT_X86ForceAlignArgPointer,
18500 /*NumArgs=*/0,
18501 /*OptArgs=*/0,
18502 /*NumArgMembers=*/0,
18503 /*HasCustomParsing=*/0,
18504 /*AcceptsExprPack=*/0,
18505 /*IsTargetSpecific=*/1,
18506 /*IsType=*/0,
18507 /*IsStmt=*/0,
18508 /*IsKnownToGCC=*/1,
18509 /*IsSupportedByPragmaAttribute=*/0,
18510 /*Spellings=*/X86ForceAlignArgPointerSpellings,
18511 /*ArgNames=*/{}) {}
18512bool existsInTarget(const TargetInfo &Target) const override {
18513 const llvm::Triple &T = Target.getTriple(); (void)T;
18514 return true && (T.getArch() == llvm::Triple::x86 || T.getArch() == llvm::Triple::x86_64);
18515}
18516
18517bool isParamExpr(size_t N) const override {
18518 return false;
18519}
18520
18521static const ParsedAttrInfoX86ForceAlignArgPointer Instance;
18522};
18523const ParsedAttrInfoX86ForceAlignArgPointer ParsedAttrInfoX86ForceAlignArgPointer::Instance;
18524static constexpr ParsedAttrInfo::Spelling XRayInstrumentSpellings[] = {
18525 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "xray_always_instrument"},
18526 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::xray_always_instrument"},
18527 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::xray_always_instrument"},
18528 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "xray_never_instrument"},
18529 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::xray_never_instrument"},
18530 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::xray_never_instrument"},
18531};
18532struct ParsedAttrInfoXRayInstrument final : public ParsedAttrInfo {
18533 constexpr ParsedAttrInfoXRayInstrument() : ParsedAttrInfo(
18534 /*AttrKind=*/ParsedAttr::AT_XRayInstrument,
18535 /*NumArgs=*/0,
18536 /*OptArgs=*/0,
18537 /*NumArgMembers=*/0,
18538 /*HasCustomParsing=*/0,
18539 /*AcceptsExprPack=*/0,
18540 /*IsTargetSpecific=*/0,
18541 /*IsType=*/0,
18542 /*IsStmt=*/0,
18543 /*IsKnownToGCC=*/0,
18544 /*IsSupportedByPragmaAttribute=*/1,
18545 /*Spellings=*/XRayInstrumentSpellings,
18546 /*ArgNames=*/{}) {}
18547bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18548 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
18549 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
18550 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
18551 return false;
18552 }
18553 return true;
18554}
18555
18556bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18557 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18558 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18559 return false;
18560}
18561
18562unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const override {
18563 enum Spelling {
18564 GNU_xray_always_instrument = 0,
18565 CXX11_clang_xray_always_instrument = 1,
18566 C23_clang_xray_always_instrument = 2,
18567 GNU_xray_never_instrument = 3,
18568 CXX11_clang_xray_never_instrument = 4,
18569 C23_clang_xray_never_instrument = 5,
18570 SpellingNotCalculated = 15
18571
18572 };
18573
18574 unsigned Idx = Attr.getAttributeSpellingListIndex();
18575 switch (Idx) {
18576 default: llvm_unreachable("Unknown spelling list index");
18577 case 0: return GNU_xray_always_instrument;
18578 case 1: return CXX11_clang_xray_always_instrument;
18579 case 2: return C23_clang_xray_always_instrument;
18580 case 3: return GNU_xray_never_instrument;
18581 case 4: return CXX11_clang_xray_never_instrument;
18582 case 5: return C23_clang_xray_never_instrument;
18583 }
18584}
18585
18586void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18587 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
18588 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
18589}
18590
18591AttrHandling handleDeclAttribute(Sema &S, Decl *D,const ParsedAttr &Attr) const override {
18592 D->addAttr(A: ::new (S.Context) XRayInstrumentAttr(S.Context, Attr));
18593 return AttributeApplied;
18594}
18595
18596bool isParamExpr(size_t N) const override {
18597 return false;
18598}
18599
18600static const ParsedAttrInfoXRayInstrument Instance;
18601};
18602const ParsedAttrInfoXRayInstrument ParsedAttrInfoXRayInstrument::Instance;
18603static constexpr ParsedAttrInfo::Spelling XRayLogArgsSpellings[] = {
18604 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "xray_log_args"},
18605 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "clang::xray_log_args"},
18606 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "clang::xray_log_args"},
18607};
18608static constexpr const char *XRayLogArgsArgNames[] = {
18609"ArgumentCount",};
18610struct ParsedAttrInfoXRayLogArgs final : public ParsedAttrInfo {
18611 constexpr ParsedAttrInfoXRayLogArgs() : ParsedAttrInfo(
18612 /*AttrKind=*/ParsedAttr::AT_XRayLogArgs,
18613 /*NumArgs=*/1,
18614 /*OptArgs=*/0,
18615 /*NumArgMembers=*/1,
18616 /*HasCustomParsing=*/0,
18617 /*AcceptsExprPack=*/0,
18618 /*IsTargetSpecific=*/0,
18619 /*IsType=*/0,
18620 /*IsStmt=*/0,
18621 /*IsKnownToGCC=*/0,
18622 /*IsSupportedByPragmaAttribute=*/1,
18623 /*Spellings=*/XRayLogArgsSpellings,
18624 /*ArgNames=*/XRayLogArgsArgNames) {}
18625bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18626 if (!isa<FunctionDecl>(Val: D) && !isa<ObjCMethodDecl>(Val: D)) {
18627 S.Diag(Loc: Attr.getLoc(), DiagID: diag::warn_attribute_wrong_decl_type_str)
18628 << Attr << Attr.isRegularKeywordAttribute() << "functions and Objective-C methods";
18629 return false;
18630 }
18631 return true;
18632}
18633
18634bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18635 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18636 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18637 return false;
18638}
18639
18640void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18641 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
18642 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_objc_method, /*IsSupported=*/y: LangOpts.ObjC));
18643}
18644
18645bool isParamExpr(size_t N) const override {
18646 return false;
18647}
18648
18649static const ParsedAttrInfoXRayLogArgs Instance;
18650};
18651const ParsedAttrInfoXRayLogArgs ParsedAttrInfoXRayLogArgs::Instance;
18652static constexpr ParsedAttrInfo::Spelling ZeroCallUsedRegsSpellings[] = {
18653 {.Syntax: AttributeCommonInfo::AS_GNU, .NormalizedFullName: "zero_call_used_regs"},
18654 {.Syntax: AttributeCommonInfo::AS_CXX11, .NormalizedFullName: "gnu::zero_call_used_regs"},
18655 {.Syntax: AttributeCommonInfo::AS_C23, .NormalizedFullName: "gnu::zero_call_used_regs"},
18656};
18657static constexpr const char *ZeroCallUsedRegsArgNames[] = {
18658"ZeroCallUsedRegs",};
18659struct ParsedAttrInfoZeroCallUsedRegs final : public ParsedAttrInfo {
18660 constexpr ParsedAttrInfoZeroCallUsedRegs() : ParsedAttrInfo(
18661 /*AttrKind=*/ParsedAttr::AT_ZeroCallUsedRegs,
18662 /*NumArgs=*/1,
18663 /*OptArgs=*/0,
18664 /*NumArgMembers=*/1,
18665 /*HasCustomParsing=*/0,
18666 /*AcceptsExprPack=*/0,
18667 /*IsTargetSpecific=*/0,
18668 /*IsType=*/0,
18669 /*IsStmt=*/0,
18670 /*IsKnownToGCC=*/1,
18671 /*IsSupportedByPragmaAttribute=*/1,
18672 /*Spellings=*/ZeroCallUsedRegsSpellings,
18673 /*ArgNames=*/ZeroCallUsedRegsArgNames) {}
18674bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const override {
18675 if (!isa<FunctionDecl>(Val: D)) {
18676 S.Diag(Loc: Attr.getLoc(), DiagID: diag::err_attribute_wrong_decl_type_str)
18677 << Attr << Attr.isRegularKeywordAttribute() << "functions";
18678 return false;
18679 }
18680 return true;
18681}
18682
18683bool diagAppertainsToStmt(Sema &S, const ParsedAttr &AL, const Stmt *St) const override {
18684 S.Diag(Loc: AL.getLoc(), DiagID: diag::err_decl_attribute_invalid_on_stmt)
18685 << AL << AL.isRegularKeywordAttribute() << St->getBeginLoc();
18686 return false;
18687}
18688
18689void getPragmaAttributeMatchRules(llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules, const LangOptions &LangOpts) const override {
18690 MatchRules.push_back(Elt: std::make_pair(x: attr::SubjectMatchRule_function, /*IsSupported=*/y: true));
18691}
18692
18693bool isParamExpr(size_t N) const override {
18694 return false;
18695}
18696
18697static const ParsedAttrInfoZeroCallUsedRegs Instance;
18698};
18699const ParsedAttrInfoZeroCallUsedRegs ParsedAttrInfoZeroCallUsedRegs::Instance;
18700static const ParsedAttrInfo *AttrInfoMap[] = {
18701&ParsedAttrInfoAArch64SVEPcs::Instance,
18702&ParsedAttrInfoAArch64VectorPcs::Instance,
18703&ParsedAttrInfoAMDGPUFlatWorkGroupSize::Instance,
18704&ParsedAttrInfoAMDGPUKernelCall::Instance,
18705&ParsedAttrInfoAMDGPUMaxNumWorkGroups::Instance,
18706&ParsedAttrInfoAMDGPUNumSGPR::Instance,
18707&ParsedAttrInfoAMDGPUNumVGPR::Instance,
18708&ParsedAttrInfoAMDGPUWavesPerEU::Instance,
18709&ParsedAttrInfoInterrupt::Instance,
18710&ParsedAttrInfoAVRSignal::Instance,
18711&ParsedAttrInfoAbiTag::Instance,
18712&ParsedAttrInfoAcquireCapability::Instance,
18713&ParsedAttrInfoAcquireHandle::Instance,
18714&ParsedAttrInfoAcquiredAfter::Instance,
18715&ParsedAttrInfoAcquiredBefore::Instance,
18716&ParsedAttrInfoAddressSpace::Instance,
18717&ParsedAttrInfoAlias::Instance,
18718&ParsedAttrInfoAlignValue::Instance,
18719&ParsedAttrInfoAligned::Instance,
18720&ParsedAttrInfoAllocAlign::Instance,
18721&ParsedAttrInfoAllocSize::Instance,
18722&ParsedAttrInfoAllocating::Instance,
18723&ParsedAttrInfoAlwaysDestroy::Instance,
18724&ParsedAttrInfoAlwaysInline::Instance,
18725&ParsedAttrInfoAnalyzerNoReturn::Instance,
18726&ParsedAttrInfoAnnotate::Instance,
18727&ParsedAttrInfoAnnotateType::Instance,
18728&ParsedAttrInfoAnyX86NoCallerSavedRegisters::Instance,
18729&ParsedAttrInfoAnyX86NoCfCheck::Instance,
18730&ParsedAttrInfoArcWeakrefUnavailable::Instance,
18731&ParsedAttrInfoArgumentWithTypeTag::Instance,
18732&ParsedAttrInfoArmBuiltinAlias::Instance,
18733&ParsedAttrInfoArmIn::Instance,
18734&ParsedAttrInfoArmInOut::Instance,
18735&ParsedAttrInfoArmLocallyStreaming::Instance,
18736&ParsedAttrInfoArmMveStrictPolymorphism::Instance,
18737&ParsedAttrInfoArmNew::Instance,
18738&ParsedAttrInfoArmOut::Instance,
18739&ParsedAttrInfoArmPreserves::Instance,
18740&ParsedAttrInfoArmStreaming::Instance,
18741&ParsedAttrInfoArmStreamingCompatible::Instance,
18742&ParsedAttrInfoArmSveVectorBits::Instance,
18743&ParsedAttrInfoArtificial::Instance,
18744&ParsedAttrInfoAssertCapability::Instance,
18745&ParsedAttrInfoAssertExclusiveLock::Instance,
18746&ParsedAttrInfoAssertSharedLock::Instance,
18747&ParsedAttrInfoAssumeAligned::Instance,
18748&ParsedAttrInfoAvailability::Instance,
18749&ParsedAttrInfoAvailableOnlyInDefaultEvalMethod::Instance,
18750&ParsedAttrInfoBPFPreserveAccessIndex::Instance,
18751&ParsedAttrInfoBPFPreserveStaticOffset::Instance,
18752&ParsedAttrInfoBTFDeclTag::Instance,
18753&ParsedAttrInfoBTFTypeTag::Instance,
18754&ParsedAttrInfoBlocking::Instance,
18755&ParsedAttrInfoBlocks::Instance,
18756&ParsedAttrInfoBuiltinAlias::Instance,
18757&ParsedAttrInfoCDecl::Instance,
18758&ParsedAttrInfoCFAuditedTransfer::Instance,
18759&ParsedAttrInfoCFConsumed::Instance,
18760&ParsedAttrInfoCFGuard::Instance,
18761&ParsedAttrInfoCFICanonicalJumpTable::Instance,
18762&ParsedAttrInfoCFReturnsNotRetained::Instance,
18763&ParsedAttrInfoCFReturnsRetained::Instance,
18764&ParsedAttrInfoCFUnknownTransfer::Instance,
18765&ParsedAttrInfoCPUDispatch::Instance,
18766&ParsedAttrInfoCPUSpecific::Instance,
18767&ParsedAttrInfoCUDAConstant::Instance,
18768&ParsedAttrInfoCUDADevice::Instance,
18769&ParsedAttrInfoCUDADeviceBuiltinSurfaceType::Instance,
18770&ParsedAttrInfoCUDADeviceBuiltinTextureType::Instance,
18771&ParsedAttrInfoCUDAGlobal::Instance,
18772&ParsedAttrInfoCUDAHost::Instance,
18773&ParsedAttrInfoCUDAInvalidTarget::Instance,
18774&ParsedAttrInfoCUDALaunchBounds::Instance,
18775&ParsedAttrInfoCUDAShared::Instance,
18776&ParsedAttrInfoCXX11NoReturn::Instance,
18777&ParsedAttrInfoCXXAssume::Instance,
18778&ParsedAttrInfoCallableWhen::Instance,
18779&ParsedAttrInfoCallback::Instance,
18780&ParsedAttrInfoCalledOnce::Instance,
18781&ParsedAttrInfoCapability::Instance,
18782&ParsedAttrInfoCarriesDependency::Instance,
18783&ParsedAttrInfoCleanup::Instance,
18784&ParsedAttrInfoClspvLibclcBuiltin::Instance,
18785&ParsedAttrInfoCmseNSCall::Instance,
18786&ParsedAttrInfoCmseNSEntry::Instance,
18787&ParsedAttrInfoCodeAlign::Instance,
18788&ParsedAttrInfoCodeModel::Instance,
18789&ParsedAttrInfoCodeSeg::Instance,
18790&ParsedAttrInfoCold::Instance,
18791&ParsedAttrInfoCommon::Instance,
18792&ParsedAttrInfoConst::Instance,
18793&ParsedAttrInfoConstInit::Instance,
18794&ParsedAttrInfoConstructor::Instance,
18795&ParsedAttrInfoConsumable::Instance,
18796&ParsedAttrInfoConsumableAutoCast::Instance,
18797&ParsedAttrInfoConsumableSetOnRead::Instance,
18798&ParsedAttrInfoConvergent::Instance,
18799&ParsedAttrInfoCoroDisableLifetimeBound::Instance,
18800&ParsedAttrInfoCoroLifetimeBound::Instance,
18801&ParsedAttrInfoCoroOnlyDestroyWhenComplete::Instance,
18802&ParsedAttrInfoCoroReturnType::Instance,
18803&ParsedAttrInfoCoroWrapper::Instance,
18804&ParsedAttrInfoCountedBy::Instance,
18805&ParsedAttrInfoCountedByOrNull::Instance,
18806&ParsedAttrInfoDLLExport::Instance,
18807&ParsedAttrInfoDLLExportStaticLocal::Instance,
18808&ParsedAttrInfoDLLImport::Instance,
18809&ParsedAttrInfoDLLImportStaticLocal::Instance,
18810&ParsedAttrInfoDeprecated::Instance,
18811&ParsedAttrInfoDestructor::Instance,
18812&ParsedAttrInfoDiagnoseAsBuiltin::Instance,
18813&ParsedAttrInfoDiagnoseIf::Instance,
18814&ParsedAttrInfoDisableSanitizerInstrumentation::Instance,
18815&ParsedAttrInfoDisableTailCalls::Instance,
18816&ParsedAttrInfoEmptyBases::Instance,
18817&ParsedAttrInfoEnableIf::Instance,
18818&ParsedAttrInfoEnforceTCB::Instance,
18819&ParsedAttrInfoEnforceTCBLeaf::Instance,
18820&ParsedAttrInfoEnumExtensibility::Instance,
18821&ParsedAttrInfoError::Instance,
18822&ParsedAttrInfoExcludeFromExplicitInstantiation::Instance,
18823&ParsedAttrInfoExclusiveTrylockFunction::Instance,
18824&ParsedAttrInfoExtVectorType::Instance,
18825&ParsedAttrInfoExternalSourceSymbol::Instance,
18826&ParsedAttrInfoFallThrough::Instance,
18827&ParsedAttrInfoFastCall::Instance,
18828&ParsedAttrInfoFlagEnum::Instance,
18829&ParsedAttrInfoFlatten::Instance,
18830&ParsedAttrInfoFormat::Instance,
18831&ParsedAttrInfoFormatArg::Instance,
18832&ParsedAttrInfoFunctionReturnThunks::Instance,
18833&ParsedAttrInfoGNUInline::Instance,
18834&ParsedAttrInfoGuardedBy::Instance,
18835&ParsedAttrInfoGuardedVar::Instance,
18836&ParsedAttrInfoHIPManaged::Instance,
18837&ParsedAttrInfoHLSLGroupSharedAddressSpace::Instance,
18838&ParsedAttrInfoHLSLLoopHint::Instance,
18839&ParsedAttrInfoHLSLNumThreads::Instance,
18840&ParsedAttrInfoHLSLPackOffset::Instance,
18841&ParsedAttrInfoHLSLParamModifier::Instance,
18842&ParsedAttrInfoHLSLResource::Instance,
18843&ParsedAttrInfoHLSLResourceBinding::Instance,
18844&ParsedAttrInfoHLSLResourceClass::Instance,
18845&ParsedAttrInfoHLSLSV_DispatchThreadID::Instance,
18846&ParsedAttrInfoHLSLSV_GroupIndex::Instance,
18847&ParsedAttrInfoHLSLShader::Instance,
18848&ParsedAttrInfoHot::Instance,
18849&ParsedAttrInfoHybridPatchable::Instance,
18850&ParsedAttrInfoIBAction::Instance,
18851&ParsedAttrInfoIBOutlet::Instance,
18852&ParsedAttrInfoIBOutletCollection::Instance,
18853&ParsedAttrInfoIFunc::Instance,
18854&ParsedAttrInfoInitPriority::Instance,
18855&ParsedAttrInfoIntelOclBicc::Instance,
18856&ParsedAttrInfoInternalLinkage::Instance,
18857&ParsedAttrInfoLTOVisibilityPublic::Instance,
18858&ParsedAttrInfoLayoutVersion::Instance,
18859&ParsedAttrInfoLeaf::Instance,
18860&ParsedAttrInfoLifetimeBound::Instance,
18861&ParsedAttrInfoLikely::Instance,
18862&ParsedAttrInfoLoaderUninitialized::Instance,
18863&ParsedAttrInfoLockReturned::Instance,
18864&ParsedAttrInfoLockable::Instance,
18865&ParsedAttrInfoLocksExcluded::Instance,
18866&ParsedAttrInfoLoopHint::Instance,
18867&ParsedAttrInfoM68kRTD::Instance,
18868&ParsedAttrInfoMIGServerRoutine::Instance,
18869&ParsedAttrInfoMSABI::Instance,
18870&ParsedAttrInfoMSAllocator::Instance,
18871&ParsedAttrInfoMSConstexpr::Instance,
18872&ParsedAttrInfoMSInheritance::Instance,
18873&ParsedAttrInfoMSNoVTable::Instance,
18874&ParsedAttrInfoMSStruct::Instance,
18875&ParsedAttrInfoMatrixType::Instance,
18876&ParsedAttrInfoMayAlias::Instance,
18877&ParsedAttrInfoMaybeUndef::Instance,
18878&ParsedAttrInfoMicroMips::Instance,
18879&ParsedAttrInfoMinSize::Instance,
18880&ParsedAttrInfoMinVectorWidth::Instance,
18881&ParsedAttrInfoMips16::Instance,
18882&ParsedAttrInfoMipsLongCall::Instance,
18883&ParsedAttrInfoMipsShortCall::Instance,
18884&ParsedAttrInfoMode::Instance,
18885&ParsedAttrInfoMustTail::Instance,
18886&ParsedAttrInfoNSConsumed::Instance,
18887&ParsedAttrInfoNSConsumesSelf::Instance,
18888&ParsedAttrInfoNSErrorDomain::Instance,
18889&ParsedAttrInfoNSReturnsAutoreleased::Instance,
18890&ParsedAttrInfoNSReturnsNotRetained::Instance,
18891&ParsedAttrInfoNSReturnsRetained::Instance,
18892&ParsedAttrInfoNVPTXKernel::Instance,
18893&ParsedAttrInfoNaked::Instance,
18894&ParsedAttrInfoNeonPolyVectorType::Instance,
18895&ParsedAttrInfoNeonVectorType::Instance,
18896&ParsedAttrInfoNoAlias::Instance,
18897&ParsedAttrInfoNoBuiltin::Instance,
18898&ParsedAttrInfoNoCommon::Instance,
18899&ParsedAttrInfoNoDebug::Instance,
18900&ParsedAttrInfoNoDeref::Instance,
18901&ParsedAttrInfoNoDestroy::Instance,
18902&ParsedAttrInfoNoDuplicate::Instance,
18903&ParsedAttrInfoNoEscape::Instance,
18904&ParsedAttrInfoNoInline::Instance,
18905&ParsedAttrInfoNoInstrumentFunction::Instance,
18906&ParsedAttrInfoNoMerge::Instance,
18907&ParsedAttrInfoNoMicroMips::Instance,
18908&ParsedAttrInfoNoMips16::Instance,
18909&ParsedAttrInfoNoProfileFunction::Instance,
18910&ParsedAttrInfoNoRandomizeLayout::Instance,
18911&ParsedAttrInfoNoReturn::Instance,
18912&ParsedAttrInfoNoSanitize::Instance,
18913&ParsedAttrInfoNoSanitizeSpecific::Instance,
18914&ParsedAttrInfoNoSpeculativeLoadHardening::Instance,
18915&ParsedAttrInfoNoSplitStack::Instance,
18916&ParsedAttrInfoNoStackProtector::Instance,
18917&ParsedAttrInfoNoThreadSafetyAnalysis::Instance,
18918&ParsedAttrInfoNoThrow::Instance,
18919&ParsedAttrInfoNoUniqueAddress::Instance,
18920&ParsedAttrInfoNoUwtable::Instance,
18921&ParsedAttrInfoNonAllocating::Instance,
18922&ParsedAttrInfoNonBlocking::Instance,
18923&ParsedAttrInfoNonNull::Instance,
18924&ParsedAttrInfoNotTailCalled::Instance,
18925&ParsedAttrInfoOMPAssume::Instance,
18926&ParsedAttrInfoOSConsumed::Instance,
18927&ParsedAttrInfoOSConsumesThis::Instance,
18928&ParsedAttrInfoOSReturnsNotRetained::Instance,
18929&ParsedAttrInfoOSReturnsRetained::Instance,
18930&ParsedAttrInfoOSReturnsRetainedOnNonZero::Instance,
18931&ParsedAttrInfoOSReturnsRetainedOnZero::Instance,
18932&ParsedAttrInfoObjCBoxable::Instance,
18933&ParsedAttrInfoObjCBridge::Instance,
18934&ParsedAttrInfoObjCBridgeMutable::Instance,
18935&ParsedAttrInfoObjCBridgeRelated::Instance,
18936&ParsedAttrInfoObjCClassStub::Instance,
18937&ParsedAttrInfoObjCDesignatedInitializer::Instance,
18938&ParsedAttrInfoObjCDirect::Instance,
18939&ParsedAttrInfoObjCDirectMembers::Instance,
18940&ParsedAttrInfoObjCException::Instance,
18941&ParsedAttrInfoObjCExplicitProtocolImpl::Instance,
18942&ParsedAttrInfoObjCExternallyRetained::Instance,
18943&ParsedAttrInfoObjCGC::Instance,
18944&ParsedAttrInfoObjCIndependentClass::Instance,
18945&ParsedAttrInfoObjCInertUnsafeUnretained::Instance,
18946&ParsedAttrInfoObjCKindOf::Instance,
18947&ParsedAttrInfoObjCMethodFamily::Instance,
18948&ParsedAttrInfoObjCNSObject::Instance,
18949&ParsedAttrInfoObjCNonLazyClass::Instance,
18950&ParsedAttrInfoObjCNonRuntimeProtocol::Instance,
18951&ParsedAttrInfoObjCOwnership::Instance,
18952&ParsedAttrInfoObjCPreciseLifetime::Instance,
18953&ParsedAttrInfoObjCRequiresPropertyDefs::Instance,
18954&ParsedAttrInfoObjCRequiresSuper::Instance,
18955&ParsedAttrInfoObjCReturnsInnerPointer::Instance,
18956&ParsedAttrInfoObjCRootClass::Instance,
18957&ParsedAttrInfoObjCRuntimeName::Instance,
18958&ParsedAttrInfoObjCRuntimeVisible::Instance,
18959&ParsedAttrInfoObjCSubclassingRestricted::Instance,
18960&ParsedAttrInfoOpenCLAccess::Instance,
18961&ParsedAttrInfoOpenCLConstantAddressSpace::Instance,
18962&ParsedAttrInfoOpenCLGenericAddressSpace::Instance,
18963&ParsedAttrInfoOpenCLGlobalAddressSpace::Instance,
18964&ParsedAttrInfoOpenCLGlobalDeviceAddressSpace::Instance,
18965&ParsedAttrInfoOpenCLGlobalHostAddressSpace::Instance,
18966&ParsedAttrInfoOpenCLIntelReqdSubGroupSize::Instance,
18967&ParsedAttrInfoOpenCLKernel::Instance,
18968&ParsedAttrInfoOpenCLLocalAddressSpace::Instance,
18969&ParsedAttrInfoOpenCLNoSVM::Instance,
18970&ParsedAttrInfoOpenCLPrivateAddressSpace::Instance,
18971&ParsedAttrInfoOpenCLUnrollHint::Instance,
18972&ParsedAttrInfoOptimizeNone::Instance,
18973&ParsedAttrInfoOverloadable::Instance,
18974&ParsedAttrInfoOwner::Instance,
18975&ParsedAttrInfoOwnership::Instance,
18976&ParsedAttrInfoPacked::Instance,
18977&ParsedAttrInfoParamTypestate::Instance,
18978&ParsedAttrInfoPascal::Instance,
18979&ParsedAttrInfoPassObjectSize::Instance,
18980&ParsedAttrInfoPatchableFunctionEntry::Instance,
18981&ParsedAttrInfoPcs::Instance,
18982&ParsedAttrInfoPointer::Instance,
18983&ParsedAttrInfoPragmaClangBSSSection::Instance,
18984&ParsedAttrInfoPragmaClangDataSection::Instance,
18985&ParsedAttrInfoPragmaClangRelroSection::Instance,
18986&ParsedAttrInfoPragmaClangRodataSection::Instance,
18987&ParsedAttrInfoPragmaClangTextSection::Instance,
18988&ParsedAttrInfoPreferredName::Instance,
18989&ParsedAttrInfoPreferredType::Instance,
18990&ParsedAttrInfoPreserveAll::Instance,
18991&ParsedAttrInfoPreserveMost::Instance,
18992&ParsedAttrInfoPreserveNone::Instance,
18993&ParsedAttrInfoPtGuardedBy::Instance,
18994&ParsedAttrInfoPtGuardedVar::Instance,
18995&ParsedAttrInfoPtr32::Instance,
18996&ParsedAttrInfoPtr64::Instance,
18997&ParsedAttrInfoPure::Instance,
18998&ParsedAttrInfoRISCVRVVVectorBits::Instance,
18999&ParsedAttrInfoRISCVVectorCC::Instance,
19000&ParsedAttrInfoRandomizeLayout::Instance,
19001&ParsedAttrInfoReadOnlyPlacement::Instance,
19002&ParsedAttrInfoRegCall::Instance,
19003&ParsedAttrInfoRegparm::Instance,
19004&ParsedAttrInfoReinitializes::Instance,
19005&ParsedAttrInfoReleaseCapability::Instance,
19006&ParsedAttrInfoReleaseHandle::Instance,
19007&ParsedAttrInfoRenderScriptKernel::Instance,
19008&ParsedAttrInfoReqdWorkGroupSize::Instance,
19009&ParsedAttrInfoRequiresCapability::Instance,
19010&ParsedAttrInfoRestrict::Instance,
19011&ParsedAttrInfoRetain::Instance,
19012&ParsedAttrInfoReturnTypestate::Instance,
19013&ParsedAttrInfoReturnsNonNull::Instance,
19014&ParsedAttrInfoReturnsTwice::Instance,
19015&ParsedAttrInfoSPtr::Instance,
19016&ParsedAttrInfoSYCLKernel::Instance,
19017&ParsedAttrInfoSYCLSpecialClass::Instance,
19018&ParsedAttrInfoScopedLockable::Instance,
19019&ParsedAttrInfoSection::Instance,
19020&ParsedAttrInfoSelectAny::Instance,
19021&ParsedAttrInfoSentinel::Instance,
19022&ParsedAttrInfoSetTypestate::Instance,
19023&ParsedAttrInfoSharedTrylockFunction::Instance,
19024&ParsedAttrInfoSizedBy::Instance,
19025&ParsedAttrInfoSizedByOrNull::Instance,
19026&ParsedAttrInfoSpeculativeLoadHardening::Instance,
19027&ParsedAttrInfoStandaloneDebug::Instance,
19028&ParsedAttrInfoStdCall::Instance,
19029&ParsedAttrInfoStrictFP::Instance,
19030&ParsedAttrInfoStrictGuardStackCheck::Instance,
19031&ParsedAttrInfoSuppress::Instance,
19032&ParsedAttrInfoSwiftAsync::Instance,
19033&ParsedAttrInfoSwiftAsyncCall::Instance,
19034&ParsedAttrInfoSwiftAsyncContext::Instance,
19035&ParsedAttrInfoSwiftAsyncError::Instance,
19036&ParsedAttrInfoSwiftAsyncName::Instance,
19037&ParsedAttrInfoSwiftAttr::Instance,
19038&ParsedAttrInfoSwiftBridge::Instance,
19039&ParsedAttrInfoSwiftBridgedTypedef::Instance,
19040&ParsedAttrInfoSwiftCall::Instance,
19041&ParsedAttrInfoSwiftContext::Instance,
19042&ParsedAttrInfoSwiftError::Instance,
19043&ParsedAttrInfoSwiftErrorResult::Instance,
19044&ParsedAttrInfoSwiftIndirectResult::Instance,
19045&ParsedAttrInfoSwiftName::Instance,
19046&ParsedAttrInfoSwiftNewType::Instance,
19047&ParsedAttrInfoSwiftObjCMembers::Instance,
19048&ParsedAttrInfoSwiftPrivate::Instance,
19049&ParsedAttrInfoSysVABI::Instance,
19050&ParsedAttrInfoTLSModel::Instance,
19051&ParsedAttrInfoTarget::Instance,
19052&ParsedAttrInfoTargetClones::Instance,
19053&ParsedAttrInfoTargetVersion::Instance,
19054&ParsedAttrInfoTestTypestate::Instance,
19055&ParsedAttrInfoThisCall::Instance,
19056&ParsedAttrInfoThread::Instance,
19057&ParsedAttrInfoTransparentUnion::Instance,
19058&ParsedAttrInfoTrivialABI::Instance,
19059&ParsedAttrInfoTryAcquireCapability::Instance,
19060&ParsedAttrInfoTypeNonNull::Instance,
19061&ParsedAttrInfoTypeNullUnspecified::Instance,
19062&ParsedAttrInfoTypeNullable::Instance,
19063&ParsedAttrInfoTypeNullableResult::Instance,
19064&ParsedAttrInfoTypeTagForDatatype::Instance,
19065&ParsedAttrInfoTypeVisibility::Instance,
19066&ParsedAttrInfoUPtr::Instance,
19067&ParsedAttrInfoUnavailable::Instance,
19068&ParsedAttrInfoUninitialized::Instance,
19069&ParsedAttrInfoUnlikely::Instance,
19070&ParsedAttrInfoUnsafeBufferUsage::Instance,
19071&ParsedAttrInfoUnused::Instance,
19072&ParsedAttrInfoUseHandle::Instance,
19073&ParsedAttrInfoUsed::Instance,
19074&ParsedAttrInfoUsingIfExists::Instance,
19075&ParsedAttrInfoUuid::Instance,
19076&ParsedAttrInfoVTablePointerAuthentication::Instance,
19077&ParsedAttrInfoVecReturn::Instance,
19078&ParsedAttrInfoVecTypeHint::Instance,
19079&ParsedAttrInfoVectorCall::Instance,
19080&ParsedAttrInfoVectorSize::Instance,
19081&ParsedAttrInfoVisibility::Instance,
19082&ParsedAttrInfoWarnUnused::Instance,
19083&ParsedAttrInfoWarnUnusedResult::Instance,
19084&ParsedAttrInfoWeak::Instance,
19085&ParsedAttrInfoWeakImport::Instance,
19086&ParsedAttrInfoWeakRef::Instance,
19087&ParsedAttrInfoWebAssemblyExportName::Instance,
19088&ParsedAttrInfoWebAssemblyFuncref::Instance,
19089&ParsedAttrInfoWebAssemblyImportModule::Instance,
19090&ParsedAttrInfoWebAssemblyImportName::Instance,
19091&ParsedAttrInfoWorkGroupSizeHint::Instance,
19092&ParsedAttrInfoX86ForceAlignArgPointer::Instance,
19093&ParsedAttrInfoXRayInstrument::Instance,
19094&ParsedAttrInfoXRayLogArgs::Instance,
19095&ParsedAttrInfoZeroCallUsedRegs::Instance,
19096};
19097
19098static void handleAttrWithDelayedArgs(Sema &S, Decl *D, const ParsedAttr &Attr) {
19099 SmallVector<Expr *, 4> ArgExprs;
19100 ArgExprs.reserve(N: Attr.getNumArgs());
19101 for (unsigned I = 0; I < Attr.getNumArgs(); ++I) {
19102 assert(!Attr.isArgIdent(I));
19103 ArgExprs.push_back(Elt: Attr.getArgAsExpr(Arg: I));
19104 }
19105 clang::Attr *CreatedAttr = nullptr;
19106 switch (Attr.getKind()) {
19107 default:
19108 llvm_unreachable("Attribute cannot hold delayed arguments.");
19109 case ParsedAttr::AT_Annotate: {
19110 CreatedAttr = AnnotateAttr::CreateWithDelayedArgs(Ctx&: S.Context, DelayedArgs: ArgExprs.data(), DelayedArgsSize: ArgExprs.size(), CommonInfo: Attr);
19111 break;
19112 }
19113 case ParsedAttr::AT_AnnotateType: {
19114 CreatedAttr = AnnotateTypeAttr::CreateWithDelayedArgs(Ctx&: S.Context, DelayedArgs: ArgExprs.data(), DelayedArgsSize: ArgExprs.size(), CommonInfo: Attr);
19115 break;
19116 }
19117 }
19118 D->addAttr(A: CreatedAttr);
19119}
19120
19121static bool checkAttributeMatchRuleAppliesTo(const Decl *D, attr::SubjectMatchRule rule) {
19122 switch (rule) {
19123 case attr::SubjectMatchRule_block:
19124 return isa<BlockDecl>(Val: D);
19125 case attr::SubjectMatchRule_enum:
19126 return isa<EnumDecl>(Val: D);
19127 case attr::SubjectMatchRule_enum_constant:
19128 return isa<EnumConstantDecl>(Val: D);
19129 case attr::SubjectMatchRule_field:
19130 return isa<FieldDecl>(Val: D);
19131 case attr::SubjectMatchRule_function:
19132 return isa<FunctionDecl>(Val: D);
19133 case attr::SubjectMatchRule_function_is_member:
19134 return isa<CXXMethodDecl>(Val: D);
19135 case attr::SubjectMatchRule_namespace:
19136 return isa<NamespaceDecl>(Val: D);
19137 case attr::SubjectMatchRule_objc_category:
19138 return isa<ObjCCategoryDecl>(Val: D);
19139 case attr::SubjectMatchRule_objc_implementation:
19140 return isa<ObjCImplDecl>(Val: D);
19141 case attr::SubjectMatchRule_objc_interface:
19142 return isa<ObjCInterfaceDecl>(Val: D);
19143 case attr::SubjectMatchRule_objc_method:
19144 return isa<ObjCMethodDecl>(Val: D);
19145 case attr::SubjectMatchRule_objc_method_is_instance:
19146 return isObjCInstanceMethod(D);
19147 case attr::SubjectMatchRule_objc_property:
19148 return isa<ObjCPropertyDecl>(Val: D);
19149 case attr::SubjectMatchRule_objc_protocol:
19150 return isa<ObjCProtocolDecl>(Val: D);
19151 case attr::SubjectMatchRule_record:
19152 return isa<RecordDecl>(Val: D) || isa<CXXRecordDecl>(Val: D);
19153 case attr::SubjectMatchRule_record_not_is_union:
19154 return isStruct(D);
19155 case attr::SubjectMatchRule_hasType_abstract:
19156 assert(false && "Abstract matcher rule isn't allowed");
19157 return false;
19158 case attr::SubjectMatchRule_hasType_functionType:
19159 return isFunctionLike(D);
19160 case attr::SubjectMatchRule_type_alias:
19161 return isa<TypedefNameDecl>(Val: D);
19162 case attr::SubjectMatchRule_variable:
19163 return isa<VarDecl>(Val: D);
19164 case attr::SubjectMatchRule_variable_is_thread_local:
19165 return isTLSVar(D);
19166 case attr::SubjectMatchRule_variable_is_global:
19167 return isGlobalVar(D);
19168 case attr::SubjectMatchRule_variable_is_local:
19169 return isLocalVar(D);
19170 case attr::SubjectMatchRule_variable_is_parameter:
19171 return isa<ParmVarDecl>(Val: D);
19172 case attr::SubjectMatchRule_variable_not_is_parameter:
19173 return isNonParmVar(D);
19174 }
19175 llvm_unreachable("Invalid match rule");
19176return false;
19177}
19178
19179#elif defined(WANT_DECL_MERGE_LOGIC)
19180
19181static bool DiagnoseMutualExclusions(Sema &S, const NamedDecl *D, const Attr *A) {
19182 if (const auto *Second = dyn_cast<AlwaysDestroyAttr>(A)) {
19183 if (const auto *First = D->getAttr<NoDestroyAttr>()) {
19184 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19185 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19186 return false;
19187 }
19188 return true;
19189 }
19190 if (const auto *Second = dyn_cast<AlwaysInlineAttr>(A)) {
19191 if (const auto *First = D->getAttr<NotTailCalledAttr>()) {
19192 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19193 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19194 return false;
19195 }
19196 return true;
19197 }
19198 if (const auto *Second = dyn_cast<CFAuditedTransferAttr>(A)) {
19199 if (const auto *First = D->getAttr<CFUnknownTransferAttr>()) {
19200 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19201 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19202 return false;
19203 }
19204 return true;
19205 }
19206 if (const auto *Second = dyn_cast<CFUnknownTransferAttr>(A)) {
19207 if (const auto *First = D->getAttr<CFAuditedTransferAttr>()) {
19208 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19209 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19210 return false;
19211 }
19212 return true;
19213 }
19214 if (const auto *Second = dyn_cast<CPUDispatchAttr>(A)) {
19215 if (const auto *First = D->getAttr<TargetClonesAttr>()) {
19216 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19217 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19218 return false;
19219 }
19220 if (const auto *First = D->getAttr<TargetVersionAttr>()) {
19221 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19222 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19223 return false;
19224 }
19225 if (const auto *First = D->getAttr<TargetAttr>()) {
19226 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19227 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19228 return false;
19229 }
19230 if (const auto *First = D->getAttr<CPUSpecificAttr>()) {
19231 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19232 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19233 return false;
19234 }
19235 return true;
19236 }
19237 if (const auto *Second = dyn_cast<CPUSpecificAttr>(A)) {
19238 if (const auto *First = D->getAttr<TargetClonesAttr>()) {
19239 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19240 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19241 return false;
19242 }
19243 if (const auto *First = D->getAttr<TargetVersionAttr>()) {
19244 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19245 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19246 return false;
19247 }
19248 if (const auto *First = D->getAttr<TargetAttr>()) {
19249 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19250 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19251 return false;
19252 }
19253 if (const auto *First = D->getAttr<CPUDispatchAttr>()) {
19254 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19255 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19256 return false;
19257 }
19258 return true;
19259 }
19260 if (const auto *Second = dyn_cast<CUDAConstantAttr>(A)) {
19261 if (const auto *First = D->getAttr<CUDASharedAttr>()) {
19262 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19263 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19264 return false;
19265 }
19266 if (const auto *First = D->getAttr<HIPManagedAttr>()) {
19267 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19268 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19269 return false;
19270 }
19271 return true;
19272 }
19273 if (const auto *Second = dyn_cast<CUDADeviceAttr>(A)) {
19274 if (const auto *First = D->getAttr<CUDAGlobalAttr>()) {
19275 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19276 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19277 return false;
19278 }
19279 return true;
19280 }
19281 if (const auto *Second = dyn_cast<CUDADeviceBuiltinSurfaceTypeAttr>(A)) {
19282 if (const auto *First = D->getAttr<CUDADeviceBuiltinTextureTypeAttr>()) {
19283 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19284 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19285 return false;
19286 }
19287 return true;
19288 }
19289 if (const auto *Second = dyn_cast<CUDADeviceBuiltinTextureTypeAttr>(A)) {
19290 if (const auto *First = D->getAttr<CUDADeviceBuiltinSurfaceTypeAttr>()) {
19291 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19292 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19293 return false;
19294 }
19295 return true;
19296 }
19297 if (const auto *Second = dyn_cast<CUDAGlobalAttr>(A)) {
19298 if (const auto *First = D->getAttr<CUDADeviceAttr>()) {
19299 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19300 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19301 return false;
19302 }
19303 if (const auto *First = D->getAttr<CUDAHostAttr>()) {
19304 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19305 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19306 return false;
19307 }
19308 return true;
19309 }
19310 if (const auto *Second = dyn_cast<CUDAHostAttr>(A)) {
19311 if (const auto *First = D->getAttr<CUDAGlobalAttr>()) {
19312 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19313 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19314 return false;
19315 }
19316 return true;
19317 }
19318 if (const auto *Second = dyn_cast<CUDASharedAttr>(A)) {
19319 if (const auto *First = D->getAttr<CUDAConstantAttr>()) {
19320 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19321 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19322 return false;
19323 }
19324 if (const auto *First = D->getAttr<HIPManagedAttr>()) {
19325 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19326 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19327 return false;
19328 }
19329 return true;
19330 }
19331 if (const auto *Second = dyn_cast<ColdAttr>(A)) {
19332 if (const auto *First = D->getAttr<HotAttr>()) {
19333 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19334 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19335 return false;
19336 }
19337 return true;
19338 }
19339 if (const auto *Second = dyn_cast<CommonAttr>(A)) {
19340 if (const auto *First = D->getAttr<InternalLinkageAttr>()) {
19341 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19342 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19343 return false;
19344 }
19345 return true;
19346 }
19347 if (const auto *Second = dyn_cast<DisableTailCallsAttr>(A)) {
19348 if (const auto *First = D->getAttr<NakedAttr>()) {
19349 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19350 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19351 return false;
19352 }
19353 return true;
19354 }
19355 if (const auto *Second = dyn_cast<HIPManagedAttr>(A)) {
19356 if (const auto *First = D->getAttr<CUDAConstantAttr>()) {
19357 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19358 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19359 return false;
19360 }
19361 if (const auto *First = D->getAttr<CUDASharedAttr>()) {
19362 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19363 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19364 return false;
19365 }
19366 return true;
19367 }
19368 if (const auto *Second = dyn_cast<HotAttr>(A)) {
19369 if (const auto *First = D->getAttr<ColdAttr>()) {
19370 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19371 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19372 return false;
19373 }
19374 return true;
19375 }
19376 if (const auto *Second = dyn_cast<InternalLinkageAttr>(A)) {
19377 if (const auto *First = D->getAttr<CommonAttr>()) {
19378 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19379 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19380 return false;
19381 }
19382 return true;
19383 }
19384 if (const auto *Second = dyn_cast<MicroMipsAttr>(A)) {
19385 if (const auto *First = D->getAttr<Mips16Attr>()) {
19386 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19387 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19388 return false;
19389 }
19390 return true;
19391 }
19392 if (const auto *Second = dyn_cast<Mips16Attr>(A)) {
19393 if (const auto *First = D->getAttr<MipsInterruptAttr>()) {
19394 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19395 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19396 return false;
19397 }
19398 if (const auto *First = D->getAttr<MicroMipsAttr>()) {
19399 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19400 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19401 return false;
19402 }
19403 return true;
19404 }
19405 if (const auto *Second = dyn_cast<MipsLongCallAttr>(A)) {
19406 if (const auto *First = D->getAttr<MipsShortCallAttr>()) {
19407 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19408 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19409 return false;
19410 }
19411 return true;
19412 }
19413 if (const auto *Second = dyn_cast<MipsShortCallAttr>(A)) {
19414 if (const auto *First = D->getAttr<MipsLongCallAttr>()) {
19415 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19416 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19417 return false;
19418 }
19419 return true;
19420 }
19421 if (const auto *Second = dyn_cast<NakedAttr>(A)) {
19422 if (const auto *First = D->getAttr<DisableTailCallsAttr>()) {
19423 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19424 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19425 return false;
19426 }
19427 return true;
19428 }
19429 if (const auto *Second = dyn_cast<NoDestroyAttr>(A)) {
19430 if (const auto *First = D->getAttr<AlwaysDestroyAttr>()) {
19431 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19432 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19433 return false;
19434 }
19435 return true;
19436 }
19437 if (const auto *Second = dyn_cast<NoRandomizeLayoutAttr>(A)) {
19438 if (const auto *First = D->getAttr<RandomizeLayoutAttr>()) {
19439 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19440 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19441 return false;
19442 }
19443 return true;
19444 }
19445 if (const auto *Second = dyn_cast<NoSpeculativeLoadHardeningAttr>(A)) {
19446 if (const auto *First = D->getAttr<SpeculativeLoadHardeningAttr>()) {
19447 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19448 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19449 return false;
19450 }
19451 return true;
19452 }
19453 if (const auto *Second = dyn_cast<NotTailCalledAttr>(A)) {
19454 if (const auto *First = D->getAttr<AlwaysInlineAttr>()) {
19455 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19456 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19457 return false;
19458 }
19459 return true;
19460 }
19461 if (const auto *Second = dyn_cast<OwnerAttr>(A)) {
19462 if (const auto *First = D->getAttr<PointerAttr>()) {
19463 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19464 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19465 return false;
19466 }
19467 return true;
19468 }
19469 if (const auto *Second = dyn_cast<PointerAttr>(A)) {
19470 if (const auto *First = D->getAttr<OwnerAttr>()) {
19471 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19472 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19473 return false;
19474 }
19475 return true;
19476 }
19477 if (const auto *Second = dyn_cast<RandomizeLayoutAttr>(A)) {
19478 if (const auto *First = D->getAttr<NoRandomizeLayoutAttr>()) {
19479 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19480 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19481 return false;
19482 }
19483 return true;
19484 }
19485 if (const auto *Second = dyn_cast<SpeculativeLoadHardeningAttr>(A)) {
19486 if (const auto *First = D->getAttr<NoSpeculativeLoadHardeningAttr>()) {
19487 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19488 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19489 return false;
19490 }
19491 return true;
19492 }
19493 if (const auto *Second = dyn_cast<TargetAttr>(A)) {
19494 if (const auto *First = D->getAttr<TargetClonesAttr>()) {
19495 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19496 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19497 return false;
19498 }
19499 if (const auto *First = D->getAttr<TargetVersionAttr>()) {
19500 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19501 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19502 return false;
19503 }
19504 if (const auto *First = D->getAttr<CPUDispatchAttr>()) {
19505 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19506 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19507 return false;
19508 }
19509 if (const auto *First = D->getAttr<CPUSpecificAttr>()) {
19510 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19511 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19512 return false;
19513 }
19514 return true;
19515 }
19516 if (const auto *Second = dyn_cast<TargetClonesAttr>(A)) {
19517 if (const auto *First = D->getAttr<TargetVersionAttr>()) {
19518 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19519 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19520 return false;
19521 }
19522 if (const auto *First = D->getAttr<TargetAttr>()) {
19523 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19524 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19525 return false;
19526 }
19527 if (const auto *First = D->getAttr<CPUDispatchAttr>()) {
19528 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19529 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19530 return false;
19531 }
19532 if (const auto *First = D->getAttr<CPUSpecificAttr>()) {
19533 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19534 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19535 return false;
19536 }
19537 return true;
19538 }
19539 if (const auto *Second = dyn_cast<TargetVersionAttr>(A)) {
19540 if (const auto *First = D->getAttr<TargetClonesAttr>()) {
19541 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19542 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19543 return false;
19544 }
19545 if (const auto *First = D->getAttr<TargetAttr>()) {
19546 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19547 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19548 return false;
19549 }
19550 if (const auto *First = D->getAttr<CPUDispatchAttr>()) {
19551 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19552 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19553 return false;
19554 }
19555 if (const auto *First = D->getAttr<CPUSpecificAttr>()) {
19556 S.Diag(First->getLocation(), diag::err_attributes_are_not_compatible) << First << Second << (First->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19557 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19558 return false;
19559 }
19560 return true;
19561 }
19562 return true;
19563}
19564
19565#elif defined(WANT_STMT_MERGE_LOGIC)
19566
19567static bool DiagnoseMutualExclusions(Sema &S, const SmallVectorImpl<const Attr *> &C) {
19568 for (const Attr *A : C) {
19569 if (const auto *Second = dyn_cast<AlwaysInlineAttr>(A)) {
19570 auto Iter = llvm::find_if(C, [](const Attr *Check) { return isa<NotTailCalledAttr>(Check); });
19571 if (Iter != C.end()) {
19572 S.Diag((*Iter)->getLocation(), diag::err_attributes_are_not_compatible) << *Iter << Second << ((*Iter)->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19573 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19574 return false;
19575 }
19576 }
19577 if (const auto *Second = dyn_cast<LikelyAttr>(A)) {
19578 auto Iter = llvm::find_if(C, [](const Attr *Check) { return isa<UnlikelyAttr>(Check); });
19579 if (Iter != C.end()) {
19580 S.Diag((*Iter)->getLocation(), diag::err_attributes_are_not_compatible) << *Iter << Second << ((*Iter)->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19581 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19582 return false;
19583 }
19584 }
19585 if (const auto *Second = dyn_cast<UnlikelyAttr>(A)) {
19586 auto Iter = llvm::find_if(C, [](const Attr *Check) { return isa<LikelyAttr>(Check); });
19587 if (Iter != C.end()) {
19588 S.Diag((*Iter)->getLocation(), diag::err_attributes_are_not_compatible) << *Iter << Second << ((*Iter)->isRegularKeywordAttribute() || Second->isRegularKeywordAttribute());
19589 S.Diag(Second->getLocation(), diag::note_conflicting_attribute);
19590 return false;
19591 }
19592 }
19593 }
19594 return true;
19595}
19596
19597#endif
19598