Coverage Report

Created: 2019-03-24 22:13

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