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: 817 1334 61.2 %
Date: 2018-02-21 17:27:13 Functions: 190 273 69.6 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.13