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

Generated by: LCOV version 1.13