Coverage Report

Created: 2018-12-14 11:24

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