LCOV - code coverage report
Current view: top level - build-llvm/tools/clang/include/clang/Sema - AttrParsedAttrImpl.inc (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 840 1370 61.3 %
Date: 2018-05-20 00:06:23 Functions: 195 280 69.6 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.13