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

Generated by: LCOV version 1.13