Coverage Report

Created: 2018-07-12 09:57

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