62#include "llvm/ADT/APSInt.h" 
   63#include "llvm/ADT/STLExtras.h" 
   64#include "llvm/ADT/StringExtras.h" 
   65#include "llvm/Demangle/Demangle.h" 
   66#include "llvm/IR/DerivedTypes.h" 
   67#include "llvm/MC/MCSectionMachO.h" 
   68#include "llvm/Support/Error.h" 
   69#include "llvm/Support/ErrorHandling.h" 
   70#include "llvm/Support/MathExtras.h" 
   71#include "llvm/Support/raw_ostream.h" 
   72#include "llvm/TargetParser/Triple.h" 
   98template <
typename AttrInfo>
 
  100                                     int &Val, 
unsigned Idx = 
UINT_MAX) {
 
  105  if (UVal > (uint32_t)std::numeric_limits<int>::max()) {
 
  109        << 
toString(I, 10, 
false) << 32 <<  0;
 
 
  118                                          const Expr *E, StringRef &Str,
 
  124  if (!Literal || (!Literal->isUnevaluated() && !Literal->isOrdinary())) {
 
  130  Str = Literal->getString();
 
 
  140    Diag(Loc->
getLoc(), diag::err_attribute_argument_type)
 
  146      *ArgLocation = Loc->
getLoc();
 
  156  if (!Literal || (!Literal->isUnevaluated() && !Literal->isOrdinary())) {
 
  161  Str = Literal->getString();
 
 
  179    return !Result.empty();
 
  182  bool foundStarOperator = IsOverloadedOperatorPresent(
Record, OO_Star);
 
  183  bool foundArrowOperator = IsOverloadedOperatorPresent(
Record, OO_Arrow);
 
  184  if (foundStarOperator && foundArrowOperator)
 
  191  for (
const auto &BaseSpecifier : CXXRecord->bases()) {
 
  192    if (!foundStarOperator)
 
  193      foundStarOperator = IsOverloadedOperatorPresent(
 
  194          BaseSpecifier.getType()->getAsRecordDecl(), OO_Star);
 
  195    if (!foundArrowOperator)
 
  196      foundArrowOperator = IsOverloadedOperatorPresent(
 
  197          BaseSpecifier.getType()->getAsRecordDecl(), OO_Arrow);
 
  200  if (foundStarOperator && foundArrowOperator)
 
 
  220    if (!RD->isCompleteDefinition())
 
  227  S.
Diag(AL.
getLoc(), diag::warn_thread_attribute_decl_not_pointer) << AL << QT;
 
 
  239    return PT->getPointeeType()->getAsRecordDecl();
 
 
  244template <
typename AttrType>
 
  251  if (
const auto *CRD = dyn_cast<CXXRecordDecl>(RD)) {
 
  253          return !Base->hasAttr<AttrType>();
 
 
  267  if (!RD->isCompleteDefinition())
 
 
  285  if (!RD->isCompleteDefinition())
 
 
  300  return TN->
hasAttr<CapabilityAttr>();
 
 
  319  if (
const auto *E = dyn_cast<CastExpr>(Ex))
 
  321  else if (
const auto *E = dyn_cast<ParenExpr>(Ex))
 
  323  else if (
const auto *E = dyn_cast<UnaryOperator>(Ex)) {
 
  324    if (E->getOpcode() == UO_LNot || E->getOpcode() == UO_AddrOf ||
 
  325        E->getOpcode() == UO_Deref)
 
  328  } 
else if (
const auto *E = dyn_cast<BinaryOperator>(Ex)) {
 
  329    if (E->getOpcode() == BO_LAnd || E->getOpcode() == BO_LOr)
 
 
  347                                           bool ParamIdxOk = 
false) {
 
  352    const auto *MD = dyn_cast<const CXXMethodDecl>(D);
 
  353    if (MD && !MD->isStatic()) {
 
  359               diag::warn_thread_attribute_not_on_capability_member)
 
  360            << AL << MD->getParent();
 
  362      S.
Diag(AL.
getLoc(), diag::warn_thread_attribute_not_on_non_static_member)
 
  367  for (
unsigned Idx = Sidx; Idx < AL.
getNumArgs(); ++Idx) {
 
  372      Args.push_back(ArgExp);
 
  376    if (
const auto *StrLit = dyn_cast<StringLiteral>(ArgExp)) {
 
  377      if (StrLit->getLength() == 0 ||
 
  378          (StrLit->isOrdinary() && StrLit->getString() == 
"*")) {
 
  381        Args.push_back(ArgExp);
 
  387      S.
Diag(AL.
getLoc(), diag::warn_thread_attribute_ignored) << AL;
 
  388      Args.push_back(ArgExp);
 
  396    if (
const auto *UOp = dyn_cast<UnaryOperator>(ArgExp))
 
  397      if (UOp->getOpcode() == UO_AddrOf)
 
  398        if (
const auto *DRE = dyn_cast<DeclRefExpr>(UOp->getSubExpr()))
 
  399          if (DRE->getDecl()->isCXXInstanceMember())
 
  400            ArgTy = DRE->getDecl()->getType();
 
  406    if (!RD && ParamIdxOk) {
 
  407      const auto *FD = dyn_cast<FunctionDecl>(D);
 
  408      const auto *IL = dyn_cast<IntegerLiteral>(ArgExp);
 
  410        unsigned int NumParams = FD->getNumParams();
 
  411        llvm::APInt ArgValue = IL->getValue();
 
  412        uint64_t ParamIdxFromOne = ArgValue.getZExtValue();
 
  413        uint64_t ParamIdxFromZero = ParamIdxFromOne - 1;
 
  414        if (!ArgValue.isStrictlyPositive() || ParamIdxFromOne > NumParams) {
 
  416                 diag::err_attribute_argument_out_of_bounds_extra_info)
 
  417              << AL << Idx + 1 << NumParams;
 
  420        ArgTy = FD->getParamDecl(ParamIdxFromZero)->getType();
 
  429      S.
Diag(AL.
getLoc(), diag::warn_thread_attribute_argument_not_lockable)
 
  432    Args.push_back(ArgExp);
 
 
  444  S.
Diag(AL.
getLoc(), diag::warn_thread_attribute_not_on_scoped_lockable_param)
 
 
  465  unsigned Size = Args.size();
 
 
  501    S.
Diag(AL.
getLoc(), diag::warn_thread_attribute_decl_not_lockable) << AL;
 
 
  518  Expr **StartArg = &Args[0];
 
  520                 AcquiredAfterAttr(S.
Context, AL, StartArg, Args.size()));
 
 
  528  Expr **StartArg = &Args[0];
 
  530                 AcquiredBeforeAttr(S.
Context, AL, StartArg, Args.size()));
 
 
  547template <
typename AttrInfo>
 
  549                                    unsigned AttrArgNo) {
 
  550  assert(AI.isArgExpr(AttrArgNo) && 
"Expected expression argument");
 
  551  Expr *AttrArg = AI.getArgAsExpr(AttrArgNo);
 
  560    S.
Diag(SrcLoc, diag::err_attribute_integers_only)
 
 
  575    S.
Diag(AL.
getLoc(), diag::warn_attribute_return_pointers_only) << AL;
 
  586  ParamIdx SizeArgNo(SizeArgNoVal, D);
 
  601                 AllocSizeAttr(S.
Context, AL, SizeArgNo, NumberArgNo));
 
 
  610    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
 
 
  625  unsigned Size = Args.size();
 
 
  633  if (
const auto *ParmDecl = dyn_cast<ParmVarDecl>(D);
 
  643  unsigned Size = Args.size();
 
  646  Expr **StartArg = &Args[0];
 
  649                 LocksExcludedAttr(S.
Context, AL, StartArg, Size));
 
 
  655  if (!
Cond->isTypeDependent()) {
 
  666    Msg = 
"<no message provided>";
 
  672    S.
Diag(AL.
getLoc(), diag::err_attr_cond_never_constant_expr) << AL;
 
  674      S.
Diag(PDiag.first, PDiag.second);
 
 
  681  S.
Diag(AL.
getLoc(), diag::ext_clang_enable_if);
 
 
  690  StringRef NewUserDiagnostic;
 
 
  702  if (
const auto *RD = dyn_cast<CXXRecordDecl>(PD); RD && RD->isLocalClass()) {
 
  704           diag::warn_attribute_exclude_from_explicit_instantiation_local_class)
 
  709                 ExcludeFromExplicitInstantiationAttr(S.
Context, AL));
 
 
  717  const CXXRecordDecl *ClassType;
 
  719  llvm::SmallPtrSet<const ParmVarDecl *, 16> Parms;
 
  723  ArgumentDependenceChecker(
const FunctionDecl *FD) {
 
  725    if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD))
 
  733  bool referencesArgs(Expr *E) {
 
  739  bool VisitCXXThisExpr(CXXThisExpr *E)
 override {
 
  741           "`this` doesn't refer to the enclosing class?");
 
  746  bool VisitDeclRefExpr(DeclRefExpr *DRE)
 override {
 
  747    if (
const auto *PVD = dyn_cast<ParmVarDecl>(DRE->
getDecl()))
 
  748      if (Parms.count(PVD)) {
 
  761  if (
const auto *MethodDecl = dyn_cast<CXXMethodDecl>(DeclFD))
 
  762    if (!MethodDecl->isStatic()) {
 
  763      S.
Diag(AL.
getLoc(), diag::err_attribute_no_member_function) << AL;
 
  770      if (
auto *E = dyn_cast<Expr *>(
Union))
 
  771        return E->getBeginLoc();
 
  775    S.
Diag(Loc, diag::err_attribute_argument_n_type) << AL << Index << 
T;
 
  781    auto *F = dyn_cast_if_present<DeclRefExpr>(AL.
getArgAsExpr(0));
 
  784    return dyn_cast_if_present<FunctionDecl>(F->getFoundDecl());
 
  793    S.
Diag(AL.
getLoc(), diag::err_attribute_wrong_number_arguments_for)
 
  800  for (
unsigned I = 1; I < AL.
getNumArgs(); ++I) {
 
  812    if (Index > DeclFD->getNumParams()) {
 
  813      S.
Diag(AL.
getLoc(), diag::err_attribute_bounds_for_function)
 
  814          << AL << Index << DeclFD << DeclFD->getNumParams();
 
  819    QualType T2 = DeclFD->getParamDecl(Index - 1)->getType();
 
  824          << AL << Index << DeclFD << T2 << I << AttrFD << T1;
 
  828    Indices.push_back(Index - 1);
 
  832      S.
Context, AL, AttrFD, Indices.data(), Indices.size()));
 
 
  836  S.
Diag(AL.
getLoc(), diag::ext_clang_diagnose_if);
 
  843  StringRef DefaultSevStr;
 
  847  DiagnoseIfAttr::DefaultSeverity DefaultSev;
 
  848  if (!DiagnoseIfAttr::ConvertStrToDefaultSeverity(DefaultSevStr, DefaultSev)) {
 
  850           diag::err_diagnose_if_invalid_diagnostic_type);
 
  854  StringRef WarningGroup;
 
  858    if (WarningGroup.empty() ||
 
  862             diag::err_diagnose_if_unknown_warning)
 
  868  bool ArgDependent = 
false;
 
  869  if (
const auto *FD = dyn_cast<FunctionDecl>(D))
 
  870    ArgDependent = ArgumentDependenceChecker(FD).referencesArgs(
Cond);
 
  872      S.
Context, AL, 
Cond, Msg, DefaultSev, WarningGroup, ArgDependent,
 
 
  882    S.
Diag(Attrs.
getLoc(), diag::warn_attribute_wrong_decl_type)
 
 
  892  static constexpr const StringRef kWildcard = 
"*";
 
  895  bool HasWildcard = 
false;
 
  897  const auto AddBuiltinName = [&Names, &HasWildcard](StringRef Name) {
 
  898    if (Name == kWildcard)
 
  900    Names.push_back(Name);
 
  904  if (
const auto *NBA = D->
getAttr<NoBuiltinAttr>())
 
  905    for (StringRef BuiltinName : NBA->builtinNames())
 
  906      AddBuiltinName(BuiltinName);
 
  910    AddBuiltinName(kWildcard);
 
  912    for (
unsigned I = 0, E = AL.
getNumArgs(); I != E; ++I) {
 
  913      StringRef BuiltinName;
 
  919        AddBuiltinName(BuiltinName);
 
  921        S.
Diag(LiteralLoc, diag::warn_attribute_no_builtin_invalid_builtin_name)
 
  922            << BuiltinName << AL;
 
  927  Names.erase(llvm::unique(Names), Names.end());
 
  930  if (HasWildcard && Names.size() > 1)
 
  932           diag::err_attribute_no_builtin_wildcard_or_builtin_name)
 
  935  if (D->
hasAttr<NoBuiltinAttr>())
 
  938                 NoBuiltinAttr(S.
Context, AL, Names.data(), Names.size()));
 
 
  942  if (D->
hasAttr<PassObjectSizeAttr>()) {
 
  943    S.
Diag(D->
getBeginLoc(), diag::err_attribute_only_once_per_parameter) << AL;
 
  966    S.
Diag(D->
getBeginLoc(), diag::err_attribute_pointers_only) << AL << 1;
 
 
  974  ConsumableAttr::ConsumedState DefaultState;
 
  978    if (!ConsumableAttr::ConvertStrToConsumedState(
 
  980      S.
Diag(IL->
getLoc(), diag::warn_attribute_type_not_supported)
 
  985    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 
  998    if (!RD->hasAttr<ConsumableAttr>()) {
 
  999      S.
Diag(AL.
getLoc(), diag::warn_attr_on_unconsumable_class) << RD;
 
 
 1016  for (
unsigned ArgIndex = 0; ArgIndex < AL.
getNumArgs(); ++ArgIndex) {
 
 1017    CallableWhenAttr::ConsumedState CallableState;
 
 1019    StringRef StateString;
 
 1030    if (!CallableWhenAttr::ConvertStrToConsumedState(StateString,
 
 1032      S.
Diag(Loc, diag::warn_attribute_type_not_supported) << AL << StateString;
 
 1036    States.push_back(CallableState);
 
 1040                 CallableWhenAttr(S.
Context, AL, States.data(), States.size()));
 
 
 1044  ParamTypestateAttr::ConsumedState ParamState;
 
 1050    if (!ParamTypestateAttr::ConvertStrToConsumedState(StateString,
 
 1052      S.
Diag(Ident->
getLoc(), diag::warn_attribute_type_not_supported)
 
 1053          << AL << StateString;
 
 1057    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 
 1078  ReturnTypestateAttr::ConsumedState ReturnState;
 
 1082    if (!ReturnTypestateAttr::ConvertStrToConsumedState(
 
 1084      S.
Diag(IL->
getLoc(), diag::warn_attribute_type_not_supported)
 
 1089    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 
 1126  SetTypestateAttr::ConsumedState NewState;
 
 1130    if (!SetTypestateAttr::ConvertStrToConsumedState(Param, NewState)) {
 
 1131      S.
Diag(Ident->
getLoc(), diag::warn_attribute_type_not_supported)
 
 1136    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 
 1148  TestTypestateAttr::ConsumedState TestState;
 
 1152    if (!TestTypestateAttr::ConvertStrToConsumedState(Param, TestState)) {
 
 1153      S.
Diag(Ident->
getLoc(), diag::warn_attribute_type_not_supported)
 
 1158    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 
 1173  if (
auto *TD = dyn_cast<TagDecl>(D))
 
 1175  else if (
auto *FD = dyn_cast<FieldDecl>(D)) {
 
 1176    bool BitfieldByteAligned = (!FD->
getType()->isDependentType() &&
 
 1182      if (BitfieldByteAligned)
 
 1184        S.
Diag(AL.
getLoc(), diag::warn_attribute_ignored_for_field_of_type)
 
 1190      if (BitfieldByteAligned)
 
 1191        S.
Diag(AL.
getLoc(), diag::warn_attribute_packed_for_bitfield);
 
 1197    S.
Diag(AL.
getLoc(), diag::warn_attribute_ignored) << AL;
 
 
 1203  assert(CTD && 
"attribute does not appertain to this declaration");
 
 1211  if (!
T.hasQualifiers() && 
T->isTypedefNameType()) {
 
 1214    if (
const auto *CTSD = dyn_cast_if_present<ClassTemplateSpecializationDecl>(
 
 1215            T->getAsCXXRecordDecl())) {
 
 1216      Template = CTSD->getSpecializedTemplate();
 
 1217    } 
else if (
const auto *TST = 
T->getAs<TemplateSpecializationType>()) {
 
 1218      while (TST && TST->isTypeAlias())
 
 1219        TST = TST->getAliasedType()->getAs<TemplateSpecializationType>();
 
 1221        Template = TST->getTemplateName().getAsTemplateDecl();
 
 1230  S.
Diag(AL.
getLoc(), diag::err_attribute_not_typedef_for_specialization)
 
 1233    S.
Diag(TT->getDecl()->getLocation(), diag::note_entity_declared_at)
 
 
 1242      NoSpecializationsAttr::Create(S.
Context, Message, AL));
 
 
 1246  if (
T->isDependentType())
 
 1249    if (
T->isReferenceType())
 
 1252    T = 
T.getNonReferenceType();
 
 1257  if (
const RecordType *UT = 
T->getAsUnionType()) {
 
 1259    if (UD->
hasAttr<TransparentUnionAttr>()) {
 
 1260      for (
const auto *I : UD->
fields()) {
 
 1268  return T->isAnyPointerType() || 
T->isBlockPointerType();
 
 
 1274                                bool isReturnValue = 
false) {
 
 1277      S.
Diag(AL.
getLoc(), diag::warn_attribute_return_pointers_only)
 
 1278          << AL << AttrParmRange << TypeRange;
 
 1280      S.
Diag(AL.
getLoc(), diag::warn_attribute_pointers_only)
 
 1281          << AL << AttrParmRange << TypeRange << 0;
 
 
 1289  for (
unsigned I = 0; I < AL.
getNumArgs(); ++I) {
 
 1293            D, AL, I + 1, Ex, Idx,
 
 1306    NonNullArgs.push_back(Idx);
 
 1317         I != E && !AnyPointers; ++I) {
 
 1324      S.
Diag(AL.
getLoc(), diag::warn_attribute_nonnull_no_pointers);
 
 1327  ParamIdx *Start = NonNullArgs.data();
 
 1328  unsigned Size = NonNullArgs.size();
 
 1329  llvm::array_pod_sort(Start, Start + Size);
 
 
 1339      S.
Diag(AL.
getLoc(), diag::warn_attribute_nonnull_parm_no_args)
 
 
 1370    S.
Diag(AL.
getLoc(), diag::warn_attribute_pointers_only)
 
 
 1395    Diag(AttrLoc, diag::warn_attribute_return_pointers_refs_only)
 
 1401    std::optional<llvm::APSInt> I = llvm::APSInt(64);
 
 1404        Diag(AttrLoc, diag::err_attribute_argument_n_type)
 
 1407        Diag(AttrLoc, diag::err_attribute_argument_type)
 
 1412    if (!I->isPowerOf2()) {
 
 1413      Diag(AttrLoc, diag::err_alignment_not_power_of_two)
 
 1419      Diag(CI.
getLoc(), diag::warn_assume_aligned_too_great)
 
 1424    Diag(AttrLoc, diag::err_attribute_argument_n_type)
 
 
 1438    Diag(AttrLoc, diag::warn_attribute_return_pointers_refs_only)
 
 1453        << CI << FuncDecl->getParamDecl(Idx.
getASTIndex())->getSourceRange();
 
 
 1463  if (AttrName.size() > 4 && AttrName.starts_with(
"__") &&
 
 1464      AttrName.ends_with(
"__")) {
 
 1465    AttrName = AttrName.drop_front(2).drop_back(2);
 
 
 1481    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
 
 1487  OwnershipAttr::OwnershipKind K =
 
 1488      OwnershipAttr(S.
Context, AL, 
nullptr, 
nullptr, 0).getOwnKind();
 
 1492  case OwnershipAttr::Takes:
 
 1493  case OwnershipAttr::Holds:
 
 1495      S.
Diag(AL.
getLoc(), diag::err_attribute_too_few_arguments) << AL << 2;
 
 1499  case OwnershipAttr::Returns:
 
 1501      S.
Diag(AL.
getLoc(), diag::err_attribute_too_many_arguments) << AL << 2;
 
 1509  if (K == OwnershipAttr::Returns &&
 
 1511    S.
Diag(AL.
getLoc(), diag::err_ownership_takes_return_type) << AL;
 
 1517  StringRef ModuleName = 
Module->getName();
 
 1523  for (
unsigned i = 1; i < AL.
getNumArgs(); ++i) {
 
 1533      case OwnershipAttr::Takes:
 
 1534      case OwnershipAttr::Holds:
 
 1535        if (!
T->isAnyPointerType() && !
T->isBlockPointerType())
 
 1538      case OwnershipAttr::Returns:
 
 1539        if (!
T->isIntegerType())
 
 1544      S.
Diag(AL.
getLoc(), diag::err_ownership_type) << AL << Err
 
 1553      if (I->getOwnKind() != K && llvm::is_contained(I->args(), Idx)) {
 
 1554          S.
Diag(AL.
getLoc(), diag::err_attributes_are_not_compatible)
 
 1557                  I->isRegularKeywordAttribute());
 
 1559      } 
else if (K == OwnershipAttr::Returns &&
 
 1560                 I->getOwnKind() == OwnershipAttr::Returns) {
 
 1563        if (!llvm::is_contained(I->args(), Idx)) {
 
 1564          S.
Diag(I->getLocation(), diag::err_ownership_returns_index_mismatch)
 
 1565              << I->args_begin()->getSourceIndex();
 
 1567            S.
Diag(AL.
getLoc(), diag::note_ownership_returns_index_mismatch)
 
 1571      } 
else if (K == OwnershipAttr::Takes &&
 
 1572                 I->getOwnKind() == OwnershipAttr::Takes) {
 
 1573        if (I->getModule()->getName() != ModuleName) {
 
 1574          S.
Diag(I->getLocation(), diag::err_ownership_takes_class_mismatch)
 
 1575              << I->getModule()->getName();
 
 1576          S.
Diag(AL.
getLoc(), diag::note_ownership_takes_class_mismatch)
 
 1583    OwnershipArgs.push_back(Idx);
 
 1586  ParamIdx *Start = OwnershipArgs.data();
 
 1587  unsigned Size = OwnershipArgs.size();
 
 1588  llvm::array_pod_sort(Start, Start + Size);
 
 
 1596    S.
Diag(AL.
getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 1;
 
 1612    S.
Diag(AL.
getLoc(), diag::err_attribute_weakref_not_global_context)
 
 
 1657  std::unique_ptr<char, llvm::FreeDeleter> Demangled;
 
 1659    Demangled.reset(llvm::itaniumDemangle(Str, 
false));
 
 1670      if (MC->shouldMangleDeclName(ND)) {
 
 1671        llvm::raw_svector_ostream Out(Name);
 
 1675        Name = ND->getIdentifier()->getName();
 
 
 1691    S.
Diag(AL.
getLoc(), diag::err_alias_is_definition) << FD << 1;
 
 
 1705    S.
Diag(AL.
getLoc(), diag::err_alias_not_supported_on_darwin);
 
 1713      S.
Diag(AL.
getLoc(), diag::err_alias_not_supported_on_nvptx);
 
 1717  if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
 
 1719      S.
Diag(AL.
getLoc(), diag::err_alias_is_definition) << FD << 0;
 
 1724    if (VD->isThisDeclarationADefinition() && VD->isExternallyVisible()) {
 
 1725      S.
Diag(AL.
getLoc(), diag::err_alias_is_definition) << VD << 0;
 
 
 1742  if (Model != 
"global-dynamic" && Model != 
"local-dynamic" 
 1743      && Model != 
"initial-exec" && Model != 
"local-exec") {
 
 1744    S.
Diag(LiteralLoc, diag::err_attr_tlsmodel_arg);
 
 
 1754    S.
Diag(AL.
getLoc(), diag::warn_attribute_return_pointers_only)
 
 1766    S.
Diag(AL.
getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 0;
 
 1776  if (
auto *DRE = dyn_cast<DeclRefExpr>(DeallocE)) {
 
 1777    DeallocFD = dyn_cast<FunctionDecl>(DRE->
getDecl());
 
 1780      S.
Diag(DeallocLoc, diag::err_attribute_malloc_arg_not_function)
 
 1784  } 
else if (
auto *ULE = dyn_cast<UnresolvedLookupExpr>(DeallocE)) {
 
 1786    DeallocNI = ULE->getNameInfo();
 
 1788      S.
Diag(DeallocLoc, diag::err_attribute_malloc_arg_not_function)
 
 1795    S.
Diag(DeallocLoc, diag::err_attribute_malloc_arg_not_function) << 0;
 
 1803    DeallocPtrIdx = 
ParamIdx(1, DeallocFD);
 
 1814             diag::err_attribute_malloc_arg_not_function_with_pointer_arg)
 
 1828             diag::err_attribute_malloc_arg_refers_to_non_pointer_type)
 
 1837  S.
Diag(AL.
getLoc(), diag::warn_attribute_form_ignored) << AL;
 
 1839                 RestrictAttr(S.
Context, AL, DeallocE, DeallocPtrIdx));
 
 
 1849    if (
const auto *
Other = D->
getAttr<CPUDispatchAttr>()) {
 
 1850      S.
Diag(AL.
getLoc(), diag::err_disallowed_duplicate_attribute) << AL;
 
 1851      S.
Diag(
Other->getLocation(), diag::note_conflicting_attribute);
 
 1854  } 
else if (AL.
getParsedKind() == ParsedAttr::AT_CPUSpecific) {
 
 1858    if (
const auto *
Other = D->
getAttr<CPUSpecificAttr>()) {
 
 1859      S.
Diag(AL.
getLoc(), diag::err_disallowed_duplicate_attribute) << AL;
 
 1860      S.
Diag(
Other->getLocation(), diag::note_conflicting_attribute);
 
 1867  if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
 
 1868    if (MD->getParent()->isLambda()) {
 
 1869      S.
Diag(AL.
getLoc(), diag::err_attribute_dll_lambda) << AL;
 
 1880      S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 1889      S.
Diag(CPUArg->
getLoc(), diag::err_invalid_cpu_specific_dispatch_value)
 
 1890          << CPUName << (AL.
getKind() == ParsedAttr::AT_CPUDispatch);
 
 1896          return Target.CPUSpecificManglingCharacter(CPUName) ==
 
 1899      S.
Diag(AL.
getLoc(), diag::warn_multiversion_duplicate_entries);
 
 1906  if (AL.
getKind() == ParsedAttr::AT_CPUSpecific)
 
 1908                   CPUSpecificAttr(S.
Context, AL, CPUs.data(), CPUs.size()));
 
 1911                   CPUDispatchAttr(S.
Context, AL, CPUs.data(), CPUs.size()));
 
 
 1916    S.
Diag(AL.
getLoc(), diag::err_attribute_not_supported_in_lang)
 
 
 1927    const auto &
Arch = Triple.getArch();
 
 1928    if (
Arch != llvm::Triple::x86 &&
 
 1929        (
Arch != llvm::Triple::arm && 
Arch != llvm::Triple::thumb)) {
 
 1930      S.
Diag(AL.
getLoc(), diag::err_attribute_not_supported_on_arch)
 
 1931          << AL << Triple.getArchName();
 
 1938      S.
Diag(AL.
getLoc(), diag::err_attribute_wrong_decl_type)
 
 
 1955  const Stmt *OnlyStmt = 
nullptr;
 
 1957  if (
const auto *Compound = dyn_cast<CompoundStmt>(Body)) {
 
 1958    if (Compound->size() != 1)
 
 1960    OnlyStmt = *Compound->body_begin();
 
 1966  if (
const auto *EWC = dyn_cast<ExprWithCleanups>(OnlyStmt)) {
 
 1967    OnlyStmt = EWC->getSubExpr();
 
 
 1974  auto *FD = dyn_cast<FunctionDecl>(D);
 
 1993    NonConstFD->addAttr(InferredNoReturnAttr::CreateImplicit(S.
Context));
 
 1996    if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD);
 
 
 2010    S.
Diag(Attrs.
getLoc(), diag::warn_attribute_wrong_decl_type)
 
 
 2036    S.
Diag(Attrs.
getLoc(), diag::warn_nocf_check_attribute_ignored);
 
 
 2054      Diag(AL.
getLoc(), diag::err_keyword_not_supported_on_target)
 
 
 2073                              ? diag::err_attribute_wrong_decl_type
 
 2074                              : diag::warn_attribute_wrong_decl_type)
 
 
 2110  if (VecReturnAttr *A = D->
getAttr<VecReturnAttr>()) {
 
 2111    S.
Diag(AL.
getLoc(), diag::err_repeat_attribute) << A;
 
 2119    S.
Diag(AL.
getLoc(), diag::err_attribute_vecreturn_only_vector_member);
 
 2124    S.
Diag(AL.
getLoc(), diag::err_attribute_vecreturn_only_pod_record);
 
 2128  for (
const auto *I : R->fields()) {
 
 2129    if ((count == 1) || !I->getType()->isVectorType()) {
 
 2130      S.
Diag(AL.
getLoc(), diag::err_attribute_vecreturn_only_vector_member);
 
 
 2146             diag::err_carries_dependency_param_not_function_decl);
 
 
 2160    S.
Diag(AL.
getLoc(), diag::ext_cxx17_attr) << AL;
 
 
 2175        S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 2185                                  APValue(llvm::APSInt::getUnsigned(priority)));
 
 
 2193    S.
Diag(AL.
getLoc(), diag::err_hlsl_init_priority_unsupported);
 
 
 2212template <
typename AttrTy>
 
 2224                                  VersionTuple Introduced,
 
 2225                                  VersionTuple Deprecated,
 
 2226                                  VersionTuple Obsoleted) {
 
 2227  StringRef PlatformName
 
 2228    = AvailabilityAttr::getPrettyPlatformName(Platform->
getName());
 
 2229  if (PlatformName.empty())
 
 2230    PlatformName = Platform->
getName();
 
 2234  if (!Introduced.empty() && !Deprecated.empty() &&
 
 2235      !(Introduced <= Deprecated)) {
 
 2236    S.
Diag(Range.getBegin(), diag::warn_availability_version_ordering)
 
 2237      << 1 << PlatformName << Deprecated.getAsString()
 
 2238      << 0 << Introduced.getAsString();
 
 2242  if (!Introduced.empty() && !Obsoleted.empty() &&
 
 2243      !(Introduced <= Obsoleted)) {
 
 2244    S.
Diag(Range.getBegin(), diag::warn_availability_version_ordering)
 
 2245      << 2 << PlatformName << Obsoleted.getAsString()
 
 2246      << 0 << Introduced.getAsString();
 
 2250  if (!Deprecated.empty() && !Obsoleted.empty() &&
 
 2251      !(Deprecated <= Obsoleted)) {
 
 2252    S.
Diag(Range.getBegin(), diag::warn_availability_version_ordering)
 
 2253      << 2 << PlatformName << Obsoleted.getAsString()
 
 2254      << 1 << Deprecated.getAsString();
 
 
 2266                          bool BeforeIsOkay) {
 
 2267  if (
X.empty() || Y.empty())
 
 2273  if (BeforeIsOkay && 
X < Y)
 
 
 2281    bool Implicit, VersionTuple Introduced, VersionTuple Deprecated,
 
 2282    VersionTuple Obsoleted, 
bool IsUnavailable, StringRef Message,
 
 2285  VersionTuple MergedIntroduced = Introduced;
 
 2286  VersionTuple MergedDeprecated = Deprecated;
 
 2287  VersionTuple MergedObsoleted = Obsoleted;
 
 2288  bool FoundAny = 
false;
 
 2289  bool OverrideOrImpl = 
false;
 
 2293    OverrideOrImpl = 
false;
 
 2299    OverrideOrImpl = 
true;
 
 2305    for (
unsigned i = 0, e = Attrs.size(); i != e;) {
 
 2306      const auto *OldAA = dyn_cast<AvailabilityAttr>(Attrs[i]);
 
 2313      if (OldPlatform != Platform) {
 
 2319      if (OldEnvironment != Environment) {
 
 2327      if (OldAA->getPriority() < Priority)
 
 2333      if (OldAA->getPriority() > Priority) {
 
 2334        Attrs.erase(Attrs.begin() + i);
 
 2340      VersionTuple OldIntroduced = OldAA->getIntroduced();
 
 2341      VersionTuple OldDeprecated = OldAA->getDeprecated();
 
 2342      VersionTuple OldObsoleted = OldAA->getObsoleted();
 
 2343      bool OldIsUnavailable = OldAA->getUnavailable();
 
 2345      if (!
versionsMatch(OldIntroduced, Introduced, OverrideOrImpl) ||
 
 2346          !
versionsMatch(Deprecated, OldDeprecated, OverrideOrImpl) ||
 
 2348          !(OldIsUnavailable == IsUnavailable ||
 
 2349            (OverrideOrImpl && !OldIsUnavailable && IsUnavailable))) {
 
 2350        if (OverrideOrImpl) {
 
 2352          VersionTuple FirstVersion;
 
 2353          VersionTuple SecondVersion;
 
 2354          if (!
versionsMatch(OldIntroduced, Introduced, OverrideOrImpl)) {
 
 2356            FirstVersion = OldIntroduced;
 
 2357            SecondVersion = Introduced;
 
 2358          } 
else if (!
versionsMatch(Deprecated, OldDeprecated, OverrideOrImpl)) {
 
 2360            FirstVersion = Deprecated;
 
 2361            SecondVersion = OldDeprecated;
 
 2362          } 
else if (!
versionsMatch(Obsoleted, OldObsoleted, OverrideOrImpl)) {
 
 2364            FirstVersion = Obsoleted;
 
 2365            SecondVersion = OldObsoleted;
 
 2369            Diag(OldAA->getLocation(),
 
 2370                 diag::warn_mismatched_availability_override_unavail)
 
 2371                << AvailabilityAttr::getPrettyPlatformName(Platform->
getName())
 
 2383            Diag(OldAA->getLocation(),
 
 2384                 diag::warn_mismatched_availability_override)
 
 2386                << AvailabilityAttr::getPrettyPlatformName(Platform->
getName())
 
 2387                << FirstVersion.getAsString() << SecondVersion.getAsString()
 
 2391            Diag(CI.
getLoc(), diag::note_overridden_method);
 
 2393            Diag(CI.
getLoc(), diag::note_protocol_method);
 
 2395          Diag(OldAA->getLocation(), diag::warn_mismatched_availability);
 
 2396          Diag(CI.
getLoc(), diag::note_previous_attribute);
 
 2399        Attrs.erase(Attrs.begin() + i);
 
 2404      VersionTuple MergedIntroduced2 = MergedIntroduced;
 
 2405      VersionTuple MergedDeprecated2 = MergedDeprecated;
 
 2406      VersionTuple MergedObsoleted2 = MergedObsoleted;
 
 2408      if (MergedIntroduced2.empty())
 
 2409        MergedIntroduced2 = OldIntroduced;
 
 2410      if (MergedDeprecated2.empty())
 
 2411        MergedDeprecated2 = OldDeprecated;
 
 2412      if (MergedObsoleted2.empty())
 
 2413        MergedObsoleted2 = OldObsoleted;
 
 2416                                MergedIntroduced2, MergedDeprecated2,
 
 2417                                MergedObsoleted2)) {
 
 2418        Attrs.erase(Attrs.begin() + i);
 
 2423      MergedIntroduced = MergedIntroduced2;
 
 2424      MergedDeprecated = MergedDeprecated2;
 
 2425      MergedObsoleted = MergedObsoleted2;
 
 2431      MergedIntroduced == Introduced &&
 
 2432      MergedDeprecated == Deprecated &&
 
 2433      MergedObsoleted == Obsoleted)
 
 2439                             MergedDeprecated, MergedObsoleted) &&
 
 2441    auto *Avail = ::new (
Context) AvailabilityAttr(
 
 2442        Context, CI, Platform, Introduced, Deprecated, Obsoleted, IsUnavailable,
 
 2443        Message, IsStrict, Replacement, Priority, Environment);
 
 
 2463  StringRef PrettyName = AvailabilityAttr::getPrettyPlatformName(II->
getName());
 
 2464  if (PrettyName.empty())
 
 2465    S.
Diag(Platform->
getLoc(), diag::warn_availability_unknown_platform)
 
 2468  auto *ND = dyn_cast<NamedDecl>(D);
 
 2476  const llvm::Triple::OSType PlatformOS = AvailabilityAttr::getOSType(
 
 2477      AvailabilityAttr::canonicalizePlatformName(II->
getName()));
 
 2479  auto reportAndUpdateIfInvalidOS = [&](
auto &InputVersion) -> 
void {
 
 2480    const bool IsInValidRange =
 
 2481        llvm::Triple::isValidVersionForOS(PlatformOS, InputVersion);
 
 2483    auto CanonicalVersion = llvm::Triple::getCanonicalVersionForOS(
 
 2484        PlatformOS, InputVersion, IsInValidRange);
 
 2485    if (!IsInValidRange) {
 
 2486      S.
Diag(Platform->
getLoc(), diag::warn_availability_invalid_os_version)
 
 2487          << InputVersion.getAsString() << PrettyName;
 
 2489             diag::note_availability_invalid_os_version_adjusted)
 
 2490          << CanonicalVersion.getAsString();
 
 2492    InputVersion = CanonicalVersion;
 
 2495  if (PlatformOS != llvm::Triple::OSType::UnknownOS) {
 
 2496    reportAndUpdateIfInvalidOS(Introduced.
Version);
 
 2497    reportAndUpdateIfInvalidOS(Deprecated.
Version);
 
 2498    reportAndUpdateIfInvalidOS(Obsoleted.
Version);
 
 2504  if (
const auto *SE = dyn_cast_if_present<StringLiteral>(AL.
getMessageExpr()))
 
 2505    Str = SE->getString();
 
 2506  StringRef Replacement;
 
 2507  if (
const auto *SE =
 
 2509    Replacement = SE->getString();
 
 2511  if (II->
isStr(
"swift")) {
 
 2513        (!IsUnavailable && !Deprecated.
isValid())) {
 
 2515             diag::warn_availability_swift_unavailable_deprecated_only);
 
 2520  if (II->
isStr(
"fuchsia")) {
 
 2521    std::optional<unsigned> 
Min, Sub;
 
 2523        (Sub = Introduced.
Version.getSubminor())) {
 
 2524      S.
Diag(AL.
getLoc(), diag::warn_availability_fuchsia_unavailable_minor);
 
 2539  if (EnvironmentLoc) {
 
 2542      if (AvailabilityAttr::getEnvironmentType(
 
 2544          llvm::Triple::EnvironmentType::UnknownEnvironment)
 
 2546               diag::warn_availability_unknown_environment)
 
 2550             diag::err_availability_unexpected_parameter)
 
 2551          << 
"environment" <<  1;
 
 2557      Obsoleted.
Version, IsUnavailable, Str, IsStrict, Replacement,
 
 2568    else if (II->
getName() == 
"ios_app_extension")
 
 2573      const auto *IOSToWatchOSMapping =
 
 2578      auto adjustWatchOSVersion =
 
 2579          [IOSToWatchOSMapping](VersionTuple Version) -> VersionTuple {
 
 2580        if (Version.empty())
 
 2582        auto MinimumWatchOSVersion = VersionTuple(2, 0);
 
 2584        if (IOSToWatchOSMapping) {
 
 2585          if (
auto MappedVersion = IOSToWatchOSMapping->map(
 
 2586                  Version, MinimumWatchOSVersion, std::nullopt)) {
 
 2587            return *MappedVersion;
 
 2591        auto Major = Version.getMajor();
 
 2592        auto NewMajor = Major;
 
 2595        else if (Major < 12)
 
 2596          NewMajor = Major - 7;
 
 2597        if (NewMajor >= 2) {
 
 2598          if (Version.getMinor()) {
 
 2599            if (Version.getSubminor())
 
 2600              return VersionTuple(NewMajor, *Version.getMinor(),
 
 2601                                  *Version.getSubminor());
 
 2603              return VersionTuple(NewMajor, *Version.getMinor());
 
 2605          return VersionTuple(NewMajor);
 
 2608        return MinimumWatchOSVersion;
 
 2611      auto NewIntroduced = adjustWatchOSVersion(Introduced.
Version);
 
 2612      auto NewDeprecated = adjustWatchOSVersion(Deprecated.
Version);
 
 2613      auto NewObsoleted = adjustWatchOSVersion(Obsoleted.
Version);
 
 2616          ND, AL, NewII, 
true , NewIntroduced, NewDeprecated,
 
 2617          NewObsoleted, IsUnavailable, Str, IsStrict, Replacement,
 
 2629    else if (II->
getName() == 
"ios_app_extension")
 
 2634      const auto *IOSToTvOSMapping =
 
 2639      auto AdjustTvOSVersion =
 
 2640          [IOSToTvOSMapping](VersionTuple Version) -> VersionTuple {
 
 2641        if (Version.empty())
 
 2644        if (IOSToTvOSMapping) {
 
 2645          if (
auto MappedVersion = IOSToTvOSMapping->map(
 
 2646                  Version, VersionTuple(0, 0), std::nullopt)) {
 
 2647            return *MappedVersion;
 
 2653      auto NewIntroduced = AdjustTvOSVersion(Introduced.
Version);
 
 2654      auto NewDeprecated = AdjustTvOSVersion(Deprecated.
Version);
 
 2655      auto NewObsoleted = AdjustTvOSVersion(Obsoleted.
Version);
 
 2658          ND, AL, NewII, 
true , NewIntroduced, NewDeprecated,
 
 2659          NewObsoleted, IsUnavailable, Str, IsStrict, Replacement,
 
 2666                 llvm::Triple::IOS &&
 
 2668    auto GetSDKInfo = [&]() {
 
 2677    else if (II->
getName() == 
"ios_app_extension")
 
 2680      auto MinMacCatalystVersion = [](
const VersionTuple &
V) {
 
 2683        if (
V.getMajor() < 13 ||
 
 2684            (
V.getMajor() == 13 && 
V.getMinor() && *
V.getMinor() < 1))
 
 2685          return VersionTuple(13, 1); 
 
 2689          ND, AL, NewII, 
true ,
 
 2690          MinMacCatalystVersion(Introduced.
Version),
 
 2691          MinMacCatalystVersion(Deprecated.
Version),
 
 2692          MinMacCatalystVersion(Obsoleted.
Version), IsUnavailable, Str,
 
 2697    } 
else if (II->
getName() == 
"macos" && GetSDKInfo() &&
 
 2699                !Obsoleted.
Version.empty())) {
 
 2700      if (
const auto *MacOStoMacCatalystMapping =
 
 2701              GetSDKInfo()->getVersionMapping(
 
 2708        auto RemapMacOSVersion =
 
 2709            [&](
const VersionTuple &
V) -> std::optional<VersionTuple> {
 
 2711            return std::nullopt;
 
 2713          if (
V.getMajor() == 100000)
 
 2714            return VersionTuple(100000);
 
 2716          return MacOStoMacCatalystMapping->map(
V, VersionTuple(13, 1),
 
 2719        std::optional<VersionTuple> NewIntroduced =
 
 2720                                        RemapMacOSVersion(Introduced.
Version),
 
 2722                                        RemapMacOSVersion(Deprecated.
Version),
 
 2724                                        RemapMacOSVersion(Obsoleted.
Version);
 
 2725        if (NewIntroduced || NewDeprecated || NewObsoleted) {
 
 2726          auto VersionOrEmptyVersion =
 
 2727              [](
const std::optional<VersionTuple> &
V) -> VersionTuple {
 
 2728            return V ? *
V : VersionTuple();
 
 2731              ND, AL, NewII, 
true ,
 
 2732              VersionOrEmptyVersion(NewIntroduced),
 
 2733              VersionOrEmptyVersion(NewDeprecated),
 
 2734              VersionOrEmptyVersion(NewObsoleted), 
false, Str,
 
 
 2753  if (
const auto *SE = dyn_cast_if_present<StringLiteral>(AL.
getArgAsExpr(0)))
 
 2755  StringRef DefinedIn;
 
 2756  if (
const auto *SE = dyn_cast_if_present<StringLiteral>(AL.
getArgAsExpr(1)))
 
 2757    DefinedIn = SE->getString();
 
 2758  bool IsGeneratedDeclaration = AL.
getArgAsIdent(2) != 
nullptr;
 
 2760  if (
const auto *SE = dyn_cast_if_present<StringLiteral>(AL.
getArgAsExpr(3)))
 
 2761    USR = SE->getString();
 
 
 2769                              typename T::VisibilityType value) {
 
 2772    typename T::VisibilityType existingValue = existingAttr->getVisibility();
 
 2773    if (existingValue == value)
 
 2775    S.
Diag(existingAttr->getLocation(), diag::err_mismatched_visibility);
 
 2776    S.
Diag(CI.
getLoc(), diag::note_previous_attribute);
 
 
 2784                                          VisibilityAttr::VisibilityType Vis) {
 
 2785  return ::mergeVisibilityAttr<VisibilityAttr>(*
this, D, CI, Vis);
 
 
 2790                              TypeVisibilityAttr::VisibilityType Vis) {
 
 2791  return ::mergeVisibilityAttr<TypeVisibilityAttr>(*
this, D, CI, Vis);
 
 
 2795                                 bool isTypeVisibility) {
 
 2816  VisibilityAttr::VisibilityType 
type;
 
 2817  if (!VisibilityAttr::ConvertStrToVisibilityType(TypeStr, 
type)) {
 
 2818    S.
Diag(LiteralLoc, diag::warn_attribute_type_not_supported) << AL
 
 2825  if (
type == VisibilityAttr::Protected &&
 
 2827    S.
Diag(AL.
getLoc(), diag::warn_attribute_protected_visibility);
 
 2828    type = VisibilityAttr::Default;
 
 2832  if (isTypeVisibility) {
 
 2834        D, AL, (TypeVisibilityAttr::VisibilityType)
type);
 
 
 2843  unsigned sentinel = (
unsigned)SentinelAttr::DefaultSentinel;
 
 2846    std::optional<llvm::APSInt> Idx = llvm::APSInt(32);
 
 2848      S.
Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
 
 2853    if (Idx->isSigned() && Idx->isNegative()) {
 
 2854      S.
Diag(AL.
getLoc(), diag::err_attribute_sentinel_less_than_zero)
 
 2859    sentinel = Idx->getZExtValue();
 
 2862  unsigned nullPos = (
unsigned)SentinelAttr::DefaultNullPos;
 
 2865    std::optional<llvm::APSInt> Idx = llvm::APSInt(32);
 
 2867      S.
Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
 
 2871    nullPos = Idx->getZExtValue();
 
 2873    if ((Idx->isSigned() && Idx->isNegative()) || nullPos > 1) {
 
 2876      S.
Diag(AL.
getLoc(), diag::err_attribute_sentinel_not_zero_or_one)
 
 2882  if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
 
 2885      S.
Diag(AL.
getLoc(), diag::warn_attribute_sentinel_named_arguments);
 
 2890      S.
Diag(AL.
getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0;
 
 2893  } 
else if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D)) {
 
 2894    if (!MD->isVariadic()) {
 
 2895      S.
Diag(AL.
getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0;
 
 2898  } 
else if (
const auto *BD = dyn_cast<BlockDecl>(D)) {
 
 2899    if (!BD->isVariadic()) {
 
 2900      S.
Diag(AL.
getLoc(), diag::warn_attribute_sentinel_not_variadic) << 1;
 
 2903  } 
else if (
const auto *
V = dyn_cast<VarDecl>(D)) {
 
 2913        S.
Diag(AL.
getLoc(), diag::warn_attribute_sentinel_not_variadic) << m;
 
 2917      S.
Diag(AL.
getLoc(), diag::warn_attribute_wrong_decl_type)
 
 2923    S.
Diag(AL.
getLoc(), diag::warn_attribute_wrong_decl_type)
 
 
 2935    S.
Diag(AL.
getLoc(), diag::warn_attribute_void_function_method) << AL << 0;
 
 2938  if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D))
 
 2939    if (MD->getReturnType()->isVoidType()) {
 
 2940      S.
Diag(AL.
getLoc(), diag::warn_attribute_void_function_method) << AL << 1;
 
 2957        S.
Diag(AL.
getLoc(), diag::warn_attribute_wrong_decl_type)
 
 2968        if (LO.CPlusPlus && !LO.CPlusPlus20)
 
 2969          S.
Diag(AL.
getLoc(), diag::ext_cxx20_attr) << AL;
 
 2973      } 
else if (LO.CPlusPlus && !LO.CPlusPlus17)
 
 2974        S.
Diag(AL.
getLoc(), diag::ext_cxx17_attr) << AL;
 
 2981    S.
Diag(AL.
getLoc(), diag::warn_unused_result_typedef_unsupported_spelling)
 
 
 2994      S.
Diag(AL.
getLoc(), diag::warn_attribute_invalid_on_definition)
 
 3001      S.
Diag(AL.
getLoc(), diag::warn_attribute_wrong_decl_type)
 
 
 3014template <
class Attribute>
 
 3016                                  const unsigned Idx) {
 
 3025  std::optional<llvm::APSInt> I = llvm::APSInt(64);
 
 3032  if (!I->isIntN(32)) {
 
 3034        << 
toString(*I, 10, 
false) << 32 <<  1;
 
 3038    S.
Diag(E->
getExprLoc(), diag::err_attribute_requires_positive_integer)
 
 3046         "Unexpected PerformCopyInitialization() failure.");
 
 
 3052template <
typename WorkGroupAttr>
 
 3055  for (
unsigned i = 0; i < 3; ++i) {
 
 3062  auto IsZero = [&](
Expr *E) {
 
 3063    if (E->isValueDependent())
 
 3065    std::optional<llvm::APSInt> I = E->getIntegerConstantExpr(S.
Context);
 
 3066    assert(I && 
"Non-integer constant expr");
 
 3070  if (!llvm::all_of(WGSize, IsZero)) {
 
 3071    for (
unsigned i = 0; i < 3; ++i) {
 
 3073      if (IsZero(WGSize[i])) {
 
 3074        S.
Diag(AL.
getLoc(), diag::err_attribute_argument_is_zero)
 
 3085    assert(L && 
"Non-integer constant expr");
 
 3086    std::optional<llvm::APSInt> R = RHS->getIntegerConstantExpr(S.
Context);
 
 3087    assert(L && 
"Non-integer constant expr");
 
 3091  WorkGroupAttr *Existing = D->
getAttr<WorkGroupAttr>();
 
 3093      !llvm::equal(std::initializer_list<Expr *>{Existing->getXDim(),
 
 3094                                                 Existing->getYDim(),
 
 3095                                                 Existing->getZDim()},
 
 3097    S.
Diag(AL.
getLoc(), diag::warn_duplicate_attribute) << AL;
 
 3100                 WorkGroupAttr(S.
Context, AL, WGSize[0], WGSize[1], WGSize[2]));
 
 
 3105    S.
Diag(AL.
getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 1;
 
 3111  assert(ParmTSI && 
"no type source info for attribute argument");
 
 3116    S.
Diag(AL.
getLoc(), diag::err_attribute_invalid_argument) << 2 << AL;
 
 3120  if (VecTypeHintAttr *A = D->
getAttr<VecTypeHintAttr>()) {
 
 3122      S.
Diag(AL.
getLoc(), diag::warn_duplicate_attribute) << AL;
 
 
 3134  if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
 
 3139  if (SectionAttr *ExistingAttr = D->
getAttr<SectionAttr>()) {
 
 3140    if (ExistingAttr->getName() == Name)
 
 3142    Diag(ExistingAttr->getLocation(), diag::warn_mismatched_section)
 
 3144    Diag(CI.
getLoc(), diag::note_previous_attribute);
 
 
 3151  if (!
Context.getTargetInfo().getTriple().isOSDarwin())
 
 3152    return llvm::Error::success();
 
 3155  StringRef Segment, Section;
 
 3156  unsigned TAA, StubSize;
 
 3158  return llvm::MCSectionMachO::ParseSectionSpecifier(SecName, Segment, Section,
 
 3159                                                     TAA, HasTAA, StubSize);
 
 
 3164    Diag(LiteralLoc, diag::err_attribute_section_invalid_for_target)
 
 
 3194  if (Triple.isLoongArch()) {
 
 3195    return Str == 
"normal" || Str == 
"medium" || Str == 
"extreme";
 
 3197    assert(Triple.getArch() == llvm::Triple::x86_64 &&
 
 3198           "only loongarch/x86-64 supported");
 
 3199    return Str == 
"small" || Str == 
"large";
 
 
 3206  auto IsTripleSupported = [](llvm::Triple &Triple) {
 
 3207    return Triple.getArch() == llvm::Triple::ArchType::x86_64 ||
 
 3208           Triple.isLoongArch();
 
 3218    Triples.push_back(aux->getTriple());
 
 3227  auto SupportedTripleIt = llvm::find_if(Triples, IsTripleSupported);
 
 3228  if (SupportedTripleIt == Triples.end()) {
 
 3229    S.
Diag(LiteralLoc, diag::warn_unknown_attribute_ignored) << AL;
 
 3233  llvm::CodeModel::Model CM;
 
 3234  if (!CodeModelAttr::ConvertStrToModel(Str, CM) ||
 
 3236    S.
Diag(LiteralLoc, diag::err_attr_codemodel_arg) << Str;
 
 
 3246                             StringRef CodeSegName) {
 
 3248    S.
Diag(LiteralLoc, diag::err_attribute_section_invalid_for_target)
 
 
 3260  if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
 
 3264  if (
const auto *ExistingAttr = D->
getAttr<CodeSegAttr>()) {
 
 3265    if (ExistingAttr->getName() == Name)
 
 3267    Diag(ExistingAttr->getLocation(), diag::warn_mismatched_section)
 
 3269    Diag(CI.
getLoc(), diag::note_previous_attribute);
 
 
 3282  if (
const auto *ExistingAttr = D->
getAttr<CodeSegAttr>()) {
 
 3283    if (!ExistingAttr->isImplicit()) {
 
 3285             ExistingAttr->getName() == Str
 
 3286             ? diag::warn_duplicate_codeseg_attribute
 
 3287             : diag::err_conflicting_codeseg_attribute);
 
 
 3299  if (AttrStr.contains(
"fpmath="))
 
 3300    return Diag(LiteralLoc, diag::warn_unsupported_target_attribute)
 
 3301           << Unsupported << 
None << 
"fpmath=" << 
Target;
 
 3304  if (!
Context.getTargetInfo().supportsTargetAttributeTune() &&
 
 3305      AttrStr.contains(
"tune="))
 
 3306    return Diag(LiteralLoc, diag::warn_unsupported_target_attribute)
 
 3310      Context.getTargetInfo().parseTargetAttr(AttrStr);
 
 3312  if (!ParsedAttrs.
CPU.empty() &&
 
 3313      !
Context.getTargetInfo().isValidCPUName(ParsedAttrs.
CPU))
 
 3314    return Diag(LiteralLoc, diag::warn_unsupported_target_attribute)
 
 3317  if (!ParsedAttrs.
Tune.empty() &&
 
 3318      !
Context.getTargetInfo().isValidCPUName(ParsedAttrs.
Tune))
 
 3319    return Diag(LiteralLoc, diag::warn_unsupported_target_attribute)
 
 3322  if (
Context.getTargetInfo().getTriple().isRISCV()) {
 
 3324      return Diag(LiteralLoc, diag::err_duplicate_target_attribute)
 
 3326    for (StringRef CurFeature : ParsedAttrs.
Features) {
 
 3327      if (!CurFeature.starts_with(
'+') && !CurFeature.starts_with(
'-'))
 
 3328        return Diag(LiteralLoc, diag::warn_unsupported_target_attribute)
 
 3333  if (
Context.getTargetInfo().getTriple().isLoongArch()) {
 
 3334    for (StringRef CurFeature : ParsedAttrs.
Features) {
 
 3335      if (CurFeature.starts_with(
"!arch=")) {
 
 3336        StringRef ArchValue = CurFeature.split(
"=").second.trim();
 
 3337        return Diag(LiteralLoc, diag::err_attribute_unsupported)
 
 3338               << 
"target(arch=..)" << ArchValue;
 
 3344    return Diag(LiteralLoc, diag::warn_unsupported_target_attribute)
 
 3348    auto CurFeature = StringRef(
Feature).drop_front(); 
 
 3349    if (!
Context.getTargetInfo().isValidFeatureName(CurFeature))
 
 3350      return Diag(LiteralLoc, diag::warn_unsupported_target_attribute)
 
 3351             << Unsupported << 
None << CurFeature << 
Target;
 
 3358  if (!
Context.getTargetInfo().validateBranchProtection(
 
 3360          Context.getLangOpts(), DiagMsg)) {
 
 3361    if (DiagMsg.empty())
 
 3362      return Diag(LiteralLoc, diag::warn_unsupported_target_attribute)
 
 3363             << Unsupported << 
None << 
"branch-protection" << 
Target;
 
 3364    return Diag(LiteralLoc, diag::err_invalid_branch_protection_spec)
 
 3367  if (!DiagMsg.empty())
 
 3368    Diag(LiteralLoc, diag::warn_unsupported_branch_protection_spec) << DiagMsg;
 
 
 3387  TargetVersionAttr *NewAttr =
 
 
 3399  TargetAttr *NewAttr = ::new (S.
Context) TargetAttr(S.
Context, AL, Str);
 
 
 3406  if (
const auto *
Other = D->
getAttr<TargetClonesAttr>()) {
 
 3407    S.
Diag(AL.
getLoc(), diag::err_disallowed_duplicate_attribute) << AL;
 
 3408    S.
Diag(
Other->getLocation(), diag::note_conflicting_attribute);
 
 3416  if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
 
 3417    if (MD->getParent()->isLambda()) {
 
 3427  for (
unsigned I = 0, E = AL.
getNumArgs(); I != E; ++I) {
 
 3432    Params.push_back(Param);
 
 3433    Locations.push_back(Loc);
 
 3448  for (
auto &SmallStr : NewParams)
 
 3449    Params.push_back(SmallStr.str());
 
 3451  TargetClonesAttr *NewAttr = ::new (S.
Context)
 
 3452      TargetClonesAttr(S.
Context, AL, Params.data(), Params.size());
 
 
 3464  MinVectorWidthAttr *Existing = D->
getAttr<MinVectorWidthAttr>();
 
 3465  if (Existing && Existing->getVectorWidth() != VecWidth) {
 
 3466    S.
Diag(AL.
getLoc(), diag::warn_duplicate_attribute) << AL;
 
 
 3481  if (
auto *DRE = dyn_cast<DeclRefExpr>(E)) {
 
 3483      S.
Diag(Loc, diag::warn_cleanup_ext);
 
 3484    FD = dyn_cast<FunctionDecl>(DRE->
getDecl());
 
 3487      S.
Diag(Loc, diag::err_attribute_cleanup_arg_not_function) << 1
 
 3491  } 
else if (
auto *ULE = dyn_cast<UnresolvedLookupExpr>(E)) {
 
 3492    if (ULE->hasExplicitTemplateArgs())
 
 3493      S.
Diag(Loc, diag::warn_cleanup_ext);
 
 3495    NI = ULE->getNameInfo();
 
 3497      S.
Diag(Loc, diag::err_attribute_cleanup_arg_not_function) << 2
 
 3504    S.
Diag(Loc, diag::err_attribute_cleanup_arg_not_function) << 0;
 
 3509    S.
Diag(Loc, diag::err_attribute_cleanup_func_must_take_one_arg)
 
 3520    S.
Diag(Loc, diag::err_attribute_cleanup_func_arg_incompatible_type)
 
 3521      << NI.
getName() << ParamTy << Ty;
 
 3535      S.
Context, VariableReference, UnaryOperatorKind::UO_AddrOf,
 
 
 3557    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
 
 3562  EnumExtensibilityAttr::Kind ExtensibilityKind;
 
 3564  if (!EnumExtensibilityAttr::ConvertStrToKind(II->
getName(),
 
 3565                                               ExtensibilityKind)) {
 
 3566    S.
Diag(AL.
getLoc(), diag::warn_attribute_type_not_supported) << AL << II;
 
 3571                 EnumExtensibilityAttr(S.
Context, AL, ExtensibilityKind));
 
 
 3589    S.
Diag(AL.
getLoc(), diag::err_format_attribute_not)
 
 3599    if (
auto *OMD = dyn_cast<ObjCMethodDecl>(D))
 
 3600      if (
auto *
Interface = OMD->getClassInterface())
 
 3607    S.
Diag(AL.
getLoc(), diag::err_format_attribute_result_not)
 
 3608        << (NotNSStringTy ? 
"string type" : 
"NSString")
 
 
 3628  return llvm::StringSwitch<FormatAttrKind>(Format)
 
 3635      .Cases({
"gnu_scanf", 
"scanf", 
"gnu_printf", 
"printf", 
"printf0",
 
 3636              "gnu_strfmon", 
"strfmon"},
 
 3644      .Cases({
"gcc_diag", 
"gcc_cdiag", 
"gcc_cxxdiag", 
"gcc_tdiag"},
 
 
 3653    S.
Diag(AL.
getLoc(), diag::warn_attribute_ignored) << AL;
 
 3658    S.
Diag(AL.
getLoc(), diag::err_hlsl_init_priority_unsupported);
 
 3663    S.
Diag(AL.
getLoc(), diag::err_init_priority_object_attr);
 
 3670  if (!
T->isRecordType()) {
 
 3671    S.
Diag(AL.
getLoc(), diag::err_init_priority_object_attr);
 
 3677  uint32_t prioritynum;
 
 3683  if (prioritynum > 65535) {
 
 3684    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_out_of_range)
 
 3692  if (prioritynum < 101)
 
 3693    S.
Diag(AL.
getLoc(), diag::warn_init_priority_reserved)
 
 
 3699                                StringRef NewUserDiagnostic) {
 
 3700  if (
const auto *EA = D->
getAttr<ErrorAttr>()) {
 
 3702    assert((NewAttr == 
"error" || NewAttr == 
"warning") &&
 
 3703           "unexpected normalized full name");
 
 3704    bool Match = (EA->isError() && NewAttr == 
"error") ||
 
 3705                 (EA->isWarning() && NewAttr == 
"warning");
 
 3707      Diag(EA->getLocation(), diag::err_attributes_are_not_compatible)
 
 3710              EA->isRegularKeywordAttribute());
 
 3711      Diag(CI.
getLoc(), diag::note_conflicting_attribute);
 
 3714    if (EA->getUserDiagnostic() != NewUserDiagnostic) {
 
 3715      Diag(CI.
getLoc(), diag::warn_duplicate_attribute) << EA;
 
 3716      Diag(EA->getLoc(), diag::note_previous_attribute);
 
 3720  return ::new (
Context) ErrorAttr(
Context, CI, NewUserDiagnostic);
 
 
 3728    if (F->getType() == Format &&
 
 3729        F->getFormatIdx() == FormatIdx &&
 
 3730        F->getFirstArg() == FirstArg) {
 
 3733      if (F->getLocation().isInvalid())
 
 3739  return ::new (
Context) FormatAttr(
Context, CI, Format, FormatIdx, FirstArg);
 
 
 3749    if (F->getType() == Format && F->getFormatIdx() == FormatIdx) {
 
 3751                                        F->getFormatString(), FormatStr))
 
 3756      if (F->getLocation().isInvalid())
 
 3763      FormatMatchesAttr(
Context, CI, Format, FormatIdx, FormatStr);
 
 
 3781    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
 
 3806    S.
Diag(AL.
getLoc(), diag::warn_attribute_type_not_supported)
 
 3817    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_out_of_bounds)
 
 3825  if (HasImplicitThisParam) {
 
 3828             diag::err_format_attribute_implicit_this_format_string)
 
 3841    S.
Diag(AL.
getLoc(), diag::err_format_attribute_not)
 
 
 3862  if (FirstArg != 0) {
 
 3866      S.
Diag(AL.
getLoc(), diag::err_format_strftime_third_parameter)
 
 3874      if (FirstArg != Info.
NumArgs + 1) {
 
 3875        S.
Diag(AL.
getLoc(), diag::err_attribute_argument_out_of_bounds)
 
 3878                                            std::to_string(Info.
NumArgs + 1));
 
 3883      S.
Diag(D->
getLocation(), diag::warn_gcc_requires_variadic_function) << AL;
 
 3888        S.
Diag(AL.
getLoc(), diag::err_attribute_argument_out_of_bounds)
 
 3895  FormatAttr *NewAttr =
 
 
 3907  if (
auto *SL = dyn_cast<StringLiteral>(FormatStrExpr)) {
 
 3916  S.
Diag(AL.
getLoc(), diag::err_format_nonliteral)
 
 
 3924    S.
Diag(AL.
getLoc(), diag::err_callback_attribute_no_callee)
 
 3933  assert(FD && 
"Expected a function declaration!");
 
 3935  llvm::StringMap<int> NameIdxMapping;
 
 3936  NameIdxMapping[
"__"] = -1;
 
 3938  NameIdxMapping[
"this"] = 0;
 
 3942    NameIdxMapping[PVD->getName()] = Idx++;
 
 3944  auto UnknownName = NameIdxMapping.end();
 
 3947  for (
unsigned I = 0, E = AL.
getNumArgs(); I < E; ++I) {
 
 3954      if (It == UnknownName) {
 
 3955        S.
Diag(AL.
getLoc(), diag::err_callback_attribute_argument_unknown)
 
 3961      ArgIdx = It->second;
 
 3968        S.
Diag(AL.
getLoc(), diag::err_attribute_argument_out_of_bounds)
 
 3974      if (ArgIdx < -1 || ArgIdx > NumArgs) {
 
 3975        S.
Diag(AL.
getLoc(), diag::err_attribute_argument_out_of_bounds)
 
 3982      llvm_unreachable(
"Unexpected ParsedAttr argument type!");
 
 3985    if (ArgIdx == 0 && !HasImplicitThisParam) {
 
 3986      S.
Diag(AL.
getLoc(), diag::err_callback_implicit_this_not_available)
 
 3993    if (!HasImplicitThisParam && ArgIdx > 0)
 
 3996    EncodingIndices.push_back(ArgIdx);
 
 3999  int CalleeIdx = EncodingIndices.front();
 
 4003  if (CalleeIdx < (
int)HasImplicitThisParam) {
 
 4004    S.
Diag(AL.
getLoc(), diag::err_callback_attribute_invalid_callee)
 
 4011  const Type *CalleeType =
 
 4015    S.
Diag(AL.
getLoc(), diag::err_callback_callee_no_function_type)
 
 4020  const Type *CalleeFnType =
 
 4025  const auto *CalleeFnProtoType = dyn_cast<FunctionProtoType>(CalleeFnType);
 
 4026  if (!CalleeFnProtoType) {
 
 4027    S.
Diag(AL.
getLoc(), diag::err_callback_callee_no_function_type)
 
 4032  if (CalleeFnProtoType->getNumParams() != EncodingIndices.size() - 1) {
 
 4033    S.
Diag(AL.
getLoc(), diag::err_attribute_wrong_arg_count_for_func)
 
 4034        << AL << 
QualType{CalleeFnProtoType, 0}
 
 4035        << CalleeFnProtoType->getNumParams()
 
 4036        << (
unsigned)(EncodingIndices.size() - 1);
 
 4040  if (CalleeFnProtoType->isVariadic()) {
 
 4046  if (D->
hasAttr<CallbackAttr>()) {
 
 4052      S.
Context, AL, EncodingIndices.data(), EncodingIndices.size()));
 
 
 4056                                                        StringRef ParamName) {
 
 4059    Diag(AL.
getLoc(), diag::err_capture_by_attribute_no_entity)
 
 4068  bool IsValid = 
true;
 
 4069  for (
unsigned I = 0; I < N; ++I) {
 
 4072      Diag(E->
getExprLoc(), diag::err_capture_by_attribute_argument_unknown)
 
 4080      Diag(IdLoc->
getLoc(), diag::err_capture_by_references_itself)
 
 4086    ParamLocs[I] = IdLoc->
getLoc();
 
 4092      LifetimeCaptureByAttr::Create(
Context, FakeParamIndices.data(), N, AL);
 
 4093  CapturedBy->setArgs(ParamIdents, ParamLocs);
 
 
 4100  if (D->
hasAttr<LifetimeCaptureByAttr>()) {
 
 4101    S.
Diag(AL.
getLoc(), diag::err_capture_by_attribute_multiple)
 
 4105  auto *PVD = dyn_cast<ParmVarDecl>(D);
 
 
 4116    if (
auto *A = PVD->getAttr<LifetimeCaptureByAttr>())
 
 4118  if (HasImplicitThisParam) {
 
 4126      if (
auto *A = ATL.
getAttrAs<LifetimeCaptureByAttr>())
 
 4127        Attrs.push_back(
const_cast<LifetimeCaptureByAttr *
>(A));
 
 4132  llvm::StringMap<int> NameIdxMapping = {
 
 4133      {
"global", LifetimeCaptureByAttr::Global},
 
 4134      {
"unknown", LifetimeCaptureByAttr::Unknown}};
 
 4136  if (HasImplicitThisParam) {
 
 4137    NameIdxMapping[
"this"] = 0;
 
 4141    NameIdxMapping[PVD->getName()] = Idx++;
 
 4142  auto DisallowReservedParams = [&](StringRef Reserved) {
 
 4144      if (PVD->getName() == Reserved)
 
 4145        Diag(PVD->getLocation(), diag::err_capture_by_param_uses_reserved_name)
 
 4146            << (PVD->getName() == 
"unknown");
 
 4148  for (
auto *CapturedBy : Attrs) {
 
 4149    const auto &Entities = CapturedBy->getArgIdents();
 
 4150    for (
size_t I = 0; I < Entities.size(); ++I) {
 
 4151      StringRef Name = Entities[I]->getName();
 
 4152      auto It = NameIdxMapping.find(Name);
 
 4153      if (It == NameIdxMapping.end()) {
 
 4154        auto Loc = CapturedBy->getArgLocs()[I];
 
 4155        if (!HasImplicitThisParam && Name == 
"this")
 
 4156          Diag(Loc, diag::err_capture_by_implicit_this_not_available) << Loc;
 
 4158          Diag(Loc, diag::err_capture_by_attribute_argument_unknown)
 
 4159              << Entities[I] << Loc;
 
 4162      if (Name == 
"unknown" || Name == 
"global")
 
 4163        DisallowReservedParams(Name);
 
 4164      CapturedBy->setParamIdx(I, It->second);
 
 
 4173  return T.isFunctionPointerType() || 
T.isBlockPointerType();
 
 
 4182    S.
Diag(AL.
getLoc(), diag::err_called_once_attribute_wrong_type);
 
 
 4192  const auto *TD = dyn_cast<TypedefNameDecl>(D);
 
 4193  if (TD && TD->getUnderlyingType()->isUnionType())
 
 4194    RD = TD->getUnderlyingType()->getAsRecordDecl();
 
 4196    RD = dyn_cast<RecordDecl>(D);
 
 4199    S.
Diag(AL.
getLoc(), diag::warn_attribute_wrong_decl_type)
 
 4207             diag::warn_transparent_union_attribute_not_definition);
 
 4213  if (Field == FieldEnd) {
 
 4214    S.
Diag(AL.
getLoc(), diag::warn_transparent_union_attribute_zero_fields);
 
 4222           diag::warn_transparent_union_attribute_floating)
 
 4231  for (; Field != FieldEnd; ++Field) {
 
 4232    QualType FieldType = Field->getType();
 
 4246      S.
Diag(Field->getLocation(),
 
 4247             diag::warn_transparent_union_attribute_field_size_align)
 
 4248          << isSize << *Field << FieldBits;
 
 4249      unsigned FirstBits = isSize ? FirstSize : FirstAlign;
 
 4251             diag::note_transparent_union_first_field_size_align)
 
 4252          << isSize << FirstBits;
 
 
 4275  if (
const auto *TD = dyn_cast<TypedefNameDecl>(D))
 
 4276    T = TD->getUnderlyingType();
 
 4277  else if (
const auto *VD = dyn_cast<ValueDecl>(D))
 
 4280    llvm_unreachable(
"Unknown decl type for align_value");
 
 4282  if (!
T->isDependentType() && !
T->isAnyPointerType() &&
 
 4283      !
T->isReferenceType() && !
T->isMemberPointerType()) {
 
 4284    Diag(AttrLoc, diag::warn_attribute_pointer_or_reference_only)
 
 4290    llvm::APSInt Alignment;
 
 4292        E, &Alignment, diag::err_align_value_attribute_argument_not_int);
 
 4296    if (!Alignment.isPowerOf2()) {
 
 4297      Diag(AttrLoc, diag::err_alignment_not_power_of_two)
 
 
 4319             diag::err_pack_expansion_without_parameter_packs);
 
 4334    S.
Diag(AL.
getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 1;
 
 4346           diag::err_pack_expansion_without_parameter_packs);
 
 
 4373                                       const AlignedAttr &
Attr,
 
 4378  } 
else if (
const auto *VD = dyn_cast<VarDecl>(D)) {
 
 4381    if (VD->isExceptionVariable())
 
 4383  } 
else if (
const auto *FD = dyn_cast<FieldDecl>(D)) {
 
 4384    if (FD->isBitField())
 
 4386  } 
else if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
 
 4387    if (ED->getLangOpts().CPlusPlus)
 
 4390    return S.
Diag(AttrLoc, diag::err_attribute_wrong_decl_type)
 
 4395  if (DiagKind != -1) {
 
 4396    return S.
Diag(AttrLoc, diag::err_alignas_attribute_wrong_decl_type)
 
 4397           << &
Attr << DiagKind;
 
 
 4403                          bool IsPackExpansion) {
 
 4404  AlignedAttr TmpAttr(
Context, CI, 
true, E);
 
 4408  if (TmpAttr.isAlignas() &&
 
 4416    if (
const auto *TND = dyn_cast<TypedefNameDecl>(D)) {
 
 4417      if (!TND->getUnderlyingType()->isDependentType()) {
 
 4418        Diag(AttrLoc, diag::err_alignment_dependent_typedef_name)
 
 4425    AlignedAttr *AA = ::new (
Context) AlignedAttr(
Context, CI, 
true, E);
 
 4426    AA->setPackExpansion(IsPackExpansion);
 
 4432  llvm::APSInt Alignment;
 
 4434      E, &Alignment, diag::err_aligned_attribute_argument_not_int);
 
 4439  if (
Context.getTargetInfo().getTriple().isOSBinFormatCOFF())
 
 4442    Diag(AttrLoc, diag::err_attribute_aligned_too_great)
 
 4447  uint64_t AlignVal = Alignment.getZExtValue();
 
 4453  if (!(TmpAttr.isAlignas() && !Alignment)) {
 
 4454    if (!llvm::isPowerOf2_64(AlignVal)) {
 
 4455      Diag(AttrLoc, diag::err_alignment_not_power_of_two)
 
 4461  const auto *VD = dyn_cast<VarDecl>(D);
 
 4463    unsigned MaxTLSAlign =
 
 4464        Context.toCharUnitsFromBits(
Context.getTargetInfo().getMaxTLSAlign())
 
 4466    if (MaxTLSAlign && AlignVal > MaxTLSAlign &&
 
 4468      Diag(VD->getLocation(), diag::err_tls_var_aligned_over_maximum)
 
 4469          << (
unsigned)AlignVal << VD << MaxTLSAlign;
 
 4476  if (VD && 
Context.getTargetInfo().getTriple().isOSAIX()) {
 
 4477    const Type *Ty = VD->getType().getTypePtr();
 
 4479      Diag(VD->getLocation(), diag::warn_aligned_attr_underaligned)
 
 4480          << VD->getType() << 16;
 
 4486  AA->setPackExpansion(IsPackExpansion);
 
 4487  AA->setCachedAlignmentValue(
 
 4488      static_cast<unsigned>(AlignVal * 
Context.getCharWidth()));
 
 
 4494  AlignedAttr TmpAttr(
Context, CI, 
false, TS);
 
 4498  if (TmpAttr.isAlignas() &&
 
 4506    if (
const auto *TND = dyn_cast<TypedefNameDecl>(D)) {
 
 4507      if (!TND->getUnderlyingType()->isDependentType()) {
 
 4508        Diag(AttrLoc, diag::err_alignment_dependent_typedef_name)
 
 4514    AlignedAttr *AA = ::new (
Context) AlignedAttr(
Context, CI, 
false, TS);
 
 4515    AA->setPackExpansion(IsPackExpansion);
 
 4520  const auto *VD = dyn_cast<VarDecl>(D);
 
 4521  unsigned AlignVal = TmpAttr.getAlignment(
Context);
 
 4524  if (VD && 
Context.getTargetInfo().getTriple().isOSAIX()) {
 
 4525    const Type *Ty = VD->getType().getTypePtr();
 
 4527        Context.toCharUnitsFromBits(AlignVal).getQuantity() < 16) {
 
 4528      Diag(VD->getLocation(), diag::warn_aligned_attr_underaligned)
 
 4529          << VD->getType() << 16;
 
 4534  AlignedAttr *AA = ::new (
Context) AlignedAttr(
Context, CI, 
false, TS);
 
 4535  AA->setPackExpansion(IsPackExpansion);
 
 4536  AA->setCachedAlignmentValue(AlignVal);
 
 
 4541  assert(D->
hasAttrs() && 
"no attributes on decl");
 
 4544  if (
const auto *VD = dyn_cast<ValueDecl>(D)) {
 
 4545    UnderlyingTy = DiagTy = VD->getType();
 
 4548    if (
const auto *ED = dyn_cast<EnumDecl>(D))
 
 4549      UnderlyingTy = ED->getIntegerType();
 
 4558  AlignedAttr *AlignasAttr = 
nullptr;
 
 4559  AlignedAttr *LastAlignedAttr = 
nullptr;
 
 4562    if (I->isAlignmentDependent())
 
 4566    Align = std::max(Align, I->getAlignment(
Context));
 
 4567    LastAlignedAttr = I;
 
 4571    Diag(LastAlignedAttr->getLocation(), diag::err_attribute_sizeless_type)
 
 4572        << LastAlignedAttr << DiagTy;
 
 4573  } 
else if (AlignasAttr && Align) {
 
 4576    if (NaturalAlign > RequestedAlign)
 
 4577      Diag(AlignasAttr->getLocation(), diag::err_alignas_underaligned)
 
 
 4604  Diag(Range.getBegin(), diag::err_mismatched_ms_inheritance)
 
 
 4613                             bool &IntegerMode, 
bool &ComplexMode,
 
 4616  ComplexMode = 
false;
 
 4618  switch (Str.size()) {
 
 4638      DestWidth = Str[1] == 
'I' ? 0 : 128;
 
 4646      DestWidth = Str[1] == 
'I' ? 0 : 128;
 
 4649    if (Str[1] == 
'F') {
 
 4650      IntegerMode = 
false;
 
 4651    } 
else if (Str[1] == 
'C') {
 
 4652      IntegerMode = 
false;
 
 4654    } 
else if (Str[1] != 
'I') {
 
 4663    else if (Str == 
"byte")
 
 4667    if (Str == 
"pointer")
 
 4671    if (Str == 
"unwind_word")
 
 
 4687    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 
 4699  StringRef Str = Name->
getName();
 
 4703  unsigned DestWidth = 0;
 
 4704  bool IntegerMode = 
true;
 
 4705  bool ComplexMode = 
false;
 
 4707  llvm::APInt VectorSize(64, 0);
 
 4708  if (Str.size() >= 4 && Str[0] == 
'V') {
 
 4710    size_t StrSize = Str.size();
 
 4711    size_t VectorStringLength = 0;
 
 4712    while ((VectorStringLength + 1) < StrSize &&
 
 4713           isdigit(Str[VectorStringLength + 1]))
 
 4714      ++VectorStringLength;
 
 4715    if (VectorStringLength &&
 
 4716        !Str.substr(1, VectorStringLength).getAsInteger(10, VectorSize) &&
 
 4717        VectorSize.isPowerOf2()) {
 
 4719                       IntegerMode, ComplexMode, ExplicitType);
 
 4721      if (!InInstantiation)
 
 4722        Diag(AttrLoc, diag::warn_vector_mode_deprecated);
 
 4737    Diag(AttrLoc, diag::err_machine_mode) << 0  << Name;
 
 4742  if (
const auto *TD = dyn_cast<TypedefNameDecl>(D))
 
 4743    OldTy = TD->getUnderlyingType();
 
 4744  else if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
 
 4747    OldTy = ED->getIntegerType();
 
 4762    OldElemTy = VT->getElementType();
 
 4768      VectorSize.getBoolValue()) {
 
 4769    Diag(AttrLoc, diag::err_enum_mode_vector_type) << Name << CI.
getRange();
 
 4777      !IntegralOrAnyEnumType)
 
 4778    Diag(AttrLoc, diag::err_mode_not_primitive);
 
 4779  else if (IntegerMode) {
 
 4780    if (!IntegralOrAnyEnumType)
 
 4781      Diag(AttrLoc, diag::err_mode_wrong_type);
 
 4782  } 
else if (ComplexMode) {
 
 4784      Diag(AttrLoc, diag::err_mode_wrong_type);
 
 4787      Diag(AttrLoc, diag::err_mode_wrong_type);
 
 4793    NewElemTy = 
Context.getIntTypeForBitwidth(DestWidth,
 
 4796    NewElemTy = 
Context.getRealTypeForBitwidth(DestWidth, ExplicitType);
 
 4798  if (NewElemTy.
isNull()) {
 
 4800    if (!(DestWidth == 128 &&
 
 4802      Diag(AttrLoc, diag::err_machine_mode) << 1  << Name;
 
 4807    NewElemTy = 
Context.getComplexType(NewElemTy);
 
 4811  if (VectorSize.getBoolValue()) {
 
 4812    NewTy = 
Context.getVectorType(NewTy, VectorSize.getZExtValue(),
 
 4817      Diag(AttrLoc, diag::err_complex_mode_vector_type);
 
 4820    unsigned NumElements = 
Context.getTypeSize(OldElemTy) *
 
 4821                           OldVT->getNumElements() /
 
 4822                           Context.getTypeSize(NewElemTy);
 
 4824        Context.getVectorType(NewElemTy, NumElements, OldVT->getVectorKind());
 
 4828    Diag(AttrLoc, diag::err_mode_wrong_type);
 
 4833  if (
auto *TD = dyn_cast<TypedefNameDecl>(D))
 
 4834    TD->setModedTypeSourceInfo(TD->getTypeSourceInfo(), NewTy);
 
 4835  else if (
auto *ED = dyn_cast<EnumDecl>(D))
 
 4836    ED->setIntegerType(NewTy);
 
 
 4864  if (OptimizeNoneAttr *Optnone = D->
getAttr<OptimizeNoneAttr>()) {
 
 4865    Diag(CI.
getLoc(), diag::warn_attribute_ignored) << Ident;
 
 4866    Diag(Optnone->getLocation(), diag::note_conflicting_attribute);
 
 4870  if (D->
hasAttr<AlwaysInlineAttr>())
 
 
 4878  if (
const auto *VD = dyn_cast<VarDecl>(D)) {
 
 4881    if (VD->getKind() != Decl::Var) {
 
 4882      Diag(AL.
getLoc(), diag::warn_attribute_wrong_decl_type)
 
 4889    if (VD->hasLocalStorage()) {
 
 4890      Diag(VD->getLocation(), diag::warn_internal_linkage_local_storage);
 
 
 4897InternalLinkageAttr *
 
 4899  if (
const auto *VD = dyn_cast<VarDecl>(D)) {
 
 4902    if (VD->getKind() != Decl::Var) {
 
 4903      Diag(AL.getLocation(), diag::warn_attribute_wrong_decl_type)
 
 4904          << &AL << AL.isRegularKeywordAttribute()
 
 4910    if (VD->hasLocalStorage()) {
 
 4911      Diag(VD->getLocation(), diag::warn_internal_linkage_local_storage);
 
 
 4920  if (OptimizeNoneAttr *Optnone = D->
getAttr<OptimizeNoneAttr>()) {
 
 4921    Diag(CI.
getLoc(), diag::warn_attribute_ignored) << 
"'minsize'";
 
 4922    Diag(Optnone->getLocation(), diag::note_conflicting_attribute);
 
 4926  if (D->
hasAttr<MinSizeAttr>())
 
 
 4934  if (AlwaysInlineAttr *Inline = D->
getAttr<AlwaysInlineAttr>()) {
 
 4935    Diag(Inline->getLocation(), diag::warn_attribute_ignored) << Inline;
 
 4936    Diag(CI.
getLoc(), diag::note_conflicting_attribute);
 
 4939  if (MinSizeAttr *MinSize = D->
getAttr<MinSizeAttr>()) {
 
 4940    Diag(MinSize->getLocation(), diag::warn_attribute_ignored) << MinSize;
 
 4941    Diag(CI.
getLoc(), diag::note_conflicting_attribute);
 
 4945  if (D->
hasAttr<OptimizeNoneAttr>())
 
 
 4952  if (AlwaysInlineAttr *Inline =
 
 
 4969  if (VD->hasLocalStorage()) {
 
 4970    S.
Diag(AL.
getLoc(), diag::err_cuda_nonstatic_constdev);
 
 4975  if (
auto *A = D->
getAttr<CUDAConstantAttr>()) {
 
 4976    if (!A->isImplicit())
 
 
 4987  if (!S.
getLangOpts().GPURelocatableDeviceCode && VD->hasExternalStorage() &&
 
 4989    S.
Diag(AL.
getLoc(), diag::err_cuda_extern_shared) << VD;
 
 4992  if (S.
getLangOpts().CUDA && VD->hasLocalStorage() &&
 
 
 5011  if (
const auto *Method = dyn_cast<CXXMethodDecl>(FD)) {
 
 5012    if (Method->isInstance()) {
 
 5013      S.
Diag(Method->getBeginLoc(), diag::err_kern_is_nonstatic_method)
 
 5017    S.
Diag(Method->getBeginLoc(), diag::warn_kern_is_method) << Method;
 
 5023  if (AL.
getKind() == ParsedAttr::AT_DeviceKernel)
 
 
 5036  if (
const auto *VD = dyn_cast<VarDecl>(D)) {
 
 5037    if (VD->hasLocalStorage()) {
 
 5038      S.
Diag(AL.
getLoc(), diag::err_cuda_nonstatic_constdev);
 
 5043  if (
auto *A = D->
getAttr<CUDADeviceAttr>()) {
 
 5044    if (!A->isImplicit())
 
 
 5052  if (
const auto *VD = dyn_cast<VarDecl>(D)) {
 
 5053    if (VD->hasLocalStorage()) {
 
 5054      S.
Diag(AL.
getLoc(), diag::err_cuda_nonstatic_constdev);
 
 5058  if (!D->
hasAttr<HIPManagedAttr>())
 
 5060  if (!D->
hasAttr<CUDADeviceAttr>())
 
 
 5075  if (!Fn->isInlineSpecified()) {
 
 5076    S.
Diag(AL.
getLoc(), diag::warn_gnu_inline_attribute_requires_inline);
 
 5081    S.
Diag(AL.
getLoc(), diag::warn_gnu_inline_cplusplus_without_extern);
 
 
 5098    S.
Diag(AL.
getLoc(), diag::warn_attribute_wrong_decl_type)
 
 5104  case ParsedAttr::AT_FastCall:
 
 5107  case ParsedAttr::AT_StdCall:
 
 5110  case ParsedAttr::AT_ThisCall:
 
 5113  case ParsedAttr::AT_CDecl:
 
 5116  case ParsedAttr::AT_Pascal:
 
 5119  case ParsedAttr::AT_SwiftCall:
 
 5122  case ParsedAttr::AT_SwiftAsyncCall:
 
 5125  case ParsedAttr::AT_VectorCall:
 
 5128  case ParsedAttr::AT_MSABI:
 
 5131  case ParsedAttr::AT_SysVABI:
 
 5134  case ParsedAttr::AT_RegCall:
 
 5137  case ParsedAttr::AT_Pcs: {
 
 5138    PcsAttr::PCSType PCS;
 
 5141      PCS = PcsAttr::AAPCS;
 
 5144      PCS = PcsAttr::AAPCS_VFP;
 
 5147      llvm_unreachable(
"unexpected calling convention in pcs attribute");
 
 5153  case ParsedAttr::AT_AArch64VectorPcs:
 
 5156  case ParsedAttr::AT_AArch64SVEPcs:
 
 5159  case ParsedAttr::AT_DeviceKernel: {
 
 5161    assert(D->
hasAttr<DeviceKernelAttr>() && 
"Expected attribute");
 
 5164  case ParsedAttr::AT_IntelOclBicc:
 
 5167  case ParsedAttr::AT_PreserveMost:
 
 5170  case ParsedAttr::AT_PreserveAll:
 
 5173  case ParsedAttr::AT_M68kRTD:
 
 5176  case ParsedAttr::AT_PreserveNone:
 
 5179  case ParsedAttr::AT_RISCVVectorCC:
 
 5182  case ParsedAttr::AT_RISCVVLSCC: {
 
 5189      S.
Diag(AL.
getLoc(), diag::err_argument_invalid_range)
 
 5194      S.
Diag(AL.
getLoc(), diag::err_argument_not_power_of_2);
 
 5202    llvm_unreachable(
"unexpected attribute kind");
 
 
 5207  const auto *FD = dyn_cast_or_null<FunctionDecl>(D);
 
 5213    S.
Diag(AL.
getLoc(), diag::err_hidden_device_kernel) << FD;
 
 5217  if (Triple.isNVPTX()) {
 
 5221    if (!LangOpts.OpenCLCPlusPlus && (!FD || IsFunctionTemplate)) {
 
 5222      S.
Diag(AL.
getLoc(), diag::err_attribute_wrong_decl_type_str)
 
 5230  bool TargetDeviceEnvironment = Triple.isGPU() || Triple.isSPIR() ||
 
 5232  if (!TargetDeviceEnvironment) {
 
 5233    S.
Diag(AL.
getLoc(), diag::warn_cconv_unsupported)
 
 
 5251  std::vector<StringRef> DiagnosticIdentifiers;
 
 5252  for (
unsigned I = 0, E = AL.
getNumArgs(); I != E; ++I) {
 
 5258    DiagnosticIdentifiers.push_back(RuleName);
 
 5261                 SuppressAttr(S.
Context, AL, DiagnosticIdentifiers.data(),
 
 5262                              DiagnosticIdentifiers.size()));
 
 
 5271    unsigned SelectIdx = ~0
U;
 
 5277    if (SelectIdx != ~0
U) {
 
 5278      S.
Diag(AL.
getLoc(), diag::err_attribute_invalid_argument)
 
 5290  if (AL.
getKind() == ParsedAttr::AT_Owner) {
 
 5293    if (
const auto *OAttr = D->
getAttr<OwnerAttr>()) {
 
 5294      const Type *ExistingDerefType = OAttr->getDerefTypeLoc()
 
 5295                                          ? OAttr->getDerefType().getTypePtr()
 
 5298        S.
Diag(AL.
getLoc(), diag::err_attributes_are_not_compatible)
 
 5301                OAttr->isRegularKeywordAttribute());
 
 5302        S.
Diag(OAttr->getLocation(), diag::note_conflicting_attribute);
 
 5307      Redecl->addAttr(::new (S.
Context) OwnerAttr(S.
Context, AL, DerefTypeLoc));
 
 5312    if (
const auto *PAttr = D->
getAttr<PointerAttr>()) {
 
 5313      const Type *ExistingDerefType = PAttr->getDerefTypeLoc()
 
 5314                                          ? PAttr->getDerefType().getTypePtr()
 
 5317        S.
Diag(AL.
getLoc(), diag::err_attributes_are_not_compatible)
 
 5320                PAttr->isRegularKeywordAttribute());
 
 5321        S.
Diag(PAttr->getLocation(), diag::note_conflicting_attribute);
 
 5326      Redecl->addAttr(::new (S.
Context)
 
 5327                          PointerAttr(S.
Context, AL, DerefTypeLoc));
 
 
 5335  if (!D->
hasAttr<RandomizeLayoutAttr>())
 
 
 5343  if (!D->
hasAttr<NoRandomizeLayoutAttr>())
 
 
 5358  if (Attrs.
getKind() == ParsedAttr::AT_RISCVVLSCC) {
 
 5366    unsigned ReqArgs = Attrs.
getKind() == ParsedAttr::AT_Pcs ? 1 : 0;
 
 5373  bool IsTargetDefaultMSABI =
 
 5374      Context.getTargetInfo().getTriple().isOSWindows() ||
 
 5375      Context.getTargetInfo().getTriple().isUEFI();
 
 5378  case ParsedAttr::AT_CDecl:
 
 5381  case ParsedAttr::AT_FastCall:
 
 5384  case ParsedAttr::AT_StdCall:
 
 5387  case ParsedAttr::AT_ThisCall:
 
 5390  case ParsedAttr::AT_Pascal:
 
 5393  case ParsedAttr::AT_SwiftCall:
 
 5396  case ParsedAttr::AT_SwiftAsyncCall:
 
 5399  case ParsedAttr::AT_VectorCall:
 
 5402  case ParsedAttr::AT_AArch64VectorPcs:
 
 5405  case ParsedAttr::AT_AArch64SVEPcs:
 
 5408  case ParsedAttr::AT_RegCall:
 
 5411  case ParsedAttr::AT_MSABI:
 
 5414  case ParsedAttr::AT_SysVABI:
 
 5417  case ParsedAttr::AT_Pcs: {
 
 5423    if (StrRef == 
"aapcs") {
 
 5426    } 
else if (StrRef == 
"aapcs-vfp") {
 
 5435  case ParsedAttr::AT_IntelOclBicc:
 
 5438  case ParsedAttr::AT_PreserveMost:
 
 5441  case ParsedAttr::AT_PreserveAll:
 
 5444  case ParsedAttr::AT_M68kRTD:
 
 5447  case ParsedAttr::AT_PreserveNone:
 
 5450  case ParsedAttr::AT_RISCVVectorCC:
 
 5453  case ParsedAttr::AT_RISCVVLSCC: {
 
 5456    unsigned ABIVLen = 128;
 
 5462    if (Attrs.
getNumArgs() && (ABIVLen < 32 || ABIVLen > 65536)) {
 
 5464      Diag(Attrs.
getLoc(), diag::err_argument_invalid_range)
 
 5465          << ABIVLen << 32 << 65536;
 
 5468    if (!llvm::isPowerOf2_64(ABIVLen)) {
 
 5470      Diag(Attrs.
getLoc(), diag::err_argument_not_power_of_2);
 
 5474                                  llvm::Log2_64(ABIVLen) - 5);
 
 5477  case ParsedAttr::AT_DeviceKernel: {
 
 5482  default: llvm_unreachable(
"unexpected attribute kind");
 
 5487  auto *Aux = 
Context.getAuxTargetInfo();
 
 5495    bool CheckHost = 
false, CheckDevice = 
false;
 
 5496    switch (CudaTarget) {
 
 5509      llvm_unreachable(
"unexpected cuda target");
 
 5511    auto *HostTI = 
LangOpts.CUDAIsDevice ? Aux : &TI;
 
 5512    auto *DeviceTI = 
LangOpts.CUDAIsDevice ? &TI : Aux;
 
 5513    if (CheckHost && HostTI)
 
 5516      A = DeviceTI->checkCallingConvention(CC);
 
 5525      A = Aux->checkCallingConvention(CC);
 
 5543    Diag(Attrs.
getLoc(), diag::error_cconv_unsupported)
 
 5548    Diag(Attrs.
getLoc(), diag::warn_cconv_unsupported)
 
 5553    bool IsCXXMethod = 
false, IsVariadic = 
false;
 
 5558    CC = 
Context.getDefaultCallingConvention(IsVariadic, IsCXXMethod);
 
 
 5583  if (
Context.getTargetInfo().getRegParmMax() == 0) {
 
 5584    Diag(AL.
getLoc(), diag::err_attribute_regparm_wrong_platform)
 
 5591  if (numParams > 
Context.getTargetInfo().getRegParmMax()) {
 
 5592    Diag(AL.
getLoc(), diag::err_attribute_regparm_invalid_number)
 
 
 5604    llvm_unreachable(
"getOffloadArch is only valid for NVPTX triple");
 
 
 5614                                     const CUDALaunchBoundsAttr &AL,
 
 5615                                     const unsigned Idx) {
 
 5624  std::optional<llvm::APSInt> I = llvm::APSInt(64);
 
 5631  if (!I->isIntN(32)) {
 
 5633        << 
toString(*I, 10, 
false) << 32 <<  1;
 
 5637    S.
Diag(E->
getExprLoc(), diag::warn_attribute_argument_n_negative)
 
 5645         "Unexpected PerformCopyInitialization() failure.");
 
 
 5650CUDALaunchBoundsAttr *
 
 5652                             Expr *MinBlocks, 
Expr *MaxBlocks) {
 
 5653  CUDALaunchBoundsAttr TmpAttr(
Context, CI, MaxThreads, MinBlocks, MaxBlocks);
 
 5671      MaxBlocks = 
nullptr;
 
 5680      CUDALaunchBoundsAttr(
Context, CI, MaxThreads, MinBlocks, MaxBlocks);
 
 
 5699static std::pair<Expr *, int>
 
 5701                       const unsigned Idx) {
 
 5717  if (!I->isIntN(4)) {
 
 5719        << 
toString(*I, 10, 
false) << 4 << 1;
 
 5723    S.
Diag(E->
getExprLoc(), diag::warn_attribute_argument_n_negative)
 
 
 5733  CUDAClusterDimsAttr TmpAttr(
Context, CI, 
X, Y, Z);
 
 5739  if (!NewX || (Y && !NewY) || (Z && !NewZ))
 
 5742  int FlatDim = ValX * ValY * ValZ;
 
 5743  const llvm::Triple TT =
 
 5744      (!
Context.getLangOpts().CUDAIsDevice && 
Context.getAuxTargetInfo())
 
 5745          ? 
Context.getAuxTargetInfo()->getTriple()
 
 5746          : 
Context.getTargetInfo().getTriple();
 
 5750  else if (TT.isAMDGPU())
 
 5757  if (FlatDim > MaxDim) {
 
 5758    Diag(CI.
getLoc(), diag::err_cluster_dims_too_large) << MaxDim << FlatDim;
 
 5762  return CUDAClusterDimsAttr::Create(
Context, NewX, NewY, NewZ, CI);
 
 
 5781    S.
Diag(AL.
getLoc(), diag::err_cluster_attr_not_supported) << AL;
 
 
 5800    S.
Diag(AL.
getLoc(), diag::err_cluster_attr_not_supported) << AL;
 
 
 5810    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
 
 5832    unsigned ArgumentIdxAST = ArgumentIdx.
getASTIndex();
 
 5835      S.
Diag(AL.
getLoc(), diag::err_attribute_pointers_only) << AL << 0;
 
 5840      TypeTagIdx, IsPointer));
 
 
 5846    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
 
 5855    S.
Diag(AL.
getLoc(), diag::err_attribute_wrong_decl_type)
 
 5863  assert(MatchingCTypeLoc && 
"no type source info for attribute argument");
 
 
 5886    S.
Diag(AL.
getLoc(), diag::err_aix_attr_unsupported) << AL;
 
 5889  uint32_t Count = 0, Offset = 0;
 
 5897    if (Count < Offset) {
 
 5898      S.
Diag(S.
getAttrLoc(AL), diag::err_attribute_argument_out_of_range)
 
 5909             diag::err_attribute_patchable_function_entry_invalid_section)
 
 5913    if (Section.empty()) {
 
 5915             diag::err_attribute_patchable_function_entry_invalid_section)
 
 5916          << 
"section must not be empty";
 
 
 5926    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_n_type)
 
 5944      (!IsAArch64 && !IsARM && !IsRISCV && !IsHLSL && !IsSPIRV)) {
 
 5945    S.
Diag(AL.
getLoc(), diag::err_attribute_builtin_alias) << AL;
 
 
 5956  if (
auto *CRD = dyn_cast<CXXRecordDecl>(D);
 
 5957      !CRD || !(CRD->isClass() || CRD->isStruct())) {
 
 
 5968    S.
Diag(AL.
getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 1;
 
 5974  assert(ParmTSI && 
"no type source info for attribute argument");
 
 5976                        diag::err_incomplete_type);
 
 
 5986                              StringRef UuidAsWritten, 
MSGuidDecl *GuidDecl) {
 
 5987  if (
const auto *UA = D->
getAttr<UuidAttr>()) {
 
 5990    if (!UA->getGuid().empty()) {
 
 5991      Diag(UA->getLocation(), diag::err_mismatched_uuid);
 
 5997  return ::new (
Context) UuidAttr(
Context, CI, UuidAsWritten, GuidDecl);
 
 
 6002    S.
Diag(AL.
getLoc(), diag::err_attribute_not_supported_in_lang)
 
 6007  StringRef OrigStrRef;
 
 6014  StringRef StrRef = OrigStrRef;
 
 6015  if (StrRef.size() == 38 && StrRef.front() == 
'{' && StrRef.back() == 
'}')
 
 6016    StrRef = StrRef.drop_front().drop_back();
 
 6019  if (StrRef.size() != 36) {
 
 6020    S.
Diag(LiteralLoc, diag::err_attribute_uuid_malformed_guid);
 
 6024  for (
unsigned i = 0; i < 36; ++i) {
 
 6025    if (i == 8 || i == 13 || i == 18 || i == 23) {
 
 6026      if (StrRef[i] != 
'-') {
 
 6027        S.
Diag(LiteralLoc, diag::err_attribute_uuid_malformed_guid);
 
 6031      S.
Diag(LiteralLoc, diag::err_attribute_uuid_malformed_guid);
 
 6038  StrRef.substr(0, 8).getAsInteger(16, Parsed.
Part1);
 
 6039  StrRef.substr(9, 4).getAsInteger(16, Parsed.
Part2);
 
 6040  StrRef.substr(14, 4).getAsInteger(16, Parsed.
Part3);
 
 6041  for (
unsigned i = 0; i != 8; ++i)
 
 6042    StrRef.substr(19 + 2 * i + (i >= 2 ? 1 : 0), 2)
 
 6053    S.
Diag(AL.
getLoc(), diag::warn_atl_uuid_deprecated);
 
 
 6062    S.
Diag(AL.
getLoc(), diag::err_attribute_not_supported_in_lang)
 
 
 6077    S.
Diag(AL.
getLoc(), diag::err_thread_unsupported);
 
 6081    S.
Diag(AL.
getLoc(), diag::err_declspec_thread_on_thread_variable);
 
 6084  if (VD->hasLocalStorage()) {
 
 6085    S.
Diag(AL.
getLoc(), diag::err_thread_non_global) << 
"__declspec(thread)";
 
 
 6093    S.
Diag(AL.
getLoc(), diag::warn_unknown_attribute_ignored)
 
 6099    S.
Diag(AL.
getLoc(), diag::err_ms_constexpr_cannot_be_applied)
 
 6103  if (
auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
 
 6104    if (!S.
getLangOpts().CPlusPlus20 && MD->isVirtual()) {
 
 6105      S.
Diag(AL.
getLoc(), diag::err_ms_constexpr_cannot_be_applied)
 
 
 6115  for (
unsigned I = 0, E = AL.
getNumArgs(); I != E; ++I) {
 
 6119    Tags.push_back(Tag);
 
 6122  if (
const auto *NS = dyn_cast<NamespaceDecl>(D)) {
 
 6123    if (!NS->isInline()) {
 
 6124      S.
Diag(AL.
getLoc(), diag::warn_attr_abi_tag_namespace) << 0;
 
 6127    if (NS->isAnonymousNamespace()) {
 
 6128      S.
Diag(AL.
getLoc(), diag::warn_attr_abi_tag_namespace) << 1;
 
 6132      Tags.push_back(NS->getName());
 
 6138  Tags.erase(llvm::unique(Tags), Tags.end());
 
 6141                 AbiTagAttr(S.
Context, AL, Tags.data(), Tags.size()));
 
 
 6146    if (I->getBTFDeclTag() == Tag)
 
 
 6165  return ::new (
Context) BTFDeclTagAttr(
Context, AL, AL.getBTFDeclTag());
 
 
 6171  case llvm::Triple::msp430:
 
 6174  case llvm::Triple::mipsel:
 
 6175  case llvm::Triple::mips:
 
 6178  case llvm::Triple::m68k:
 
 6181  case llvm::Triple::x86:
 
 6182  case llvm::Triple::x86_64:
 
 6185  case llvm::Triple::avr:
 
 6188  case llvm::Triple::riscv32:
 
 6189  case llvm::Triple::riscv64:
 
 
 6206    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_out_of_bounds)
 
 
 6221  if (D->
hasAttr<DLLExportAttr>()) {
 
 6222    Diag(CI.
getLoc(), diag::warn_attribute_ignored) << 
"'dllimport'";
 
 6226  if (D->
hasAttr<DLLImportAttr>())
 
 
 6234  if (DLLImportAttr *Import = D->
getAttr<DLLImportAttr>()) {
 
 6235    Diag(Import->getLocation(), diag::warn_attribute_ignored) << Import;
 
 6239  if (D->
hasAttr<DLLExportAttr>())
 
 
 6252  if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
 
 6262  if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
 
 6264        MD->getParent()->isLambda()) {
 
 6270  Attr *NewAttr = A.
getKind() == ParsedAttr::AT_DLLExport
 
 
 6281  if (MSInheritanceAttr *IA = D->
getAttr<MSInheritanceAttr>()) {
 
 6282    if (IA->getInheritanceModel() == Model)
 
 6284    Diag(IA->getLocation(), diag::err_mismatched_ms_inheritance)
 
 6286    Diag(CI.
getLoc(), diag::note_previous_ms_inheritance);
 
 6291  if (RD->hasDefinition()) {
 
 6298      Diag(CI.
getLoc(), diag::warn_ignored_ms_inheritance)
 
 6302    if (RD->getDescribedClassTemplate()) {
 
 6303      Diag(CI.
getLoc(), diag::warn_ignored_ms_inheritance)
 
 
 6321  StringRef N(
"mutex");
 
 6323  if (AL.
getKind() == ParsedAttr::AT_Capability &&
 
 
 6336  if (!D->
hasAttr<CapabilityAttr>()) {
 
 6337    S.
Diag(AL.
getLoc(), diag::warn_thread_attribute_requires_preceded)
 
 6338        << AL << cast<NamedDecl>(D) << 
"'capability'";
 
 
 6351                 AssertCapabilityAttr(S.
Context, AL, Args.data(), Args.size()));
 
 
 6356  if (
const auto *ParmDecl = dyn_cast<ParmVarDecl>(D);
 
 
 6380  if (
const auto *ParmDecl = dyn_cast<ParmVarDecl>(D);
 
 
 6393  if (
const auto *ParmDecl = dyn_cast<ParmVarDecl>(D);
 
 6406  RequiresCapabilityAttr *RCA = ::new (S.
Context)
 
 6407      RequiresCapabilityAttr(S.
Context, AL, Args.data(), Args.size());
 
 
 6413  if (
const auto *NSD = dyn_cast<NamespaceDecl>(D)) {
 
 6414    if (NSD->isAnonymousNamespace()) {
 
 6415      S.
Diag(AL.
getLoc(), diag::warn_deprecated_anonymous_namespace);
 
 6429  StringRef Str, Replacement;
 
 6442    S.
Diag(AL.
getLoc(), diag::ext_cxx14_attr) << AL;
 
 
 6448  if (
const auto *S = dyn_cast<VarDecl>(D))
 
 6449    return S->hasGlobalStorage();
 
 
 6454  return Sanitizer == 
"address" || Sanitizer == 
"hwaddress" ||
 
 6455         Sanitizer == 
"memtag";
 
 
 6462  std::vector<StringRef> Sanitizers;
 
 6464  for (
unsigned I = 0, E = AL.
getNumArgs(); I != E; ++I) {
 
 6465    StringRef SanitizerName;
 
 6473        SanitizerName != 
"coverage")
 
 6474      S.
Diag(LiteralLoc, diag::warn_unknown_sanitizer_ignored) << SanitizerName;
 
 6476      S.
Diag(D->
getLocation(), diag::warn_attribute_type_not_supported_global)
 
 6477          << AL << SanitizerName;
 
 6478    Sanitizers.push_back(SanitizerName);
 
 6482                                              Sanitizers.size()));
 
 
 6495  unsigned TranslatedSpellingIndex = 0;
 
 6497    TranslatedSpellingIndex = 1;
 
 
 6506  StringRef SanitizerName = 
"address";
 
 6509                 NoSanitizeAttr(S.
Context, Info, &SanitizerName, 1));
 
 
 6513  StringRef SanitizerName = 
"thread";
 
 6516                 NoSanitizeAttr(S.
Context, Info, &SanitizerName, 1));
 
 
 6520  StringRef SanitizerName = 
"memory";
 
 6523                 NoSanitizeAttr(S.
Context, Info, &SanitizerName, 1));
 
 
 6538  ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind Kind;
 
 6539  if (!ZeroCallUsedRegsAttr::ConvertStrToZeroCallUsedRegsKind(KindStr, Kind)) {
 
 6540    S.
Diag(LiteralLoc, diag::warn_attribute_type_not_supported)
 
 6545  D->
dropAttr<ZeroCallUsedRegsAttr>();
 
 
 6550  auto *FD = dyn_cast<FieldDecl>(D);
 
 6560  case ParsedAttr::AT_CountedBy:
 
 6561    CountInBytes = 
false;
 
 6564  case ParsedAttr::AT_CountedByOrNull:
 
 6565    CountInBytes = 
false;
 
 6568  case ParsedAttr::AT_SizedBy:
 
 6569    CountInBytes = 
true;
 
 6572  case ParsedAttr::AT_SizedByOrNull:
 
 6573    CountInBytes = 
true;
 
 6577    llvm_unreachable(
"unexpected counted_by family attribute");
 
 6584      FD->
getType(), CountExpr, CountInBytes, OrNull);
 
 
 6595  FunctionReturnThunksAttr::Kind Kind;
 
 6596  if (!FunctionReturnThunksAttr::ConvertStrToKind(KindStr, Kind)) {
 
 6597    S.
Diag(LiteralLoc, diag::warn_attribute_type_not_supported)
 
 6604  D->
dropAttr<FunctionReturnThunksAttr>();
 
 6605  D->
addAttr(FunctionReturnThunksAttr::Create(S.
Context, Kind, AL));
 
 
 6615  auto *VDecl = dyn_cast<VarDecl>(D);
 
 6616  if (VDecl && !VDecl->isFunctionPointerType()) {
 
 6617    S.
Diag(AL.
getLoc(), diag::warn_attribute_ignored_non_function_pointer)
 
 
 6631        << (A.
getKind() == ParsedAttr::AT_AlwaysDestroy);
 
 6635  if (A.
getKind() == ParsedAttr::AT_AlwaysDestroy)
 
 
 6643         "uninitialized is only valid on automatic duration variables");
 
 
 6654    bool IsKernReturnT = 
false;
 
 6656      IsKernReturnT = (TT->getDecl()->getName() == 
"kern_return_t");
 
 6661             diag::warn_mig_server_routine_does_not_return_kern_return_t);
 
 
 6671  if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
 
 6674      S.
Diag(AL.
getLoc(), diag::warn_declspec_allocator_nonpointer)
 
 
 6687  if (
const auto *PVD = dyn_cast<ParmVarDecl>(D)) {
 
 6688    if (PVD->getType()->isIntegerType()) {
 
 6689      S.
Diag(AL.
getLoc(), diag::err_attribute_output_parameter)
 
 
 6700template<
typename Attr>
 
 6708template<
typename Attr>
 
 6717    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 6722  CFGuardAttr::GuardArg Arg;
 
 6724  if (!CFGuardAttr::ConvertStrToGuardArg(II->
getName(), Arg)) {
 
 6725    S.
Diag(AL.
getLoc(), diag::warn_attribute_type_not_supported) << AL << II;
 
 
 6733template <
typename AttrTy>
 
 6736  auto I = llvm::find_if(Attrs,
 
 6737                         [Name](
const AttrTy *A) {
 
 6738                           return A->getTCBName() == Name;
 
 6740  return I == Attrs.end() ? 
nullptr : *I;
 
 
 6743template <
typename AttrTy, 
typename ConflictingAttrTy>
 
 6750  if (
const ConflictingAttrTy *ConflictingAttr =
 
 6754    S.
Diag(AL.
getLoc(), diag::err_tcb_conflicting_attributes)
 
 
 6768template <
typename AttrTy, 
typename ConflictingAttrTy>
 
 6771  StringRef TCBName = AL.getTCBName();
 
 6772  if (
const ConflictingAttrTy *ConflictingAttr =
 
 6774    S.
Diag(ConflictingAttr->getLoc(), diag::err_tcb_conflicting_attributes)
 
 6775      << ConflictingAttr->getAttrName()->getName()
 
 6776      << AL.getAttrName()->getName() << TCBName;
 
 6779    S.
Diag(AL.getLoc(), diag::note_conflicting_attribute);
 
 6787  return ::new(Context) AttrTy(Context, AL, AL.getTCBName());
 
 
 6796    Decl *D, 
const EnforceTCBLeafAttr &AL) {
 
 
 6806    S.
Diag(AL.
getLoc(), diag::err_attribute_too_many_arguments) << AL << 4;
 
 6811    S.
Diag(AL.
getLoc(), diag::err_attribute_too_few_arguments) << AL;
 
 6816  if (D->
getAttr<VTablePointerAuthenticationAttr>()) {
 
 6817    S.
Diag(AL.
getLoc(), diag::err_duplicated_vtable_pointer_auth) << 
Decl;
 
 6821  auto KeyType = VTablePointerAuthenticationAttr::VPtrAuthKeyType::DefaultKey;
 
 6824    if (!VTablePointerAuthenticationAttr::ConvertStrToVPtrAuthKeyType(
 
 6826      S.
Diag(IL->
getLoc(), diag::err_invalid_authentication_key)
 
 6830    if (KeyType == VTablePointerAuthenticationAttr::DefaultKey &&
 
 6832      S.
Diag(AL.
getLoc(), diag::err_no_default_vtable_pointer_auth) << 0;
 
 6836    S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 6841  auto AddressDiversityMode = VTablePointerAuthenticationAttr::
 
 6842      AddressDiscriminationMode::DefaultAddressDiscrimination;
 
 6846      if (!VTablePointerAuthenticationAttr::
 
 6847              ConvertStrToAddressDiscriminationMode(
 
 6849        S.
Diag(IL->
getLoc(), diag::err_invalid_address_discrimination)
 
 6853      if (AddressDiversityMode ==
 
 6854              VTablePointerAuthenticationAttr::DefaultAddressDiscrimination &&
 
 6856        S.
Diag(IL->
getLoc(), diag::err_no_default_vtable_pointer_auth) << 1;
 
 6860      S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 6865  auto ED = VTablePointerAuthenticationAttr::ExtraDiscrimination::
 
 6866      DefaultExtraDiscrimination;
 
 6870      if (!VTablePointerAuthenticationAttr::ConvertStrToExtraDiscrimination(
 
 6872        S.
Diag(IL->
getLoc(), diag::err_invalid_extra_discrimination)
 
 6876      if (ED == VTablePointerAuthenticationAttr::DefaultExtraDiscrimination &&
 
 6878        S.
Diag(AL.
getLoc(), diag::err_no_default_vtable_pointer_auth) << 2;
 
 6882      S.
Diag(AL.
getLoc(), diag::err_attribute_argument_type)
 
 6887  uint32_t CustomDiscriminationValue = 0;
 
 6888  if (ED == VTablePointerAuthenticationAttr::CustomDiscrimination) {
 
 6890      S.
Diag(AL.
getLoc(), diag::err_missing_custom_discrimination) << AL << 4;
 
 6895      S.
Diag(AL.
getLoc(), diag::err_attribute_too_many_arguments) << AL << 4;
 
 6900                                                   CustomDiscriminationValue)) {
 
 6901      S.
Diag(AL.
getLoc(), diag::err_invalid_custom_discrimination);
 
 6904  } 
else if (NumArgs > 3) {
 
 6905    S.
Diag(AL.
getLoc(), diag::err_attribute_too_many_arguments) << AL << 3;
 
 6910      S.
Context, AL, KeyType, AddressDiversityMode, ED,
 
 6911      CustomDiscriminationValue));
 
 
 6927  for (
size_t I = 0; I < std::min(AL.
getNumArgs(), AttrNumArgs); ++I) {
 
 6928    bool IsLastAttrArg = I == (AttrNumArgs - 1);
 
 6931    if (IsLastAttrArg && AttrHasVariadicArg)
 
 6939      return !(IsLastAttrArg && ArgMemberCanHoldExpr);
 
 
 6975      S.
Diag(AL.
getLoc(), diag::err_keyword_not_supported_on_target)
 
 6978      S.
Diag(AL.
getLoc(), diag::warn_unhandled_ms_attribute_ignored)
 
 6993  if (MustDelayArgs) {
 
 7003      assert(AL.
isTypeAttr() && 
"Non-type attribute not handled");
 
 7029          S.
Diag(AL.
getLoc(), diag::warn_type_attribute_deprecated_on_decl)
 
 7038      if (AL.
getKind() == ParsedAttr::AT_Regparm) {
 
 7051      if (AL.
getKind() == ParsedAttr::AT_VectorSize) {
 
 7061      if (AL.
getKind() == ParsedAttr::AT_NoDeref) {
 
 7072    S.
Diag(AL.
getLoc(), diag::err_attribute_invalid_on_decl)
 
 7075  case ParsedAttr::AT_Interrupt:
 
 7078  case ParsedAttr::AT_ARMInterruptSaveFP:
 
 7081  case ParsedAttr::AT_X86ForceAlignArgPointer:
 
 7084  case ParsedAttr::AT_ReadOnlyPlacement:
 
 7087  case ParsedAttr::AT_DLLExport:
 
 7088  case ParsedAttr::AT_DLLImport:
 
 7091  case ParsedAttr::AT_AMDGPUFlatWorkGroupSize:
 
 7094  case ParsedAttr::AT_AMDGPUWavesPerEU:
 
 7097  case ParsedAttr::AT_AMDGPUNumSGPR:
 
 7100  case ParsedAttr::AT_AMDGPUNumVGPR:
 
 7103  case ParsedAttr::AT_AMDGPUMaxNumWorkGroups:
 
 7106  case ParsedAttr::AT_AVRSignal:
 
 7109  case ParsedAttr::AT_BPFPreserveAccessIndex:
 
 7112  case ParsedAttr::AT_BPFPreserveStaticOffset:
 
 7115  case ParsedAttr::AT_BTFDeclTag:
 
 7118  case ParsedAttr::AT_WebAssemblyExportName:
 
 7121  case ParsedAttr::AT_WebAssemblyImportModule:
 
 7124  case ParsedAttr::AT_WebAssemblyImportName:
 
 7127  case ParsedAttr::AT_IBOutlet:
 
 7130  case ParsedAttr::AT_IBOutletCollection:
 
 7133  case ParsedAttr::AT_IFunc:
 
 7136  case ParsedAttr::AT_Alias:
 
 7139  case ParsedAttr::AT_Aligned:
 
 7142  case ParsedAttr::AT_AlignValue:
 
 7145  case ParsedAttr::AT_AllocSize:
 
 7148  case ParsedAttr::AT_AlwaysInline:
 
 7151  case ParsedAttr::AT_AnalyzerNoReturn:
 
 7154  case ParsedAttr::AT_TLSModel:
 
 7157  case ParsedAttr::AT_Annotate:
 
 7160  case ParsedAttr::AT_Availability:
 
 7163  case ParsedAttr::AT_CarriesDependency:
 
 7166  case ParsedAttr::AT_CPUDispatch:
 
 7167  case ParsedAttr::AT_CPUSpecific:
 
 7170  case ParsedAttr::AT_Common:
 
 7173  case ParsedAttr::AT_CUDAConstant:
 
 7176  case ParsedAttr::AT_PassObjectSize:
 
 7179  case ParsedAttr::AT_Constructor:
 
 7182  case ParsedAttr::AT_Deprecated:
 
 7185  case ParsedAttr::AT_Destructor:
 
 7188  case ParsedAttr::AT_EnableIf:
 
 7191  case ParsedAttr::AT_Error:
 
 7194  case ParsedAttr::AT_ExcludeFromExplicitInstantiation:
 
 7197  case ParsedAttr::AT_DiagnoseIf:
 
 7200  case ParsedAttr::AT_DiagnoseAsBuiltin:
 
 7203  case ParsedAttr::AT_NoBuiltin:
 
 7206  case ParsedAttr::AT_CFIUncheckedCallee:
 
 7209  case ParsedAttr::AT_ExtVectorType:
 
 7212  case ParsedAttr::AT_ExternalSourceSymbol:
 
 7215  case ParsedAttr::AT_MinSize:
 
 7218  case ParsedAttr::AT_OptimizeNone:
 
 7221  case ParsedAttr::AT_EnumExtensibility:
 
 7224  case ParsedAttr::AT_SYCLKernel:
 
 7227  case ParsedAttr::AT_SYCLExternal:
 
 7230  case ParsedAttr::AT_SYCLKernelEntryPoint:
 
 7233  case ParsedAttr::AT_SYCLSpecialClass:
 
 7236  case ParsedAttr::AT_Format:
 
 7239  case ParsedAttr::AT_FormatMatches:
 
 7242  case ParsedAttr::AT_FormatArg:
 
 7245  case ParsedAttr::AT_Callback:
 
 7248  case ParsedAttr::AT_LifetimeCaptureBy:
 
 7251  case ParsedAttr::AT_CalledOnce:
 
 7254  case ParsedAttr::AT_CUDAGlobal:
 
 7257  case ParsedAttr::AT_CUDADevice:
 
 7260  case ParsedAttr::AT_CUDAGridConstant:
 
 7263  case ParsedAttr::AT_HIPManaged:
 
 7266  case ParsedAttr::AT_GNUInline:
 
 7269  case ParsedAttr::AT_CUDALaunchBounds:
 
 7272  case ParsedAttr::AT_CUDAClusterDims:
 
 7275  case ParsedAttr::AT_CUDANoCluster:
 
 7278  case ParsedAttr::AT_Restrict:
 
 7281  case ParsedAttr::AT_Mode:
 
 7284  case ParsedAttr::AT_NonString:
 
 7287  case ParsedAttr::AT_NonNull:
 
 7288    if (
auto *PVD = dyn_cast<ParmVarDecl>(D))
 
 7293  case ParsedAttr::AT_ReturnsNonNull:
 
 7296  case ParsedAttr::AT_NoEscape:
 
 7299  case ParsedAttr::AT_MaybeUndef:
 
 7302  case ParsedAttr::AT_AssumeAligned:
 
 7305  case ParsedAttr::AT_AllocAlign:
 
 7308  case ParsedAttr::AT_Ownership:
 
 7311  case ParsedAttr::AT_Naked:
 
 7314  case ParsedAttr::AT_NoReturn:
 
 7317  case ParsedAttr::AT_CXX11NoReturn:
 
 7320  case ParsedAttr::AT_AnyX86NoCfCheck:
 
 7323  case ParsedAttr::AT_NoThrow:
 
 7327  case ParsedAttr::AT_CUDAShared:
 
 7330  case ParsedAttr::AT_VecReturn:
 
 7333  case ParsedAttr::AT_ObjCOwnership:
 
 7336  case ParsedAttr::AT_ObjCPreciseLifetime:
 
 7339  case ParsedAttr::AT_ObjCReturnsInnerPointer:
 
 7342  case ParsedAttr::AT_ObjCRequiresSuper:
 
 7345  case ParsedAttr::AT_ObjCBridge:
 
 7348  case ParsedAttr::AT_ObjCBridgeMutable:
 
 7351  case ParsedAttr::AT_ObjCBridgeRelated:
 
 7354  case ParsedAttr::AT_ObjCDesignatedInitializer:
 
 7357  case ParsedAttr::AT_ObjCRuntimeName:
 
 7360  case ParsedAttr::AT_ObjCBoxable:
 
 7363  case ParsedAttr::AT_NSErrorDomain:
 
 7366  case ParsedAttr::AT_CFConsumed:
 
 7367  case ParsedAttr::AT_NSConsumed:
 
 7368  case ParsedAttr::AT_OSConsumed:
 
 7373  case ParsedAttr::AT_OSReturnsRetainedOnZero:
 
 7376        diag::warn_ns_attribute_wrong_parameter_type,
 
 7379  case ParsedAttr::AT_OSReturnsRetainedOnNonZero:
 
 7382        diag::warn_ns_attribute_wrong_parameter_type,
 
 7385  case ParsedAttr::AT_NSReturnsAutoreleased:
 
 7386  case ParsedAttr::AT_NSReturnsNotRetained:
 
 7387  case ParsedAttr::AT_NSReturnsRetained:
 
 7388  case ParsedAttr::AT_CFReturnsNotRetained:
 
 7389  case ParsedAttr::AT_CFReturnsRetained:
 
 7390  case ParsedAttr::AT_OSReturnsNotRetained:
 
 7391  case ParsedAttr::AT_OSReturnsRetained:
 
 7394  case ParsedAttr::AT_WorkGroupSizeHint:
 
 7397  case ParsedAttr::AT_ReqdWorkGroupSize:
 
 7400  case ParsedAttr::AT_OpenCLIntelReqdSubGroupSize:
 
 7403  case ParsedAttr::AT_VecTypeHint:
 
 7406  case ParsedAttr::AT_InitPriority:
 
 7409  case ParsedAttr::AT_Packed:
 
 7412  case ParsedAttr::AT_PreferredName:
 
 7415  case ParsedAttr::AT_NoSpecializations:
 
 7418  case ParsedAttr::AT_Section:
 
 7421  case ParsedAttr::AT_CodeModel:
 
 7424  case ParsedAttr::AT_RandomizeLayout:
 
 7427  case ParsedAttr::AT_NoRandomizeLayout:
 
 7430  case ParsedAttr::AT_CodeSeg:
 
 7433  case ParsedAttr::AT_Target:
 
 7436  case ParsedAttr::AT_TargetVersion:
 
 7439  case ParsedAttr::AT_TargetClones:
 
 7442  case ParsedAttr::AT_MinVectorWidth:
 
 7445  case ParsedAttr::AT_Unavailable:
 
 7448  case ParsedAttr::AT_OMPAssume:
 
 7451  case ParsedAttr::AT_ObjCDirect:
 
 7454  case ParsedAttr::AT_ObjCDirectMembers:
 
 7458  case ParsedAttr::AT_ObjCExplicitProtocolImpl:
 
 7461  case ParsedAttr::AT_Unused:
 
 7464  case ParsedAttr::AT_Visibility:
 
 7467  case ParsedAttr::AT_TypeVisibility:
 
 7470  case ParsedAttr::AT_WarnUnusedResult:
 
 7473  case ParsedAttr::AT_WeakRef:
 
 7476  case ParsedAttr::AT_WeakImport:
 
 7479  case ParsedAttr::AT_TransparentUnion:
 
 7482  case ParsedAttr::AT_ObjCMethodFamily:
 
 7485  case ParsedAttr::AT_ObjCNSObject:
 
 7488  case ParsedAttr::AT_ObjCIndependentClass:
 
 7491  case ParsedAttr::AT_Blocks:
 
 7494  case ParsedAttr::AT_Sentinel:
 
 7497  case ParsedAttr::AT_Cleanup:
 
 7500  case ParsedAttr::AT_NoDebug:
 
 7503  case ParsedAttr::AT_CmseNSEntry:
 
 7506  case ParsedAttr::AT_StdCall:
 
 7507  case ParsedAttr::AT_CDecl:
 
 7508  case ParsedAttr::AT_FastCall:
 
 7509  case ParsedAttr::AT_ThisCall:
 
 7510  case ParsedAttr::AT_Pascal:
 
 7511  case ParsedAttr::AT_RegCall:
 
 7512  case ParsedAttr::AT_SwiftCall:
 
 7513  case ParsedAttr::AT_SwiftAsyncCall:
 
 7514  case ParsedAttr::AT_VectorCall:
 
 7515  case ParsedAttr::AT_MSABI:
 
 7516  case ParsedAttr::AT_SysVABI:
 
 7517  case ParsedAttr::AT_Pcs:
 
 7518  case ParsedAttr::AT_IntelOclBicc:
 
 7519  case ParsedAttr::AT_PreserveMost:
 
 7520  case ParsedAttr::AT_PreserveAll:
 
 7521  case ParsedAttr::AT_AArch64VectorPcs:
 
 7522  case ParsedAttr::AT_AArch64SVEPcs:
 
 7523  case ParsedAttr::AT_M68kRTD:
 
 7524  case ParsedAttr::AT_PreserveNone:
 
 7525  case ParsedAttr::AT_RISCVVectorCC:
 
 7526  case ParsedAttr::AT_RISCVVLSCC:
 
 7529  case ParsedAttr::AT_DeviceKernel:
 
 7532  case ParsedAttr::AT_Suppress:
 
 7535  case ParsedAttr::AT_Owner:
 
 7536  case ParsedAttr::AT_Pointer:
 
 7539  case ParsedAttr::AT_OpenCLAccess:
 
 7542  case ParsedAttr::AT_OpenCLNoSVM:
 
 7545  case ParsedAttr::AT_SwiftContext:
 
 7548  case ParsedAttr::AT_SwiftAsyncContext:
 
 7551  case ParsedAttr::AT_SwiftErrorResult:
 
 7554  case ParsedAttr::AT_SwiftIndirectResult:
 
 7557  case ParsedAttr::AT_InternalLinkage:
 
 7560  case ParsedAttr::AT_ZeroCallUsedRegs:
 
 7563  case ParsedAttr::AT_FunctionReturnThunks:
 
 7566  case ParsedAttr::AT_NoMerge:
 
 7569  case ParsedAttr::AT_NoUniqueAddress:
 
 7573  case ParsedAttr::AT_AvailableOnlyInDefaultEvalMethod:
 
 7577  case ParsedAttr::AT_CountedBy:
 
 7578  case ParsedAttr::AT_CountedByOrNull:
 
 7579  case ParsedAttr::AT_SizedBy:
 
 7580  case ParsedAttr::AT_SizedByOrNull:
 
 7585  case ParsedAttr::AT_LayoutVersion:
 
 7588  case ParsedAttr::AT_Uuid:
 
 7591  case ParsedAttr::AT_MSInheritance:
 
 7594  case ParsedAttr::AT_Thread:
 
 7597  case ParsedAttr::AT_MSConstexpr:
 
 7600  case ParsedAttr::AT_HybridPatchable:
 
 7605  case ParsedAttr::AT_RootSignature:
 
 7608  case ParsedAttr::AT_HLSLNumThreads:
 
 7611  case ParsedAttr::AT_HLSLWaveSize:
 
 7614  case ParsedAttr::AT_HLSLVkExtBuiltinInput:
 
 7617  case ParsedAttr::AT_HLSLVkConstantId:
 
 7620  case ParsedAttr::AT_HLSLVkBinding:
 
 7623  case ParsedAttr::AT_HLSLGroupSharedAddressSpace:
 
 7626  case ParsedAttr::AT_HLSLPackOffset:
 
 7629  case ParsedAttr::AT_HLSLShader:
 
 7632  case ParsedAttr::AT_HLSLResourceBinding:
 
 7635  case ParsedAttr::AT_HLSLParamModifier:
 
 7638  case ParsedAttr::AT_HLSLUnparsedSemantic:
 
 7642  case ParsedAttr::AT_AbiTag:
 
 7645  case ParsedAttr::AT_CFGuard:
 
 7650  case ParsedAttr::AT_PtGuardedVar:
 
 7653  case ParsedAttr::AT_NoSanitize:
 
 7656  case ParsedAttr::AT_NoSanitizeAddress:
 
 7659  case ParsedAttr::AT_NoSanitizeThread:
 
 7662  case ParsedAttr::AT_NoSanitizeMemory:
 
 7665  case ParsedAttr::AT_GuardedBy:
 
 7668  case ParsedAttr::AT_PtGuardedBy:
 
 7671  case ParsedAttr::AT_LockReturned:
 
 7674  case ParsedAttr::AT_LocksExcluded:
 
 7677  case ParsedAttr::AT_AcquiredBefore:
 
 7680  case ParsedAttr::AT_AcquiredAfter:
 
 7685  case ParsedAttr::AT_Capability:
 
 7686  case ParsedAttr::AT_Lockable:
 
 7689  case ParsedAttr::AT_ReentrantCapability:
 
 7692  case ParsedAttr::AT_RequiresCapability:
 
 7696  case ParsedAttr::AT_AssertCapability:
 
 7699  case ParsedAttr::AT_AcquireCapability:
 
 7702  case ParsedAttr::AT_ReleaseCapability:
 
 7705  case ParsedAttr::AT_TryAcquireCapability:
 
 7710  case ParsedAttr::AT_Consumable:
 
 7713  case ParsedAttr::AT_CallableWhen:
 
 7716  case ParsedAttr::AT_ParamTypestate:
 
 7719  case ParsedAttr::AT_ReturnTypestate:
 
 7722  case ParsedAttr::AT_SetTypestate:
 
 7725  case ParsedAttr::AT_TestTypestate:
 
 7730  case ParsedAttr::AT_ArgumentWithTypeTag:
 
 7733  case ParsedAttr::AT_TypeTagForDatatype:
 
 7738  case ParsedAttr::AT_SwiftAsyncName:
 
 7741  case ParsedAttr::AT_SwiftAttr:
 
 7744  case ParsedAttr::AT_SwiftBridge:
 
 7747  case ParsedAttr::AT_SwiftError:
 
 7750  case ParsedAttr::AT_SwiftName:
 
 7753  case ParsedAttr::AT_SwiftNewType:
 
 7756  case ParsedAttr::AT_SwiftAsync:
 
 7759  case ParsedAttr::AT_SwiftAsyncError:
 
 7764  case ParsedAttr::AT_XRayLogArgs:
 
 7768  case ParsedAttr::AT_PatchableFunctionEntry:
 
 7772  case ParsedAttr::AT_AlwaysDestroy:
 
 7773  case ParsedAttr::AT_NoDestroy:
 
 7777  case ParsedAttr::AT_Uninitialized:
 
 7781  case ParsedAttr::AT_ObjCExternallyRetained:
 
 7785  case ParsedAttr::AT_MIGServerRoutine:
 
 7789  case ParsedAttr::AT_MSAllocator:
 
 7793  case ParsedAttr::AT_ArmBuiltinAlias:
 
 7797  case ParsedAttr::AT_ArmLocallyStreaming:
 
 7801  case ParsedAttr::AT_ArmNew:
 
 7805  case ParsedAttr::AT_AcquireHandle:
 
 7809  case ParsedAttr::AT_ReleaseHandle:
 
 7813  case ParsedAttr::AT_UnsafeBufferUsage:
 
 7817  case ParsedAttr::AT_UseHandle:
 
 7821  case ParsedAttr::AT_EnforceTCB:
 
 7825  case ParsedAttr::AT_EnforceTCBLeaf:
 
 7829  case ParsedAttr::AT_BuiltinAlias:
 
 7833  case ParsedAttr::AT_PreferredType:
 
 7837  case ParsedAttr::AT_UsingIfExists:
 
 7841  case ParsedAttr::AT_TypeNullable:
 
 7845  case ParsedAttr::AT_VTablePointerAuthentication:
 
 
 7853  return D->
hasAttr<DeviceKernelAttr>() ||
 
 
 7861  if (AttrList.
empty())
 
 7872    Diag(AttrList.
begin()->getLoc(), diag::err_attribute_weakref_without_alias)
 
 7882  if (!(D->
hasAttr<DeviceKernelAttr>() ||
 
 7883        (D->
hasAttr<CUDAGlobalAttr>() &&
 
 7884         Context.getTargetInfo().getTriple().isSPIRV()))) {
 
 7886    if (
const auto *A = D->
getAttr<ReqdWorkGroupSizeAttr>()) {
 
 7891    } 
else if (
const auto *A = D->
getAttr<WorkGroupSizeHintAttr>()) {
 
 7894    } 
else if (
const auto *A = D->
getAttr<VecTypeHintAttr>()) {
 
 7897    } 
else if (
const auto *A = D->
getAttr<OpenCLIntelReqdSubGroupSizeAttr>()) {
 
 7903    if (
const auto *A = D->
getAttr<AMDGPUFlatWorkGroupSizeAttr>()) {
 
 7907    } 
else if (
const auto *A = D->
getAttr<AMDGPUWavesPerEUAttr>()) {
 
 7911    } 
else if (
const auto *A = D->
getAttr<AMDGPUNumSGPRAttr>()) {
 
 7915    } 
else if (
const auto *A = D->
getAttr<AMDGPUNumVGPRAttr>()) {
 
 7924      (D->
hasAttr<ConstructorAttr>() || D->
hasAttr<DestructorAttr>()) &&
 
 7927        << (D->
hasAttr<ConstructorAttr>() ? 
"constructors" : 
"destructors");
 
 7936  if (D->
hasAttr<ObjCDesignatedInitializerAttr>() &&
 
 7939    D->
dropAttr<ObjCDesignatedInitializerAttr>();
 
 
 7946    if (AL.getKind() == ParsedAttr::AT_TransparentUnion) {
 
 7953  if (D && D->
hasAttr<BPFPreserveAccessIndexAttr>())
 
 
 7960    if (AL.getKind() == ParsedAttr::AT_Annotate) {
 
 7964      Diag(AL.getLoc(), diag::err_only_annotate_after_access_spec);
 
 
 7976    if (AL.isUsedAsTypeAttr() || AL.isInvalid())
 
 7984      S.
Diag(AL.getLoc(), diag::warn_attribute_not_on_decl) << AL
 
 
 8001  std::optional<StringRef> CorrectedScopeName =
 
 8003  if (CorrectedScopeName) {
 
 8004    ScopeName = *CorrectedScopeName;
 
 8010  if (CorrectedAttrName) {
 
 8011    AttrName = *CorrectedAttrName;
 
 8014  if (CorrectedScopeName || CorrectedAttrName) {
 
 8015    std::string CorrectedFullName =
 
 8019             diag::warn_unknown_attribute_ignored_suggestion);
 
 8021    D << AL << CorrectedFullName;
 
 8026      if (CorrectedScopeName) {
 
 8030      if (CorrectedAttrName) {
 
 8035    Diag(NR.
getBegin(), diag::warn_unknown_attribute_ignored) << AL << NR;
 
 
 8043  if (
auto *FD = dyn_cast<FunctionDecl>(ND)) {
 
 8065      for (
const auto &AI : FT->param_types()) {
 
 8067        Param->setScopeInfo(0, Params.size());
 
 8068        Params.push_back(Param);
 
 8070      NewFD->setParams(Params);
 
 8072  } 
else if (
auto *VD = dyn_cast<VarDecl>(ND)) {
 
 8074                           VD->getInnerLocStart(), VD->getLocation(), II,
 
 8075                           VD->getType(), VD->getTypeSourceInfo(),
 
 8076                           VD->getStorageClass());
 
 8077    if (VD->getQualifier())
 
 8078      cast<VarDecl>(NewD)->setQualifierInfo(VD->getQualifierLoc());
 
 
 8111  if (
auto *VD = dyn_cast<VarDecl>(D))
 
 8112    if (VD->isExternC())
 
 8114  if (
auto *FD = dyn_cast<FunctionDecl>(D))
 
 8122      auto &WeakInfos = I->second;
 
 8123      for (
const auto &W : WeakInfos)
 
 8125      std::remove_reference_t<
decltype(WeakInfos)> EmptyWeakInfos;
 
 8126      WeakInfos.swap(EmptyWeakInfos);
 
 
 8138  auto ProcessAttributesWithSliding =
 
 8146          if ((AL.isStandardAttributeSyntax() || AL.isAlignas()) &&
 
 8147              AL.slidesFromDeclToDeclSpecLegacyBehavior()) {
 
 8152            AL.diagnoseAppertainsTo(*
this, D);
 
 8167                                   .WithIncludeCXX11Attributes(
false)
 
 8168                                   .WithIgnoreTypeAttributes(
true));
 
 8177                                 .WithIncludeCXX11Attributes(
false)
 
 8178                                 .WithIgnoreTypeAttributes(
true));
 
 
 8196                                   UnavailableAttr::ImplicitReason &reason) {
 
 8210    if (
diag.getForbiddenTypeDiagnostic() == diag::err_arc_weak_disabled ||
 
 8211        diag.getForbiddenTypeDiagnostic() == diag::err_arc_weak_no_runtime) {
 
 8212      reason = UnavailableAttr::IR_ForbiddenWeak;
 
 8221    reason = UnavailableAttr::IR_ARCForbiddenType;
 
 
 8231  auto Reason = UnavailableAttr::IR_None;
 
 8233    assert(Reason && 
"didn't set reason?");
 
 8238    if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
 
 8241      if (FD->
hasAttr<UnavailableAttr>() &&
 
 8243              diag::err_arc_array_param_no_ownership) {
 
 
 8274    bool AnyAccessFailures = 
false;
 
 8282      switch (
diag.Kind) {
 
 8286        if (!
decl->isInvalidDecl())
 
 8298          AnyAccessFailures = 
true;
 
 
 8311  assert(curPool && 
"re-emitting in undelayed context not supported");
 
 8312  curPool->
steal(pool);
 
 
Defines the clang::ASTContext interface.
static SmallString< 64 > normalizeName(StringRef AttrName, StringRef ScopeName, AttributeCommonInfo::Syntax SyntaxUsed)
static OffloadArch getOffloadArch(CodeGenModule &CGM)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines the classes used to store parsed information about declaration-specifiers and decla...
Defines the C++ template declaration subclasses.
Defines the classes clang::DelayedDiagnostic and clang::AccessedEntity.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Defines the clang::LangOptions interface.
llvm::MachO::Target Target
llvm::MachO::Record Record
static unsigned getNumAttributeArgs(const ParsedAttr &AL)
Defines the clang::Preprocessor interface.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
This file declares semantic analysis functions specific to AMDGPU.
This file declares semantic analysis functions specific to ARM.
This file declares semantic analysis functions specific to AVR.
This file declares semantic analysis functions specific to BPF.
This file declares semantic analysis for CUDA constructs.
static void handleCleanupAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAlignedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleWeakImportAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleHandleAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkGuardedByAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL, Expr *&Arg)
static void handleCodeSegAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static const RecordDecl * getRecordDecl(QualType QT)
Checks that the passed in QualType either is of RecordType or points to RecordType.
static void handlePatchableFunctionEntryAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCountedByAttrField(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleFormatAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleUninitializedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleRequiresCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDeviceKernelAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleBTFDeclTagAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleOptimizeNoneAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleEnableIfAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleSectionAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleStandardNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &A)
static void handleMIGServerRoutineAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleGuardedByAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleZeroCallUsedRegsAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDiagnoseAsBuiltinAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleEnumExtensibilityAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static T * mergeVisibilityAttr(Sema &S, Decl *D, const AttributeCommonInfo &CI, typename T::VisibilityType value)
static void handleFormatMatchesAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleLayoutVersion(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkForConsumableClass(Sema &S, const CXXMethodDecl *MD, const ParsedAttr &AL)
static void handleDLLAttr(Sema &S, Decl *D, const ParsedAttr &A)
static void handleConstantAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAlignValueAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static Expr * makeAttributeArgExpr(Sema &S, Expr *E, const Attribute &Attr, const unsigned Idx)
static void handleLifetimeCaptureByAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoCfCheckAttr(Sema &S, Decl *D, const ParsedAttr &Attrs)
static void handleNoSpecializations(Sema &S, Decl *D, const ParsedAttr &AL)
static bool threadSafetyCheckIsSmartPointer(Sema &S, const RecordDecl *Record)
static void handleReturnsNonNullAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void checkUnusedDeclAttributes(Sema &S, const ParsedAttributesView &A)
checkUnusedDeclAttributes - Check a list of attributes to see if it contains any decl attributes that...
static void handleGNUInlineAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleWorkGroupSize(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleBuiltinAliasAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTransparentUnionAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleVTablePointerAuthentication(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleEnforceTCBAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void checkAttrArgsAreCapabilityObjs(Sema &S, Decl *D, const ParsedAttr &AL, SmallVectorImpl< Expr * > &Args, unsigned Sidx=0, bool ParamIdxOk=false)
Checks that all attribute arguments, starting from Sidx, resolve to a capability object.
static void handleErrorAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkCodeSegName(Sema &S, SourceLocation LiteralLoc, StringRef CodeSegName)
static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTryAcquireCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleGridConstantAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleSetTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleFormatArgAttr(Sema &S, Decl *D, const ParsedAttr &AL)
Handle attribute((format_arg((idx)))) attribute based on http://gcc.gnu.org/onlinedocs/gcc/Function-A...
static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL, const Sema::ProcessDeclAttributeOptions &Options)
ProcessDeclAttribute - Apply the specific attribute to the specified decl if the attribute applies to...
static void handleTargetAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleXRayLogArgsAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePassObjectSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoMergeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleManagedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNonStringAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleParamTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleUnsafeBufferUsage(Sema &S, Decl *D, const ParsedAttr &AL)
static bool attrNonNullArgCheck(Sema &S, QualType T, const ParsedAttr &AL, SourceRange AttrParmRange, SourceRange TypeRange, bool isReturnValue=false)
static void handleAcquireCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCPUSpecificAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePackedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleIFuncAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAbiTagAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAttrWithMessage(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleWeakRefAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleExtVectorTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool isValidCodeModelAttr(llvm::Triple &Triple, StringRef Str)
static void handleCalledOnceAttr(Sema &S, Decl *D, const ParsedAttr &AL)
Handle 'called_once' attribute.
static void handleLockReturnedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkFunctionConditionAttr(Sema &S, Decl *D, const ParsedAttr &AL, Expr *&Cond, StringRef &Msg)
static void handleAcquiredAfterAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleExternalSourceSymbolAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNonNullAttrParameter(Sema &S, ParmVarDecl *D, const ParsedAttr &AL)
static bool checkParamIsIntegerType(Sema &S, const Decl *D, const AttrInfo &AI, unsigned AttrArgNo)
Checks to be sure that the given parameter number is in bounds, and is an integral type.
static bool checkFunParamsAreScopedLockable(Sema &S, const ParmVarDecl *ParamDecl, const ParsedAttr &AL)
static bool checkRecordTypeForCapability(Sema &S, QualType Ty)
static void handleArgumentWithTypeTagAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkAcquireOrderAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL, SmallVectorImpl< Expr * > &Args)
static void handleLocksExcludedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMSAllocatorAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static AttrTy * mergeEnforceTCBAttrImpl(Sema &S, Decl *D, const AttrTy &AL)
static void handleConstructorAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAllocSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleConsumableAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoSanitizeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleReturnTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTargetClonesAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool isKernelDecl(Decl *D)
static void handleAllocAlignAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePreferredTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDeviceAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePtGuardedByAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAlwaysInlineAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAssertCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleVisibilityAttr(Sema &S, Decl *D, const ParsedAttr &AL, bool isTypeVisibility)
static void handleAnnotateAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static FormatAttrKind getFormatAttrKind(StringRef Format)
getFormatAttrKind - Map from format attribute names to supported format types.
static void handleNullableTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleUuidAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAcquireHandleAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoSanitizeAddressAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMSConstexprAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCommonAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTestTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkTryLockFunAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL, SmallVectorImpl< Expr * > &Args)
static void parseModeAttrArg(Sema &S, StringRef Str, unsigned &DestWidth, bool &IntegerMode, bool &ComplexMode, FloatModeKind &ExplicitType)
parseModeAttrArg - Parses attribute mode string and returns parsed type attribute.
static void handleExcludeFromExplicitInstantiationAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCFIUncheckedCalleeAttr(Sema &S, Decl *D, const ParsedAttr &Attrs)
static void handleLaunchBoundsAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkAvailabilityAttr(Sema &S, SourceRange Range, IdentifierInfo *Platform, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted)
static void handleDependencyAttr(Sema &S, Scope *Scope, Decl *D, const ParsedAttr &AL)
static void handleNoBuiltinAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleLifetimeCategoryAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoUniqueAddressAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool validateAlignasAppliedType(Sema &S, Decl *D, const AlignedAttr &Attr, SourceLocation AttrLoc)
Perform checking of type validity.
static void handleNakedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleFunctionReturnThunksAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDeprecatedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static unsigned getNumAttributeArgs(const ParsedAttr &AL)
static void handleGlobalAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleSentinelAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCallableWhenAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool hasBTFDeclTagAttr(Decl *D, StringRef Tag)
static void handleDelayedForbiddenType(Sema &S, DelayedDiagnostic &DD, Decl *D)
Handle a delayed forbidden-type diagnostic.
static void handleNoClusterAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkLockFunAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL, SmallVectorImpl< Expr * > &Args)
static void handleAssumeAlignedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleSharedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMSInheritanceAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleVecTypeHint(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleRestrictAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMinVectorWidthAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleUnusedAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static Expr * makeLaunchBoundsArgExpr(Sema &S, Expr *E, const CUDALaunchBoundsAttr &AL, const unsigned Idx)
static void handleDeclspecThreadAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleInterruptAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCallbackAttr(Sema &S, Decl *D, const ParsedAttr &AL)
Handle attribute((callback(CalleeIdx, PayloadIdx0, ...))) attributes.
static AttributeCommonInfo getNoSanitizeAttrInfo(const ParsedAttr &NoSanitizeSpecificAttr)
static void handleInitPriorityAttr(Sema &S, Decl *D, const ParsedAttr &AL)
Handle attribute((init_priority(priority))) attributes based on http://gcc.gnu.org/onlinedocs/gcc/C_0...
static void handlePtGuardedVarAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkRecordDeclForAttr(const RecordDecl *RD)
static void handleNoSanitizeThreadAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDestroyAttr(Sema &S, Decl *D, const ParsedAttr &A)
static bool isKnownToAlwaysThrow(const FunctionDecl *FD)
static void handleTypeTagForDatatypeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleRandomizeLayoutAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void markUsedForAliasOrIfunc(Sema &S, Decl *D, const ParsedAttr &AL, StringRef Str)
static bool isCapabilityExpr(Sema &S, const Expr *Ex)
static void handleNoDebugAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleSuppressAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &Attrs)
static std::pair< Expr *, int > makeClusterDimsArgExpr(Sema &S, Expr *E, const CUDAClusterDimsAttr &AL, const unsigned Idx)
static void handleNoSanitizeMemoryAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static const AttrTy * findEnforceTCBAttrByName(Decl *D, StringRef Name)
static void handleNoEscapeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAvailableOnlyInDefaultEvalMethod(Sema &S, Decl *D, const ParsedAttr &AL)
static bool MustDelayAttributeArguments(const ParsedAttr &AL)
static void handleNoRandomizeLayoutAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTargetVersionAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleWarnUnusedResult(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkRecordTypeForScopedCapability(Sema &S, QualType Ty)
static bool isIntOrBool(Expr *Exp)
Check if the passed-in expression is of type int or bool.
static bool versionsMatch(const VersionTuple &X, const VersionTuple &Y, bool BeforeIsOkay)
Check whether the two versions match.
static bool isSanitizerAttributeAllowedOnGlobals(StringRef Sanitizer)
static void handleClusterDimsAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool handleFormatAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL, FormatAttrCommon *Info)
Handle attribute((format(type,idx,firstarg))) attributes based on http://gcc.gnu.org/onlinedocs/gcc/F...
static void handleCallConvAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMinSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static ExprResult sharedGetConstructorDestructorAttrExpr(Sema &S, const ParsedAttr &AL)
static void handleOwnershipAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkTypedefTypeForCapability(QualType Ty)
static void handleAcquiredBeforeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleReleaseCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool typeHasCapability(Sema &S, QualType Ty)
static void handleAnalyzerNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool isFunctionLike(const Type &T)
static void handleDiagnoseIfAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCFGuardAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleReentrantCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNonNullAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool threadSafetyCheckIsPointer(Sema &S, const Decl *D, const ParsedAttr &AL)
Check if passed in Decl is a pointer type.
static bool isForbiddenTypeAllowed(Sema &S, Decl *D, const DelayedDiagnostic &diag, UnavailableAttr::ImplicitReason &reason)
Is the given declaration allowed to use a forbidden type?
static void handleInternalLinkageAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleModeAttr(Sema &S, Decl *D, const ParsedAttr &AL)
handleModeAttr - This attribute modifies the width of a decl with primitive type.
static void handleDestructorAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePreferredName(Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkPositiveIntArgument(Sema &S, const AttrInfo &AI, const Expr *Expr, int &Val, unsigned Idx=UINT_MAX)
Wrapper around checkUInt32Argument, with an extra check to be sure that the result will fit into a re...
static void handleVecReturnAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static bool isGlobalVar(const Decl *D)
static void handleTLSModelAttr(Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAliasAttr(Sema &S, Decl *D, const ParsedAttr &AL)
This file declares semantic analysis for HLSL constructs.
This file declares semantic analysis functions specific to M68k.
This file declares semantic analysis functions specific to MIPS.
This file declares semantic analysis functions specific to MSP430.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis routines for OpenCL.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis functions specific to RISC-V.
This file declares semantic analysis for SYCL constructs.
This file declares semantic analysis functions specific to Swift.
This file declares semantic analysis functions specific to Wasm.
This file declares semantic analysis functions specific to X86.
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
static QualType getPointeeType(const MemRegion *R)
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
virtual void AssignInheritanceModel(CXXRecordDecl *RD)
Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
MSGuidDecl * getMSGuidDecl(MSGuidDeclParts Parts) const
Return a declaration for the global GUID object representing the given GUID value.
SourceManager & getSourceManager()
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
DeclarationNameTable DeclarationNames
MangleContext * createMangleContext(const TargetInfo *T=nullptr)
If T is null pointer, assume the target in ASTContext.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
const LangOptions & getLangOpts() const
QualType getConstType(QualType T) const
Return the uniqued reference to the type for a const qualified type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
const TargetInfo * getAuxTargetInfo() const
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
QualType getTypedefType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypedefNameDecl *Decl, QualType UnderlyingType=QualType(), std::optional< bool > TypeMatchesDeclOrNone=std::nullopt) const
Return the unique reference to the type for the specified typedef-name decl.
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
const TargetInfo & getTargetInfo() const
TargetCXXABI::Kind getCXXABIKind() const
Return the C++ ABI kind that should be used.
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
Represents an access specifier followed by colon ':'.
Attr - This represents one attribute.
SourceLocation getScopeLoc() const
bool isMicrosoftAttribute() const
bool isClangScope() const
void setAttributeSpellingListIndex(unsigned V)
std::string getNormalizedFullName() const
Gets the normalized full name, which consists of both scope and name and with surrounding underscores...
bool isCXX11Attribute() const
bool isDeclspecAttribute() const
SourceRange getRange() const
bool isC23Attribute() const
unsigned getAttributeSpellingListIndex() const
const IdentifierInfo * getScopeName() const
bool isExplicitScope() const
StringRef getNormalizedAttrName(StringRef ScopeName) const
std::optional< StringRef > tryGetCorrectedAttrName(StringRef ScopeName, StringRef AttrName, const TargetInfo &Target, const LangOptions &LangOpts) const
bool isGNUAttribute() const
bool isRegularKeywordAttribute() const
SourceRange getNormalizedRange() const
std::optional< StringRef > tryGetCorrectedScopeName(StringRef ScopeName) const
SourceLocation getLoc() const
const IdentifierInfo * getAttrName() const
StringRef getNormalizedScopeName() const
bool isStandardAttributeSyntax() const
The attribute is spelled [[]] in either C or C++ mode, including standard attributes spelled with a k...
Kind getParsedKind() const
Type source information for an attributed type.
TypeLoc getModifiedLoc() const
The modified type, which is generally canonically different from the attribute type.
This class is used for builtin types like 'int'.
static bool isBuiltinFunc(llvm::StringRef Name)
Returns true if this is a libc/libm function without the '__builtin_' prefix.
Represents a static or instance method of a struct/union/class.
QualType getFunctionObjectParameterType() const
Represents a C++ struct/union/class.
CXXRecordDecl * getDefinition() const
bool hasDefinition() const
MSInheritanceModel calculateInheritanceModel() const
Calculate what the inheritance model would be for this class.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
CharUnits - This is an opaque type for sizes expressed in character units.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Declaration of a class template.
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
const RelatedTargetVersionMapping * getVersionMapping(OSEnvPair Kind) const
The results of name lookup within a DeclContext.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isFileContext() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
A reference to a declared variable, function, enum, etc.
DeclarationNameInfo getNameInfo() const
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr, NonOdrUseReason NOUR=NOUR_None)
bool hasQualifier() const
Determine whether this declaration reference was preceded by a C++ nested-name-specifier,...
ParsedAttributes & getAttributes()
Decl - This represents one declaration (or definition), e.g.
TemplateDecl * getDescribedTemplate() const
If this is a declaration that describes some template, this method returns that template declaration.
ASTContext & getASTContext() const LLVM_READONLY
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
const FunctionType * getFunctionType(bool BlocksToo=true) const
Looks through the Decl's underlying type to extract a FunctionType when possible.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
bool canBeWeakImported(bool &IsDefinition) const
Determines whether this symbol can be weak-imported, e.g., whether it would be well-formed to add the...
bool isInvalidDecl() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
SourceLocation getLocation() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
DeclContext * getDeclContext()
SourceLocation getBeginLoc() const LLVM_READONLY
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
void setLexicalDeclContext(DeclContext *DC)
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
The name of a declaration.
SourceLocation getTypeSpecStartLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
const AssociatedConstraint & getTrailingRequiresClause() const
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in ...
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
const ParsedAttributes & getAttributes() const
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
const ParsedAttributesView & getDeclarationAttributes() const
Concrete class used by the front-end to report problems and issues.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() const
This represents one expression.
bool isIntegerConstantExpr(const ASTContext &Ctx) const
static bool isPotentialConstantExprUnevaluated(Expr *E, const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
isPotentialConstantExprUnevaluated - Return true if this expression might be usable in a constant exp...
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates).
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
Represents a function declaration or definition.
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin=false, bool isInlineSpecified=false, bool hasWrittenPrototype=true, ConstexprSpecKind ConstexprKind=ConstexprSpecKind::Unspecified, const AssociatedConstraint &TrailingRequiresClause={})
const ParmVarDecl * getParamDecl(unsigned i) const
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
SourceRange getReturnTypeSourceRange() const
Attempt to compute an informative source range covering the function return type.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
param_iterator param_end()
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
void setIsMultiVersion(bool V=true)
Sets the multiversion state for this declaration and all of its redeclarations.
bool isNoReturn() const
Determines whether this function is known to be 'noreturn', through an attribute on its declaration o...
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
bool hasPrototype() const
Whether this function has a prototype, either because one was explicitly written or because it was "i...
param_iterator param_begin()
bool isVariadic() const
Whether this function is variadic.
bool isConstexprSpecified() const
bool isExternC() const
Determines whether this function is a function with external, C linkage.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Represents a prototype with parameter type info, e.g.
Declaration of a template function.
FunctionType - C99 6.7.5.3 - Function Declarators.
CallingConv getCallConv() const
QualType getReturnType() const
GlobalDecl - represents a global declaration.
One of these records is kept for each identifier that is lexed.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
StringRef getName() const
Return the actual identifier string.
A simple pair of identifier info and location.
SourceLocation getLoc() const
IdentifierInfo * getIdentifierInfo() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Describes an entity that is being initialized.
static InitializedEntity InitializeParameter(ASTContext &Context, ParmVarDecl *Parm)
Create the initialization entity for a parameter.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool isCompatibleWithMSVC(MSVCMajorVersion MajorVersion) const
bool isTargetDevice() const
True when compiling for an offloading target device.
void push_back(const T &LocalValue)
Represents the results of name lookup.
Describes a module or submodule.
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
bool isExternallyVisible() const
A C++ nested-name-specifier augmented with source location information.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents one property declaration in an Objective-C interface.
void * getAsOpaquePtr() const
static OpaquePtr getFromOpaquePtr(void *P)
A single parameter index whose accessors require each use to make explicit the parameter index encodi...
bool isValid() const
Is this parameter index valid?
unsigned getSourceIndex() const
Get the parameter index as it would normally be encoded for attributes at the source level of represe...
unsigned getASTIndex() const
Get the parameter index as it would normally be encoded at the AST level of representation: zero-orig...
Represents a parameter to a function.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
ParsedAttr - Represents a syntactic attribute.
bool isPackExpansion() const
const AvailabilityChange & getAvailabilityDeprecated() const
unsigned getSemanticSpelling() const
If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration ...
bool existsInTarget(const TargetInfo &Target) const
bool checkExactlyNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has exactly as many args as Num.
IdentifierLoc * getArgAsIdent(unsigned Arg) const
bool hasParsedType() const
const AvailabilityChange & getAvailabilityIntroduced() const
void setInvalid(bool b=true) const
bool hasVariadicArg() const
const ParsedAttrInfo & getInfo() const
void handleAttrWithDelayedArgs(Sema &S, Decl *D) const
const Expr * getReplacementExpr() const
bool hasProcessingCache() const
SourceLocation getUnavailableLoc() const
unsigned getProcessingCache() const
const IdentifierLoc * getEnvironment() const
bool acceptsExprPack() const
const Expr * getMessageExpr() const
const ParsedType & getMatchingCType() const
const ParsedType & getTypeArg() const
SourceLocation getStrictLoc() const
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this attribute.
bool isArgIdent(unsigned Arg) const
Expr * getArgAsExpr(unsigned Arg) const
bool getMustBeNull() const
bool checkAtLeastNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at least as many args as Num.
bool isUsedAsTypeAttr() const
unsigned getNumArgMembers() const
bool isPragmaClangAttribute() const
True if the attribute is specified using 'pragma clang attribute'.
bool slidesFromDeclToDeclSpecLegacyBehavior() const
Returns whether a [[]] attribute, if specified ahead of a declaration, should be applied to the decl-...
AttributeCommonInfo::Kind getKind() const
void setProcessingCache(unsigned value) const
bool isParamExpr(size_t N) const
bool isArgExpr(unsigned Arg) const
bool getLayoutCompatible() const
ArgsUnion getArg(unsigned Arg) const
getArg - Return the specified argument.
SourceLocation getEllipsisLoc() const
bool checkAtMostNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at most as many args as Num.
const AvailabilityChange & getAvailabilityObsoleted() const
void addAtEnd(ParsedAttr *newAttr)
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
IdentifierTable & getIdentifierTable()
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
const Type * getTypePtrOrNull() const
Represents a struct/union/class.
field_iterator field_end() const
field_range fields() const
specific_decl_iterator< FieldDecl > field_iterator
RecordDecl * getDefinitionOrSelf() const
field_iterator field_begin() const
Base for LValueReferenceType and RValueReferenceType.
Scope - A scope is a transient data structure that is used while parsing the program.
unsigned getFlags() const
getFlags - Return the flags for this scope.
@ FunctionDeclarationScope
This is a scope that corresponds to the parameters within a function prototype for a function declara...
void handleAMDGPUMaxNumWorkGroupsAttr(Decl *D, const ParsedAttr &AL)
void handleAMDGPUFlatWorkGroupSizeAttr(Decl *D, const ParsedAttr &AL)
void handleAMDGPUNumSGPRAttr(Decl *D, const ParsedAttr &AL)
void handleAMDGPUNumVGPRAttr(Decl *D, const ParsedAttr &AL)
void handleAMDGPUWavesPerEUAttr(Decl *D, const ParsedAttr &AL)
void handleInterruptSaveFPAttr(Decl *D, const ParsedAttr &AL)
bool checkTargetVersionAttr(const StringRef Str, const SourceLocation Loc)
void handleInterruptAttr(Decl *D, const ParsedAttr &AL)
void handleBuiltinAliasAttr(Decl *D, const ParsedAttr &AL)
void handleNewAttr(Decl *D, const ParsedAttr &AL)
bool SveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
bool MveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
void handleCmseNSEntryAttr(Decl *D, const ParsedAttr &AL)
bool checkTargetClonesAttr(SmallVectorImpl< StringRef > &Params, SmallVectorImpl< SourceLocation > &Locs, SmallVectorImpl< SmallString< 64 > > &NewParams)
bool CdeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
void handleSignalAttr(Decl *D, const ParsedAttr &AL)
void handleInterruptAttr(Decl *D, const ParsedAttr &AL)
void handlePreserveAIRecord(RecordDecl *RD)
void handlePreserveAccessIndexAttr(Decl *D, const ParsedAttr &AL)
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
CUDAFunctionTarget IdentifyTarget(const FunctionDecl *D, bool IgnoreImplicitHDAttr=false)
Determines whether the given function is a CUDA device/host/kernel/etc.
CUDAFunctionTarget CurrentTarget()
Gets the CUDA target for the current context.
SemaDiagnosticBuilder DiagIfHostCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
void handleWaveSizeAttr(Decl *D, const ParsedAttr &AL)
void handleSemanticAttr(Decl *D, const ParsedAttr &AL)
void handleShaderAttr(Decl *D, const ParsedAttr &AL)
void handlePackOffsetAttr(Decl *D, const ParsedAttr &AL)
void handleParamModifierAttr(Decl *D, const ParsedAttr &AL)
void handleRootSignatureAttr(Decl *D, const ParsedAttr &AL)
void handleResourceBindingAttr(Decl *D, const ParsedAttr &AL)
void handleNumThreadsAttr(Decl *D, const ParsedAttr &AL)
void handleVkExtBuiltinInputAttr(Decl *D, const ParsedAttr &AL)
void handleVkBindingAttr(Decl *D, const ParsedAttr &AL)
void handleVkConstantIdAttr(Decl *D, const ParsedAttr &AL)
void handleInterruptAttr(Decl *D, const ParsedAttr &AL)
void handleInterruptAttr(Decl *D, const ParsedAttr &AL)
void handleInterruptAttr(Decl *D, const ParsedAttr &AL)
void handleRuntimeName(Decl *D, const ParsedAttr &AL)
void handleNSObject(Decl *D, const ParsedAttr &AL)
bool isValidOSObjectOutParameter(const Decl *D)
void handleNSErrorDomain(Decl *D, const ParsedAttr &Attr)
void handleXReturnsXRetainedAttr(Decl *D, const ParsedAttr &AL)
void handleExternallyRetainedAttr(Decl *D, const ParsedAttr &AL)
void handleMethodFamilyAttr(Decl *D, const ParsedAttr &AL)
void handleIndependentClass(Decl *D, const ParsedAttr &AL)
void handleIBOutlet(Decl *D, const ParsedAttr &AL)
void handleReturnsInnerPointerAttr(Decl *D, const ParsedAttr &Attrs)
void handleSuppresProtocolAttr(Decl *D, const ParsedAttr &AL)
void handleOwnershipAttr(Decl *D, const ParsedAttr &AL)
void handleBlocksAttr(Decl *D, const ParsedAttr &AL)
void handleBridgeMutableAttr(Decl *D, const ParsedAttr &AL)
Sema::RetainOwnershipKind parsedAttrToRetainOwnershipKind(const ParsedAttr &AL)
void handleRequiresSuperAttr(Decl *D, const ParsedAttr &Attrs)
void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI, Sema::RetainOwnershipKind K, bool IsTemplateInstantiation)
void handleDesignatedInitializer(Decl *D, const ParsedAttr &AL)
void handleBridgeRelatedAttr(Decl *D, const ParsedAttr &AL)
void handleIBOutletCollection(Decl *D, const ParsedAttr &AL)
bool isCFStringType(QualType T)
void handleDirectAttr(Decl *D, const ParsedAttr &AL)
bool isNSStringType(QualType T, bool AllowNSAttributedString=false)
void handleBoxable(Decl *D, const ParsedAttr &AL)
void handleDirectMembersAttr(Decl *D, const ParsedAttr &AL)
void handleBridgeAttr(Decl *D, const ParsedAttr &AL)
void handlePreciseLifetimeAttr(Decl *D, const ParsedAttr &AL)
void handleSubGroupSize(Decl *D, const ParsedAttr &AL)
void handleNoSVMAttr(Decl *D, const ParsedAttr &AL)
void handleAccessAttr(Decl *D, const ParsedAttr &AL)
void handleOMPAssumeAttr(Decl *D, const ParsedAttr &AL)
bool isAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
void handleInterruptAttr(Decl *D, const ParsedAttr &AL)
bool checkTargetClonesAttr(SmallVectorImpl< StringRef > &Params, SmallVectorImpl< SourceLocation > &Locs, SmallVectorImpl< SmallString< 64 > > &NewParams)
bool checkTargetVersionAttr(const StringRef Param, const SourceLocation Loc)
void handleKernelEntryPointAttr(Decl *D, const ParsedAttr &AL)
void handleKernelAttr(Decl *D, const ParsedAttr &AL)
void handleBridge(Decl *D, const ParsedAttr &AL)
void handleAsyncAttr(Decl *D, const ParsedAttr &AL)
void handleAsyncName(Decl *D, const ParsedAttr &AL)
void handleNewType(Decl *D, const ParsedAttr &AL)
void handleError(Decl *D, const ParsedAttr &AL)
void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, ParameterABI abi)
void handleAsyncError(Decl *D, const ParsedAttr &AL)
void handleName(Decl *D, const ParsedAttr &AL)
void handleAttrAttr(Decl *D, const ParsedAttr &AL)
void handleWebAssemblyImportNameAttr(Decl *D, const ParsedAttr &AL)
void handleWebAssemblyImportModuleAttr(Decl *D, const ParsedAttr &AL)
void handleWebAssemblyExportNameAttr(Decl *D, const ParsedAttr &AL)
void handleForceAlignArgPointerAttr(Decl *D, const ParsedAttr &AL)
void handleAnyInterruptAttr(Decl *D, const ParsedAttr &AL)
bool checkTargetClonesAttr(SmallVectorImpl< StringRef > &Params, SmallVectorImpl< SourceLocation > &Locs, SmallVectorImpl< SmallString< 64 > > &NewParams)
A class which encapsulates the logic for delaying diagnostics during parsing and other processing.
sema::DelayedDiagnosticPool * getCurrentPool() const
Returns the current delayed-diagnostics pool.
void popWithoutEmitting(DelayedDiagnosticsState state)
Leave a delayed-diagnostic state that was previously pushed.
Sema - This implements semantic analysis and AST building for C.
BTFDeclTagAttr * mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL)
void LoadExternalWeakUndeclaredIdentifiers()
Load weak undeclared identifiers from the external source.
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
EnforceTCBAttr * mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL)
DelayedDiagnosticsState ParsingDeclState
bool isValidPointerAttrType(QualType T, bool RefOkay=false)
Determine if type T is a valid subject for a nonnull and similar attributes.
static std::enable_if_t< std::is_base_of_v< Attr, AttrInfo >, SourceLocation > getAttrLoc(const AttrInfo &AL)
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr.
TypeVisibilityAttr * mergeTypeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, TypeVisibilityAttr::VisibilityType Vis)
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
bool checkFunctionOrMethodParameterIndex(const Decl *D, const AttrInfo &AI, unsigned AttrArgNum, const Expr *IdxExpr, ParamIdx &Idx, bool CanIndexImplicitThis=false, bool CanIndexVariadicArguments=false)
Check if IdxExpr is a valid parameter index for a function or instance method D.
void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, Expr *OE)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
bool checkSectionName(SourceLocation LiteralLoc, StringRef Str)
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
bool checkCommonAttributeFeatures(const Decl *D, const ParsedAttr &A, bool SkipArgCountCheck=false)
Handles semantic checking for features that are common to all attributes, such as checking whether a ...
bool ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl, const ParsedAttributesView &AttrList)
Annotation attributes are the only attributes allowed after an access specifier.
DLLImportAttr * mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI)
ExtVectorDeclsType ExtVectorDecls
ExtVectorDecls - This is a list all the extended vector types.
void PopParsingDeclaration(ParsingDeclState state, Decl *decl)
ErrorAttr * mergeErrorAttr(Decl *D, const AttributeCommonInfo &CI, StringRef NewUserDiagnostic)
bool CheckFormatStringsCompatible(FormatStringType FST, const StringLiteral *AuthoritativeFormatString, const StringLiteral *TestedFormatString, const Expr *FunctionCallArg=nullptr)
Verify that two format strings (as understood by attribute(format) and attribute(format_matches) are ...
void redelayDiagnostics(sema::DelayedDiagnosticPool &pool)
Given a set of delayed diagnostics, re-emit them as if they had been delayed in the current context i...
VisibilityAttr * mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, VisibilityAttr::VisibilityType Vis)
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
void LazyProcessLifetimeCaptureByParams(FunctionDecl *FD)
DiagnosticsEngine & getDiagnostics() const
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
ASTContext & getASTContext() const
bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC, const FunctionDecl *FD=nullptr, CUDAFunctionTarget CFT=CUDAFunctionTarget::InvalidTarget)
Check validaty of calling convention attribute attr.
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
void ProcessPragmaWeak(Scope *S, Decl *D)
bool CheckAttrNoArgs(const ParsedAttr &CurrAttr)
bool UnifySection(StringRef SectionName, int SectionFlags, NamedDecl *TheDecl)
void addNoClusterAttr(Decl *D, const AttributeCommonInfo &CI)
Add a no_cluster attribute to a particular declaration.
FPOptions & getCurFPFeatures()
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
@ UPPC_Expression
An arbitrary expression.
const LangOptions & getLangOpts() const
void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
MinSizeAttr * mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI)
AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, QualType LHSType, QualType RHSType)
CheckAssignmentConstraints - Perform type checking for assignment, argument passing,...
const LangOptions & LangOpts
static const uint64_t MaximumAlignment
CUDAClusterDimsAttr * createClusterDimsAttr(const AttributeCommonInfo &CI, Expr *X, Expr *Y, Expr *Z)
Add a cluster_dims attribute to a particular declaration.
AlwaysInlineAttr * mergeAlwaysInlineAttr(Decl *D, const AttributeCommonInfo &CI, const IdentifierInfo *Ident)
bool CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, bool OrNull)
Check if applying the specified attribute variant from the "counted by" family of attributes to Field...
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AttrList, const ProcessDeclAttributeOptions &Options=ProcessDeclAttributeOptions())
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
NamedDecl * getCurFunctionOrMethodDecl() const
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...
void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ParamExpr)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value)
Checks a regparm attribute, returning true if it is ill-formed and otherwise setting numParams to the...
void ProcessDeclAttributeDelayed(Decl *D, const ParsedAttributesView &AttrList)
Helper for delayed processing TransparentUnion or BPFPreserveAccessIndexAttr attribute.
bool checkUInt32Argument(const AttrInfo &AI, const Expr *Expr, uint32_t &Val, unsigned Idx=UINT_MAX, bool StrictlyUnsigned=false)
If Expr is a valid integer constant, get the value of the integer expression and return success or fa...
MSInheritanceAttr * mergeMSInheritanceAttr(Decl *D, const AttributeCommonInfo &CI, bool BestCase, MSInheritanceModel Model)
InternalLinkageAttr * mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL)
bool IsAssignConvertCompatible(AssignConvertType ConvTy)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
FunctionDecl * ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, bool Complain=false, DeclAccessPair *Found=nullptr, TemplateSpecCandidateSet *FailedTSC=nullptr, bool ForTypeDeduction=false)
Given an expression that refers to an overloaded function, try to resolve that overloaded function ex...
NamedDecl * DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II, SourceLocation Loc)
DeclClonePragmaWeak - clone existing decl (maybe definition), #pragma weak needs a non-definition dec...
DLLExportAttr * mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI)
CodeSegAttr * mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
SectionAttr * mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
SourceManager & getSourceManager() const
static FormatStringType GetFormatStringType(StringRef FormatFlavor)
bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str)
bool ValidateFormatString(FormatStringType FST, const StringLiteral *Str)
Verify that one format string (as understood by attribute(format)) is self-consistent; for instance,...
llvm::Error isValidSectionSpecifier(StringRef Str)
Used to implement to perform semantic checking on attribute((section("foo"))) specifiers.
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration.
void DiagnoseUnknownAttribute(const ParsedAttr &AL)
OptimizeNoneAttr * mergeOptimizeNoneAttr(Decl *D, const AttributeCommonInfo &CI)
void checkUnusedDeclAttributes(Declarator &D)
checkUnusedDeclAttributes - Given a declarator which is not being used to build a declaration,...
bool CheckAttrTarget(const ParsedAttr &CurrAttr)
EnforceTCBLeafAttr * mergeEnforceTCBLeafAttr(Decl *D, const EnforceTCBLeafAttr &AL)
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, AllowFoldKind CanFold=AllowFoldKind::No)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
void NoteAllOverloadCandidates(Expr *E, QualType DestType=QualType(), bool TakingAddress=false)
void addClusterDimsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *X, Expr *Y, Expr *Z)
FormatAttr * mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Format, int FormatIdx, int FirstArg)
@ AP_PragmaClangAttribute
The availability attribute was applied using 'pragma clang attribute'.
@ AP_InferredFromOtherPlatform
The availability attribute for a specific platform was inferred from an availability attribute for an...
@ AP_Explicit
The availability attribute was specified explicitly next to the declaration.
SmallVector< Decl *, 2 > WeakTopLevelDecl
WeakTopLevelDecl - Translation-unit scoped declarations generated by #pragma weak during processing o...
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
UuidAttr * mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI, StringRef UuidAsWritten, MSGuidDecl *GuidDecl)
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
Attr * CreateAnnotationAttr(const AttributeCommonInfo &CI, StringRef Annot, MutableArrayRef< Expr * > Args)
CreateAnnotationAttr - Creates an annotation Annot with Args arguments.
void handleDelayedAvailabilityCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D.
void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W)
DeclApplyPragmaWeak - A declaration (maybe definition) needs #pragma weak applied to it,...
FormatMatchesAttr * mergeFormatMatchesAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Format, int FormatIdx, StringLiteral *FormatStr)
AvailabilityAttr * mergeAvailabilityAttr(NamedDecl *D, const AttributeCommonInfo &CI, IdentifierInfo *Platform, bool Implicit, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool IsUnavailable, StringRef Message, bool IsStrict, StringRef Replacement, AvailabilityMergeKind AMK, int Priority, IdentifierInfo *IIEnvironment)
llvm::MapVector< IdentifierInfo *, llvm::SetVector< WeakInfo, llvm::SmallVector< WeakInfo, 1u >, llvm::SmallDenseSet< WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly > > > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
void ProcessAPINotes(Decl *D)
Map any API notes provided for this declaration to attributes on the declaration.
void CheckAlignasUnderalignment(Decl *D)
void HandleDelayedAccessCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
DarwinSDKInfo * getDarwinSDKInfoForAvailabilityChecking(SourceLocation Loc, StringRef Platform)
CUDALaunchBoundsAttr * CreateLaunchBoundsAttr(const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks)
Create an CUDALaunchBoundsAttr attribute.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
LifetimeCaptureByAttr * ParseLifetimeCaptureByAttr(const ParsedAttr &AL, StringRef ParamName)
bool checkMSInheritanceAttrOnDefinition(CXXRecordDecl *RD, SourceRange Range, bool BestCase, MSInheritanceModel SemanticSpelling)
bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)
Check if the argument E is a ASCII string literal.
bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall, const FunctionProtoType *Proto)
CheckFunctionCall - Check a direct function call for various correctness and safety properties not st...
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
bool isInSystemMacro(SourceLocation loc) const
Returns whether Loc is expanded from a macro in a system header.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
StringLiteral - This represents a string literal expression, e.g.
bool isBeingDefined() const
Return true if this decl is currently being defined.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Exposes information about the current target.
TargetOptions & getTargetOpts() const
Retrieve the target options.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
virtual bool hasFeatureEnabled(const llvm::StringMap< bool > &Features, StringRef Name) const
Check if target has a given feature enabled.
uint64_t getPointerWidth(LangAS AddrSpace) const
Return the width of pointers on this target, for the specified address space.
virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const
Determines whether a given calling convention is valid for the target.
bool isTLSSupported() const
Whether the target supports thread-local storage.
virtual unsigned getRegisterWidth() const
Return the "preferred" register width on this target.
virtual bool validateCPUSpecificCPUDispatch(StringRef Name) const
virtual bool hasProtectedVisibility() const
Does this target support "protected" visibility?
virtual unsigned getUnwindWordWidth() const
unsigned getCharWidth() const
virtual bool shouldDLLImportComdatSymbols() const
Does this target aim for semantic compatibility with Microsoft C++ code using dllimport/export attrib...
const llvm::VersionTuple & getSDKVersion() const
std::string CPU
If given, the name of the target CPU to generate code for.
llvm::StringMap< bool > FeatureMap
The map of which features have been enabled disabled based on the command line.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Base wrapper for a particular "section" of type source info.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
The base class of the type hierarchy.
bool isSizelessType() const
As an extension, we classify types as one of "sized" or "sizeless"; every type is one or the other.
bool isBlockPointerType() const
bool isBooleanType() const
const Type * getPointeeOrArrayElementType() const
If this is a pointer type, return the pointee type.
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool isFunctionPointerType() const
bool isPointerType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isEnumeralType() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that the type refers to.
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isExtVectorType() const
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isBitIntType() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isPointerOrReferenceType() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool hasFloatingRepresentation() const
Determine whether this type has a floating-point representation of some sort, e.g....
bool isVectorType() const
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
bool isFloatingType() const
bool isAnyPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
Base class for declarations which introduce a typedef-name.
static UnaryOperator * Create(const ASTContext &C, Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow, FPOptionsOverride FPFeatures)
Represents a dependent using declaration which was marked with typename.
Represents a dependent using declaration which was not marked with typename.
Represents a C++ using-declaration.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
Represents a variable declaration or definition.
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
@ TLS_None
Not a TLS variable.
Represents a GCC generic vector type.
Captures information about a #pragma weak directive.
const IdentifierInfo * getAlias() const
SourceLocation getLocation() const
A collection of diagnostics which were delayed.
const DelayedDiagnosticPool * getParent() const
void steal(DelayedDiagnosticPool &pool)
Steal the diagnostics from the given pool.
pool_iterator pool_end() const
SmallVectorImpl< DelayedDiagnostic >::const_iterator pool_iterator
pool_iterator pool_begin() const
A diagnostic message which has been conditionally emitted pending the complete parsing of the current...
QualType getForbiddenTypeOperand() const
unsigned getForbiddenTypeDiagnostic() const
The diagnostic ID to emit.
unsigned getForbiddenTypeArgument() const
Defines the clang::TargetInfo interface.
Enums for the diagnostics of target, target_version and target_clones.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ Match
This is not an overload because the signature exactly matches an existing declaration.
bool isa(CodeGen::Address addr)
@ ExpectedFunctionMethodOrBlock
@ ExpectedTypeOrNamespace
@ ExpectedVariableFieldOrTag
@ ExpectedVariableOrField
@ ExpectedFunctionOrMethod
@ ExpectedFunctionOrClassOrEnum
@ ExpectedVariableOrFunction
@ ExpectedFunctionVariableOrClass
@ ExpectedNonMemberFunction
void handleSimpleAttributeOrDiagnose(SemaBase &S, Decl *D, const AttributeCommonInfo &CI, bool PassesCheck, unsigned DiagID, DiagnosticArgs &&...ExtraArgs)
Add an attribute AttrType to declaration D, provided that PassesCheck is true.
bool hasDeclarator(const Decl *D)
Return true if the given decl has a declarator that should have been processed by Sema::GetTypeForDec...
QualType getFunctionOrMethodResultType(const Decl *D)
bool isInstanceMethod(const Decl *D)
@ OK_Ordinary
An ordinary object is located at an address in memory.
AvailabilityMergeKind
Describes the kind of merge to perform for availability attributes (including "deprecated",...
@ None
Don't merge availability attributes at all.
@ Override
Merge availability attributes for an override, which requires an exact match or a weakening of constr...
@ OptionalProtocolImplementation
Merge availability attributes for an implementation of an optional protocol requirement.
@ Redeclaration
Merge availability attributes for a redeclaration, which requires an exact match.
@ ProtocolImplementation
Merge availability attributes for an implementation of a protocol requirement.
@ VectorLength
'vector_length' clause, allowed on 'parallel', 'kernels', 'parallel loop', and 'kernels loop' constru...
void inferNoReturnAttr(Sema &S, const Decl *D)
CudaVersion ToCudaVersion(llvm::VersionTuple)
SmallVector< Attr *, 4 > AttrVec
AttrVec - A vector of Attr, which is how they are stored on the AST.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
bool checkAttrMutualExclusion(SemaBase &S, Decl *D, const ParsedAttr &AL)
Diagnose mutually exclusive attributes when present on a given declaration.
SourceRange getFunctionOrMethodResultSourceRange(const Decl *D)
bool isFunctionOrMethodOrBlockForAttrSubject(const Decl *D)
Return true if the given decl has function type (function or function-typed variable) or an Objective...
QualType getFunctionOrMethodParamType(const Decl *D, unsigned Idx)
@ Internal
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
Language
The language for the input, used to select and validate the language standard and possible actions.
AttributeArgumentNType
These constants match the enumerated choices of err_attribute_argument_n_type and err_attribute_argum...
@ AANT_ArgumentIntegerConstant
@ AANT_ArgumentBuiltinFunction
@ AANT_ArgumentIdentifier
@ SD_Automatic
Automatic storage duration (most local variables).
bool isLambdaCallOperator(const CXXMethodDecl *MD)
@ Result
The result type of a method or function.
@ SwiftAsyncContext
This parameter (which must have pointer type) uses the special Swift asynchronous context-pointer ABI...
@ SwiftErrorResult
This parameter (which must have pointer-to-pointer type) uses the special Swift error-result ABI trea...
@ SwiftIndirectResult
This parameter (which must have pointer type) is a Swift indirect result parameter.
@ SwiftContext
This parameter (which must have pointer type) uses the special Swift context-pointer ABI treatment.
const FunctionProtoType * T
bool isFunctionOrMethodVariadic(const Decl *D)
@ Template
We are parsing a template declaration.
bool isFuncOrMethodForAttrSubject(const Decl *D)
isFuncOrMethodForAttrSubject - Return true if the given decl has function type (function or function-...
OffloadArch StringToOffloadArch(llvm::StringRef S)
LLVM_READONLY bool isHexDigit(unsigned char c)
Return true if this character is an ASCII hex digit: [0-9a-fA-F].
SanitizerMask parseSanitizerValue(StringRef Value, bool AllowGroups)
Parse a single value from a -fsanitize= or -fno-sanitize= value list.
const char * OffloadArchToString(OffloadArch A)
void handleSimpleAttribute(SemaBase &S, Decl *D, const AttributeCommonInfo &CI)
Applies the given attribute to the Decl without performing any additional semantic checking.
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
MSInheritanceModel
Assigned inheritance model for a class in the MS C++ ABI.
bool hasFunctionProto(const Decl *D)
hasFunctionProto - Return true if the given decl has a argument information.
unsigned getFunctionOrMethodNumParams(const Decl *D)
getFunctionOrMethodNumParams - Return number of function or method parameters.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
DynamicRecursiveASTVisitorBase< false > DynamicRecursiveASTVisitor
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ Generic
not a target-specific vector type
U cast(CodeGen::Address addr)
SourceRange getFunctionOrMethodParamRange(const Decl *D, unsigned Idx)
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ None
No keyword precedes the qualified type name.
@ Union
The "union" keyword introduces the elaborated-type-specifier.
ActionResult< Expr * > ExprResult
@ Other
Other implicit parameter.
Represents information about a change in availability for an entity, which is part of the encoding of...
VersionTuple Version
The version number at which the change occurred.
bool isValid() const
Determine whether this availability change is valid.
static constexpr OSEnvPair macOStoMacCatalystPair()
Returns the os-environment mapping pair that's used to represent the macOS -> Mac Catalyst version ma...
static constexpr OSEnvPair iOStoWatchOSPair()
Returns the os-environment mapping pair that's used to represent the iOS -> watchOS version mapping.
static constexpr OSEnvPair iOStoTvOSPair()
Returns the os-environment mapping pair that's used to represent the iOS -> tvOS version mapping.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
const ParsedAttributesView & getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
uint16_t Part2
...-89ab-...
uint32_t Part1
{01234567-...
uint16_t Part3
...-cdef-...
uint8_t Part4And5[8]
...-0123-456789abcdef}
virtual AttrHandling handleDeclAttribute(Sema &S, Decl *D, const ParsedAttr &Attr) const
If this ParsedAttrInfo knows how to handle this ParsedAttr applied to this Decl then do so and return...
Contains information gathered from parsing the contents of TargetAttr.
std::vector< std::string > Features
StringRef BranchProtection
bool IncludeCXX11Attributes
bool IgnoreTypeAttributes