Coverage Report

Created: 2018-09-25 17:16

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