Lines Matching refs:AL

85 static unsigned getNumAttributeArgs(const ParsedAttr &AL) {  in getNumAttributeArgs()  argument
87 return AL.getNumArgs() + AL.hasParsedType(); in getNumAttributeArgs()
90 SourceLocation Sema::getAttrLoc(const ParsedAttr &AL) { return AL.getLoc(); } in getAttrLoc() argument
131 bool Sema::checkStringLiteralArgumentAttr(const ParsedAttr &AL, unsigned ArgNum, in checkStringLiteralArgumentAttr() argument
135 if (AL.isArgIdent(ArgNum)) { in checkStringLiteralArgumentAttr()
136 IdentifierLoc *Loc = AL.getArgAsIdent(ArgNum); in checkStringLiteralArgumentAttr()
138 << AL << AANT_ArgumentString in checkStringLiteralArgumentAttr()
148 Expr *ArgExpr = AL.getArgAsExpr(ArgNum); in checkStringLiteralArgumentAttr()
155 << AL << AANT_ArgumentString; in checkStringLiteralArgumentAttr()
159 return checkStringLiteralArgumentAttr(AL, ArgExpr, Str, ArgLocation); in checkStringLiteralArgumentAttr()
208 const ParsedAttr &AL) { in threadSafetyCheckIsPointer() argument
225 S.Diag(AL.getLoc(), diag::warn_thread_attribute_decl_not_pointer) << AL << QT; in threadSafetyCheckIsPointer()
329 const ParsedAttr &AL, in checkAttrArgsAreCapabilityObjs() argument
333 if (Sidx == AL.getNumArgs()) { in checkAttrArgsAreCapabilityObjs()
343 S.Diag(AL.getLoc(), in checkAttrArgsAreCapabilityObjs()
345 << AL << MD->getParent(); in checkAttrArgsAreCapabilityObjs()
347 S.Diag(AL.getLoc(), diag::warn_thread_attribute_not_on_non_static_member) in checkAttrArgsAreCapabilityObjs()
348 << AL; in checkAttrArgsAreCapabilityObjs()
352 for (unsigned Idx = Sidx; Idx < AL.getNumArgs(); ++Idx) { in checkAttrArgsAreCapabilityObjs()
353 Expr *ArgExp = AL.getArgAsExpr(Idx); in checkAttrArgsAreCapabilityObjs()
372 S.Diag(AL.getLoc(), diag::warn_thread_attribute_ignored) << AL; in checkAttrArgsAreCapabilityObjs()
400 S.Diag(AL.getLoc(), in checkAttrArgsAreCapabilityObjs()
402 << AL << Idx + 1 << NumParams; in checkAttrArgsAreCapabilityObjs()
414 S.Diag(AL.getLoc(), diag::warn_thread_attribute_argument_not_lockable) in checkAttrArgsAreCapabilityObjs()
415 << AL << ArgTy; in checkAttrArgsAreCapabilityObjs()
425 static void handlePtGuardedVarAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handlePtGuardedVarAttr() argument
426 if (!threadSafetyCheckIsPointer(S, D, AL)) in handlePtGuardedVarAttr()
429 D->addAttr(::new (S.Context) PtGuardedVarAttr(S.Context, AL)); in handlePtGuardedVarAttr()
432 static bool checkGuardedByAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL, in checkGuardedByAttrCommon() argument
436 checkAttrArgsAreCapabilityObjs(S, D, AL, Args); in checkGuardedByAttrCommon()
446 static void handleGuardedByAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleGuardedByAttr() argument
448 if (!checkGuardedByAttrCommon(S, D, AL, Arg)) in handleGuardedByAttr()
451 D->addAttr(::new (S.Context) GuardedByAttr(S.Context, AL, Arg)); in handleGuardedByAttr()
454 static void handlePtGuardedByAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handlePtGuardedByAttr() argument
456 if (!checkGuardedByAttrCommon(S, D, AL, Arg)) in handlePtGuardedByAttr()
459 if (!threadSafetyCheckIsPointer(S, D, AL)) in handlePtGuardedByAttr()
462 D->addAttr(::new (S.Context) PtGuardedByAttr(S.Context, AL, Arg)); in handlePtGuardedByAttr()
465 static bool checkAcquireOrderAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL, in checkAcquireOrderAttrCommon() argument
467 if (!AL.checkAtLeastNumArgs(S, 1)) in checkAcquireOrderAttrCommon()
473 S.Diag(AL.getLoc(), diag::warn_thread_attribute_decl_not_lockable) << AL; in checkAcquireOrderAttrCommon()
478 checkAttrArgsAreCapabilityObjs(S, D, AL, Args); in checkAcquireOrderAttrCommon()
485 static void handleAcquiredAfterAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAcquiredAfterAttr() argument
487 if (!checkAcquireOrderAttrCommon(S, D, AL, Args)) in handleAcquiredAfterAttr()
492 AcquiredAfterAttr(S.Context, AL, StartArg, Args.size())); in handleAcquiredAfterAttr()
495 static void handleAcquiredBeforeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAcquiredBeforeAttr() argument
497 if (!checkAcquireOrderAttrCommon(S, D, AL, Args)) in handleAcquiredBeforeAttr()
502 AcquiredBeforeAttr(S.Context, AL, StartArg, Args.size())); in handleAcquiredBeforeAttr()
505 static bool checkLockFunAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL, in checkLockFunAttrCommon() argument
509 checkAttrArgsAreCapabilityObjs(S, D, AL, Args, 0, /*ParamIdxOk=*/true); in checkLockFunAttrCommon()
514 static void handleAssertSharedLockAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAssertSharedLockAttr() argument
516 if (!checkLockFunAttrCommon(S, D, AL, Args)) in handleAssertSharedLockAttr()
522 AssertSharedLockAttr(S.Context, AL, StartArg, Size)); in handleAssertSharedLockAttr()
526 const ParsedAttr &AL) { in handleAssertExclusiveLockAttr() argument
528 if (!checkLockFunAttrCommon(S, D, AL, Args)) in handleAssertExclusiveLockAttr()
534 AssertExclusiveLockAttr(S.Context, AL, StartArg, Size)); in handleAssertExclusiveLockAttr()
562 static void handleAllocSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAllocSizeAttr() argument
563 if (!AL.checkAtLeastNumArgs(S, 1) || !AL.checkAtMostNumArgs(S, 2)) in handleAllocSizeAttr()
570 S.Diag(AL.getLoc(), diag::warn_attribute_return_pointers_only) << AL; in handleAllocSizeAttr()
574 const Expr *SizeExpr = AL.getArgAsExpr(0); in handleAllocSizeAttr()
577 if (!checkPositiveIntArgument(S, AL, SizeExpr, SizeArgNoVal, /*Idx=*/1)) in handleAllocSizeAttr()
579 if (!checkParamIsIntegerType(S, D, AL, /*AttrArgNo=*/0)) in handleAllocSizeAttr()
584 if (AL.getNumArgs() == 2) { in handleAllocSizeAttr()
585 const Expr *NumberExpr = AL.getArgAsExpr(1); in handleAllocSizeAttr()
588 if (!checkPositiveIntArgument(S, AL, NumberExpr, Val, /*Idx=*/2)) in handleAllocSizeAttr()
590 if (!checkParamIsIntegerType(S, D, AL, /*AttrArgNo=*/1)) in handleAllocSizeAttr()
596 AllocSizeAttr(S.Context, AL, SizeArgNo, NumberArgNo)); in handleAllocSizeAttr()
599 static bool checkTryLockFunAttrCommon(Sema &S, Decl *D, const ParsedAttr &AL, in checkTryLockFunAttrCommon() argument
601 if (!AL.checkAtLeastNumArgs(S, 1)) in checkTryLockFunAttrCommon()
604 if (!isIntOrBool(AL.getArgAsExpr(0))) { in checkTryLockFunAttrCommon()
605 S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type) in checkTryLockFunAttrCommon()
606 << AL << 1 << AANT_ArgumentIntOrBool; in checkTryLockFunAttrCommon()
611 checkAttrArgsAreCapabilityObjs(S, D, AL, Args, 1); in checkTryLockFunAttrCommon()
617 const ParsedAttr &AL) { in handleSharedTrylockFunctionAttr() argument
619 if (!checkTryLockFunAttrCommon(S, D, AL, Args)) in handleSharedTrylockFunctionAttr()
623 S.Context, AL, AL.getArgAsExpr(0), Args.data(), Args.size())); in handleSharedTrylockFunctionAttr()
627 const ParsedAttr &AL) { in handleExclusiveTrylockFunctionAttr() argument
629 if (!checkTryLockFunAttrCommon(S, D, AL, Args)) in handleExclusiveTrylockFunctionAttr()
633 S.Context, AL, AL.getArgAsExpr(0), Args.data(), Args.size())); in handleExclusiveTrylockFunctionAttr()
636 static void handleLockReturnedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleLockReturnedAttr() argument
639 checkAttrArgsAreCapabilityObjs(S, D, AL, Args); in handleLockReturnedAttr()
644 D->addAttr(::new (S.Context) LockReturnedAttr(S.Context, AL, Args[0])); in handleLockReturnedAttr()
647 static void handleLocksExcludedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleLocksExcludedAttr() argument
648 if (!AL.checkAtLeastNumArgs(S, 1)) in handleLocksExcludedAttr()
653 checkAttrArgsAreCapabilityObjs(S, D, AL, Args); in handleLocksExcludedAttr()
660 LocksExcludedAttr(S.Context, AL, StartArg, Size)); in handleLocksExcludedAttr()
663 static bool checkFunctionConditionAttr(Sema &S, Decl *D, const ParsedAttr &AL, in checkFunctionConditionAttr() argument
665 Cond = AL.getArgAsExpr(0); in checkFunctionConditionAttr()
673 if (!S.checkStringLiteralArgumentAttr(AL, 1, Msg)) in checkFunctionConditionAttr()
683 S.Diag(AL.getLoc(), diag::err_attr_cond_never_constant_expr) << AL; in checkFunctionConditionAttr()
691 static void handleEnableIfAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleEnableIfAttr() argument
692 S.Diag(AL.getLoc(), diag::ext_clang_enable_if); in handleEnableIfAttr()
696 if (checkFunctionConditionAttr(S, D, AL, Cond, Msg)) in handleEnableIfAttr()
697 D->addAttr(::new (S.Context) EnableIfAttr(S.Context, AL, Cond, Msg)); in handleEnableIfAttr()
700 static void handleErrorAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleErrorAttr() argument
702 if (!S.checkStringLiteralArgumentAttr(AL, 0, NewUserDiagnostic)) in handleErrorAttr()
704 if (ErrorAttr *EA = S.mergeErrorAttr(D, AL, NewUserDiagnostic)) in handleErrorAttr()
709 const ParsedAttr &AL) { in handleExcludeFromExplicitInstantiationAttr() argument
714 S.Diag(AL.getLoc(), in handleExcludeFromExplicitInstantiationAttr()
716 << AL << /*IsMember=*/!isa<CXXRecordDecl>(D); in handleExcludeFromExplicitInstantiationAttr()
720 ExcludeFromExplicitInstantiationAttr(S.Context, AL)); in handleExcludeFromExplicitInstantiationAttr()
770 const ParsedAttr &AL) { in handleDiagnoseAsBuiltinAttr() argument
775 S.Diag(AL.getLoc(), diag::err_attribute_no_member_function) << AL; in handleDiagnoseAsBuiltinAttr()
781 auto Union = AL.getArg(Index - 1); in handleDiagnoseAsBuiltinAttr()
787 S.Diag(Loc, diag::err_attribute_argument_n_type) << AL << Index << T; in handleDiagnoseAsBuiltinAttr()
791 if (!AL.isArgExpr(0)) in handleDiagnoseAsBuiltinAttr()
793 auto *F = dyn_cast_if_present<DeclRefExpr>(AL.getArgAsExpr(0)); in handleDiagnoseAsBuiltinAttr()
804 if (AttrFD->getNumParams() != AL.getNumArgs() - 1) { in handleDiagnoseAsBuiltinAttr()
805 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments_for) in handleDiagnoseAsBuiltinAttr()
806 << AL << AttrFD << AttrFD->getNumParams(); in handleDiagnoseAsBuiltinAttr()
812 for (unsigned I = 1; I < AL.getNumArgs(); ++I) { in handleDiagnoseAsBuiltinAttr()
813 if (!AL.isArgExpr(I)) { in handleDiagnoseAsBuiltinAttr()
818 const Expr *IndexExpr = AL.getArgAsExpr(I); in handleDiagnoseAsBuiltinAttr()
821 if (!S.checkUInt32Argument(AL, IndexExpr, Index, I + 1, false)) in handleDiagnoseAsBuiltinAttr()
825 S.Diag(AL.getLoc(), diag::err_attribute_bounds_for_function) in handleDiagnoseAsBuiltinAttr()
826 << AL << Index << DeclFD << DeclFD->getNumParams(); in handleDiagnoseAsBuiltinAttr()
836 << AL << Index << DeclFD << T2 << I << AttrFD << T1; in handleDiagnoseAsBuiltinAttr()
844 S.Context, AL, AttrFD, Indices.data(), Indices.size())); in handleDiagnoseAsBuiltinAttr()
847 static void handleDiagnoseIfAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleDiagnoseIfAttr() argument
848 S.Diag(AL.getLoc(), diag::ext_clang_diagnose_if); in handleDiagnoseIfAttr()
852 if (!checkFunctionConditionAttr(S, D, AL, Cond, Msg)) in handleDiagnoseIfAttr()
856 if (!S.checkStringLiteralArgumentAttr(AL, 2, DiagTypeStr)) in handleDiagnoseIfAttr()
861 S.Diag(AL.getArgAsExpr(2)->getBeginLoc(), in handleDiagnoseIfAttr()
870 S.Context, AL, Cond, Msg, DiagType, ArgDependent, cast<NamedDecl>(D))); in handleDiagnoseIfAttr()
873 static void handleNoBuiltinAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleNoBuiltinAttr() argument
891 if (AL.getNumArgs() == 0) in handleNoBuiltinAttr()
894 for (unsigned I = 0, E = AL.getNumArgs(); I != E; ++I) { in handleNoBuiltinAttr()
897 if (!S.checkStringLiteralArgumentAttr(AL, I, BuiltinName, &LiteralLoc)) in handleNoBuiltinAttr()
904 << BuiltinName << AL; in handleNoBuiltinAttr()
915 << AL; in handleNoBuiltinAttr()
920 NoBuiltinAttr(S.Context, AL, Names.data(), Names.size())); in handleNoBuiltinAttr()
923 static void handlePassObjectSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handlePassObjectSizeAttr() argument
925 S.Diag(D->getBeginLoc(), diag::err_attribute_only_once_per_parameter) << AL; in handlePassObjectSizeAttr()
929 Expr *E = AL.getArgAsExpr(0); in handlePassObjectSizeAttr()
931 if (!S.checkUInt32Argument(AL, E, Type, /*Idx=*/1)) in handlePassObjectSizeAttr()
939 << AL << 0 << 3 << E->getSourceRange(); in handlePassObjectSizeAttr()
948 S.Diag(D->getBeginLoc(), diag::err_attribute_pointers_only) << AL << 1; in handlePassObjectSizeAttr()
952 D->addAttr(::new (S.Context) PassObjectSizeAttr(S.Context, AL, (int)Type)); in handlePassObjectSizeAttr()
955 static void handleConsumableAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleConsumableAttr() argument
958 if (AL.isArgIdent(0)) { in handleConsumableAttr()
959 IdentifierLoc *IL = AL.getArgAsIdent(0); in handleConsumableAttr()
962 S.Diag(IL->Loc, diag::warn_attribute_type_not_supported) << AL in handleConsumableAttr()
967 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleConsumableAttr()
968 << AL << AANT_ArgumentIdentifier; in handleConsumableAttr()
972 D->addAttr(::new (S.Context) ConsumableAttr(S.Context, AL, DefaultState)); in handleConsumableAttr()
976 const ParsedAttr &AL) { in checkForConsumableClass() argument
981 S.Diag(AL.getLoc(), diag::warn_attr_on_unconsumable_class) << RD; in checkForConsumableClass()
990 static void handleCallableWhenAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCallableWhenAttr() argument
991 if (!AL.checkAtLeastNumArgs(S, 1)) in handleCallableWhenAttr()
994 if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), AL)) in handleCallableWhenAttr()
998 for (unsigned ArgIndex = 0; ArgIndex < AL.getNumArgs(); ++ArgIndex) { in handleCallableWhenAttr()
1003 if (AL.isArgIdent(ArgIndex)) { in handleCallableWhenAttr()
1004 IdentifierLoc *Ident = AL.getArgAsIdent(ArgIndex); in handleCallableWhenAttr()
1008 if (!S.checkStringLiteralArgumentAttr(AL, ArgIndex, StateString, &Loc)) in handleCallableWhenAttr()
1014 S.Diag(Loc, diag::warn_attribute_type_not_supported) << AL << StateString; in handleCallableWhenAttr()
1022 CallableWhenAttr(S.Context, AL, States.data(), States.size())); in handleCallableWhenAttr()
1025 static void handleParamTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleParamTypestateAttr() argument
1028 if (AL.isArgIdent(0)) { in handleParamTypestateAttr()
1029 IdentifierLoc *Ident = AL.getArgAsIdent(0); in handleParamTypestateAttr()
1035 << AL << StateString; in handleParamTypestateAttr()
1039 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleParamTypestateAttr()
1040 << AL << AANT_ArgumentIdentifier; in handleParamTypestateAttr()
1056 D->addAttr(::new (S.Context) ParamTypestateAttr(S.Context, AL, ParamState)); in handleParamTypestateAttr()
1059 static void handleReturnTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleReturnTypestateAttr() argument
1062 if (AL.isArgIdent(0)) { in handleReturnTypestateAttr()
1063 IdentifierLoc *IL = AL.getArgAsIdent(0); in handleReturnTypestateAttr()
1066 S.Diag(IL->Loc, diag::warn_attribute_type_not_supported) << AL in handleReturnTypestateAttr()
1071 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleReturnTypestateAttr()
1072 << AL << AANT_ArgumentIdentifier; in handleReturnTypestateAttr()
1101 D->addAttr(::new (S.Context) ReturnTypestateAttr(S.Context, AL, ReturnState)); in handleReturnTypestateAttr()
1104 static void handleSetTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleSetTypestateAttr() argument
1105 if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), AL)) in handleSetTypestateAttr()
1109 if (AL.isArgIdent(0)) { in handleSetTypestateAttr()
1110 IdentifierLoc *Ident = AL.getArgAsIdent(0); in handleSetTypestateAttr()
1113 S.Diag(Ident->Loc, diag::warn_attribute_type_not_supported) << AL in handleSetTypestateAttr()
1118 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleSetTypestateAttr()
1119 << AL << AANT_ArgumentIdentifier; in handleSetTypestateAttr()
1123 D->addAttr(::new (S.Context) SetTypestateAttr(S.Context, AL, NewState)); in handleSetTypestateAttr()
1126 static void handleTestTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleTestTypestateAttr() argument
1127 if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), AL)) in handleTestTypestateAttr()
1131 if (AL.isArgIdent(0)) { in handleTestTypestateAttr()
1132 IdentifierLoc *Ident = AL.getArgAsIdent(0); in handleTestTypestateAttr()
1135 S.Diag(Ident->Loc, diag::warn_attribute_type_not_supported) << AL in handleTestTypestateAttr()
1140 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleTestTypestateAttr()
1141 << AL << AANT_ArgumentIdentifier; in handleTestTypestateAttr()
1145 D->addAttr(::new (S.Context) TestTypestateAttr(S.Context, AL, TestState)); in handleTestTypestateAttr()
1148 static void handleExtVectorTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleExtVectorTypeAttr() argument
1153 static void handlePackedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handlePackedAttr() argument
1155 TD->addAttr(::new (S.Context) PackedAttr(S.Context, AL)); in handlePackedAttr()
1165 S.Diag(AL.getLoc(), diag::warn_attribute_ignored_for_field_of_type) in handlePackedAttr()
1166 << AL << FD->getType(); in handlePackedAttr()
1168 FD->addAttr(::new (S.Context) PackedAttr(S.Context, AL)); in handlePackedAttr()
1172 S.Diag(AL.getLoc(), diag::warn_attribute_packed_for_bitfield); in handlePackedAttr()
1174 FD->addAttr(::new (S.Context) PackedAttr(S.Context, AL)); in handlePackedAttr()
1178 S.Diag(AL.getLoc(), diag::warn_attribute_ignored) << AL; in handlePackedAttr()
1181 static void handlePreferredName(Sema &S, Decl *D, const ParsedAttr &AL) { in handlePreferredName() argument
1186 ParsedType PT = AL.getTypeArg(); in handlePreferredName()
1190 TSI = S.Context.getTrivialTypeSourceInfo(T, AL.getLoc()); in handlePreferredName()
1206 D->addAttr(::new (S.Context) PreferredNameAttr(S.Context, AL, TSI)); in handlePreferredName()
1211 S.Diag(AL.getLoc(), diag::err_attribute_preferred_name_arg_invalid) in handlePreferredName()
1242 static bool attrNonNullArgCheck(Sema &S, QualType T, const ParsedAttr &AL, in attrNonNullArgCheck() argument
1248 S.Diag(AL.getLoc(), diag::warn_attribute_return_pointers_only) in attrNonNullArgCheck()
1249 << AL << AttrParmRange << TypeRange; in attrNonNullArgCheck()
1251 S.Diag(AL.getLoc(), diag::warn_attribute_pointers_only) in attrNonNullArgCheck()
1252 << AL << AttrParmRange << TypeRange << 0; in attrNonNullArgCheck()
1258 static void handleNonNullAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleNonNullAttr() argument
1260 for (unsigned I = 0; I < AL.getNumArgs(); ++I) { in handleNonNullAttr()
1261 Expr *Ex = AL.getArgAsExpr(I); in handleNonNullAttr()
1263 if (!S.checkFunctionOrMethodParameterIndex(D, AL, I + 1, Ex, Idx)) in handleNonNullAttr()
1269 S, getFunctionOrMethodParamType(D, Idx.getASTIndex()), AL, in handleNonNullAttr()
1281 if (NonNullArgs.empty() && AL.getLoc().isFileID() && in handleNonNullAttr()
1292 S.Diag(AL.getLoc(), diag::warn_attribute_nonnull_no_pointers); in handleNonNullAttr()
1298 D->addAttr(::new (S.Context) NonNullAttr(S.Context, AL, Start, Size)); in handleNonNullAttr()
1302 const ParsedAttr &AL) { in handleNonNullAttrParameter() argument
1303 if (AL.getNumArgs() > 0) { in handleNonNullAttrParameter()
1305 handleNonNullAttr(S, D, AL); in handleNonNullAttrParameter()
1307 S.Diag(AL.getLoc(), diag::warn_attribute_nonnull_parm_no_args) in handleNonNullAttrParameter()
1314 if (!attrNonNullArgCheck(S, D->getType(), AL, SourceRange(), in handleNonNullAttrParameter()
1318 D->addAttr(::new (S.Context) NonNullAttr(S.Context, AL, nullptr, 0)); in handleNonNullAttrParameter()
1321 static void handleReturnsNonNullAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleReturnsNonNullAttr() argument
1324 if (!attrNonNullArgCheck(S, ResultType, AL, SourceRange(), SR, in handleReturnsNonNullAttr()
1328 D->addAttr(::new (S.Context) ReturnsNonNullAttr(S.Context, AL)); in handleReturnsNonNullAttr()
1331 static void handleNoEscapeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleNoEscapeAttr() argument
1338 S.Diag(AL.getLoc(), diag::warn_attribute_pointers_only) in handleNoEscapeAttr()
1339 << AL << AL.getRange() << 0; in handleNoEscapeAttr()
1343 D->addAttr(::new (S.Context) NoEscapeAttr(S.Context, AL)); in handleNoEscapeAttr()
1346 static void handleAssumeAlignedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAssumeAlignedAttr() argument
1347 Expr *E = AL.getArgAsExpr(0), in handleAssumeAlignedAttr()
1348 *OE = AL.getNumArgs() > 1 ? AL.getArgAsExpr(1) : nullptr; in handleAssumeAlignedAttr()
1349 S.AddAssumeAlignedAttr(D, AL, E, OE); in handleAssumeAlignedAttr()
1352 static void handleAllocAlignAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAllocAlignAttr() argument
1353 S.AddAllocAlignAttr(D, AL, AL.getArgAsExpr(0)); in handleAllocAlignAttr()
1448 static void handleOwnershipAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleOwnershipAttr() argument
1457 if (!AL.isArgIdent(0)) { in handleOwnershipAttr()
1458 S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type) in handleOwnershipAttr()
1459 << AL << 1 << AANT_ArgumentIdentifier; in handleOwnershipAttr()
1465 OwnershipAttr(S.Context, AL, nullptr, nullptr, 0).getOwnKind(); in handleOwnershipAttr()
1471 if (AL.getNumArgs() < 2) { in handleOwnershipAttr()
1472 S.Diag(AL.getLoc(), diag::err_attribute_too_few_arguments) << AL << 2; in handleOwnershipAttr()
1477 if (AL.getNumArgs() > 2) { in handleOwnershipAttr()
1478 S.Diag(AL.getLoc(), diag::err_attribute_too_many_arguments) << AL << 1; in handleOwnershipAttr()
1484 IdentifierInfo *Module = AL.getArgAsIdent(0)->Ident; in handleOwnershipAttr()
1492 for (unsigned i = 1; i < AL.getNumArgs(); ++i) { in handleOwnershipAttr()
1493 Expr *Ex = AL.getArgAsExpr(i); in handleOwnershipAttr()
1495 if (!S.checkFunctionOrMethodParameterIndex(D, AL, i, Ex, Idx)) in handleOwnershipAttr()
1513 S.Diag(AL.getLoc(), diag::err_ownership_type) << AL << Err in handleOwnershipAttr()
1523 S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible) in handleOwnershipAttr()
1524 << AL << I in handleOwnershipAttr()
1525 << (AL.isRegularKeywordAttribute() || in handleOwnershipAttr()
1536 S.Diag(AL.getLoc(), diag::note_ownership_returns_index_mismatch) in handleOwnershipAttr()
1549 OwnershipAttr(S.Context, AL, Module, Start, Size)); in handleOwnershipAttr()
1552 static void handleWeakRefAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleWeakRefAttr() argument
1554 if (AL.getNumArgs() > 1) { in handleWeakRefAttr()
1555 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 1; in handleWeakRefAttr()
1571 S.Diag(AL.getLoc(), diag::err_attribute_weakref_not_global_context) in handleWeakRefAttr()
1602 if (AL.getNumArgs() && S.checkStringLiteralArgumentAttr(AL, 0, Str)) in handleWeakRefAttr()
1605 D->addAttr(::new (S.Context) AliasAttr(S.Context, AL, Str)); in handleWeakRefAttr()
1607 D->addAttr(::new (S.Context) WeakRefAttr(S.Context, AL)); in handleWeakRefAttr()
1614 static void markUsedForAliasOrIfunc(Sema &S, Decl *D, const ParsedAttr &AL, in markUsedForAliasOrIfunc() argument
1623 &S.Context.Idents.get(Demangled ? Demangled.get() : Str), AL.getLoc()); in markUsedForAliasOrIfunc()
1642 static void handleIFuncAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleIFuncAttr() argument
1644 if (!S.checkStringLiteralArgumentAttr(AL, 0, Str)) in handleIFuncAttr()
1650 S.Diag(AL.getLoc(), diag::err_alias_is_definition) << FD << 1; in handleIFuncAttr()
1654 markUsedForAliasOrIfunc(S, D, AL, Str); in handleIFuncAttr()
1655 D->addAttr(::new (S.Context) IFuncAttr(S.Context, AL, Str)); in handleIFuncAttr()
1658 static void handleAliasAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAliasAttr() argument
1660 if (!S.checkStringLiteralArgumentAttr(AL, 0, Str)) in handleAliasAttr()
1664 S.Diag(AL.getLoc(), diag::err_alias_not_supported_on_darwin); in handleAliasAttr()
1672 S.Diag(AL.getLoc(), diag::err_alias_not_supported_on_nvptx); in handleAliasAttr()
1678 S.Diag(AL.getLoc(), diag::err_alias_is_definition) << FD << 0; in handleAliasAttr()
1684 S.Diag(AL.getLoc(), diag::err_alias_is_definition) << VD << 0; in handleAliasAttr()
1689 markUsedForAliasOrIfunc(S, D, AL, Str); in handleAliasAttr()
1690 D->addAttr(::new (S.Context) AliasAttr(S.Context, AL, Str)); in handleAliasAttr()
1693 static void handleTLSModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleTLSModelAttr() argument
1697 if (!S.checkStringLiteralArgumentAttr(AL, 0, Model, &LiteralLoc)) in handleTLSModelAttr()
1707 D->addAttr(::new (S.Context) TLSModelAttr(S.Context, AL, Model)); in handleTLSModelAttr()
1710 static void handleRestrictAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleRestrictAttr() argument
1713 D->addAttr(::new (S.Context) RestrictAttr(S.Context, AL)); in handleRestrictAttr()
1717 S.Diag(AL.getLoc(), diag::warn_attribute_return_pointers_only) in handleRestrictAttr()
1718 << AL << getFunctionOrMethodResultSourceRange(D); in handleRestrictAttr()
1721 static void handleCPUSpecificAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCPUSpecificAttr() argument
1724 if (AL.getParsedKind() == ParsedAttr::AT_CPUDispatch) { in handleCPUSpecificAttr()
1725 if (checkAttrMutualExclusion<CPUSpecificAttr>(S, D, AL)) in handleCPUSpecificAttr()
1729 S.Diag(AL.getLoc(), diag::err_disallowed_duplicate_attribute) << AL; in handleCPUSpecificAttr()
1733 } else if (AL.getParsedKind() == ParsedAttr::AT_CPUSpecific) { in handleCPUSpecificAttr()
1734 if (checkAttrMutualExclusion<CPUDispatchAttr>(S, D, AL)) in handleCPUSpecificAttr()
1738 S.Diag(AL.getLoc(), diag::err_disallowed_duplicate_attribute) << AL; in handleCPUSpecificAttr()
1748 S.Diag(AL.getLoc(), diag::err_attribute_dll_lambda) << AL; in handleCPUSpecificAttr()
1753 if (!AL.checkAtLeastNumArgs(S, 1)) in handleCPUSpecificAttr()
1757 for (unsigned ArgNo = 0; ArgNo < getNumAttributeArgs(AL); ++ArgNo) { in handleCPUSpecificAttr()
1758 if (!AL.isArgIdent(ArgNo)) { in handleCPUSpecificAttr()
1759 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleCPUSpecificAttr()
1760 << AL << AANT_ArgumentIdentifier; in handleCPUSpecificAttr()
1764 IdentifierLoc *CPUArg = AL.getArgAsIdent(ArgNo); in handleCPUSpecificAttr()
1769 << CPUName << (AL.getKind() == ParsedAttr::AT_CPUDispatch); in handleCPUSpecificAttr()
1778 S.Diag(AL.getLoc(), diag::warn_multiversion_duplicate_entries); in handleCPUSpecificAttr()
1785 if (AL.getKind() == ParsedAttr::AT_CPUSpecific) in handleCPUSpecificAttr()
1787 CPUSpecificAttr(S.Context, AL, CPUs.data(), CPUs.size())); in handleCPUSpecificAttr()
1790 CPUDispatchAttr(S.Context, AL, CPUs.data(), CPUs.size())); in handleCPUSpecificAttr()
1793 static void handleCommonAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCommonAttr() argument
1795 S.Diag(AL.getLoc(), diag::err_attribute_not_supported_in_lang) in handleCommonAttr()
1796 << AL << AttributeLangSupport::Cpp; in handleCommonAttr()
1800 D->addAttr(::new (S.Context) CommonAttr(S.Context, AL)); in handleCommonAttr()
1803 static void handleNakedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleNakedAttr() argument
1804 if (AL.isDeclspecAttribute()) { in handleNakedAttr()
1809 S.Diag(AL.getLoc(), diag::err_attribute_not_supported_on_arch) in handleNakedAttr()
1810 << AL << Triple.getArchName(); in handleNakedAttr()
1817 S.Diag(AL.getLoc(), diag::err_attribute_wrong_decl_type_str) in handleNakedAttr()
1818 << AL << AL.isRegularKeywordAttribute() << "non-member functions"; in handleNakedAttr()
1823 D->addAttr(::new (S.Context) NakedAttr(S.Context, AL)); in handleNakedAttr()
1870 bool Sema::CheckAttrTarget(const ParsedAttr &AL) { in CheckAttrTarget() argument
1872 if (!AL.existsInTarget(Context.getTargetInfo())) { in CheckAttrTarget()
1873 Diag(AL.getLoc(), AL.isRegularKeywordAttribute() in CheckAttrTarget()
1876 << AL << AL.getRange(); in CheckAttrTarget()
1877 AL.setInvalid(); in CheckAttrTarget()
1884 static void handleAnalyzerNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAnalyzerNoReturnAttr() argument
1892 S.Diag(AL.getLoc(), AL.isStandardAttributeSyntax() in handleAnalyzerNoReturnAttr()
1895 << AL << AL.isRegularKeywordAttribute() in handleAnalyzerNoReturnAttr()
1901 D->addAttr(::new (S.Context) AnalyzerNoReturnAttr(S.Context, AL)); in handleAnalyzerNoReturnAttr()
1905 static void handleVecReturnAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleVecReturnAttr() argument
1931 S.Diag(AL.getLoc(), diag::err_repeat_attribute) << A; in handleVecReturnAttr()
1939 S.Diag(AL.getLoc(), diag::err_attribute_vecreturn_only_vector_member); in handleVecReturnAttr()
1944 S.Diag(AL.getLoc(), diag::err_attribute_vecreturn_only_pod_record); in handleVecReturnAttr()
1950 S.Diag(AL.getLoc(), diag::err_attribute_vecreturn_only_vector_member); in handleVecReturnAttr()
1956 D->addAttr(::new (S.Context) VecReturnAttr(S.Context, AL)); in handleVecReturnAttr()
1960 const ParsedAttr &AL) { in handleDependencyAttr() argument
1965 S.Diag(AL.getLoc(), in handleDependencyAttr()
1971 D->addAttr(::new (S.Context) CarriesDependencyAttr(S.Context, AL)); in handleDependencyAttr()
1974 static void handleUnusedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleUnusedAttr() argument
1975 bool IsCXX17Attr = AL.isCXX11Attribute() && !AL.getScopeName(); in handleUnusedAttr()
1980 S.Diag(AL.getLoc(), diag::ext_cxx17_attr) << AL; in handleUnusedAttr()
1982 D->addAttr(::new (S.Context) UnusedAttr(S.Context, AL)); in handleUnusedAttr()
1985 static void handleConstructorAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleConstructorAttr() argument
1987 if (S.getLangOpts().HLSL && AL.getNumArgs()) { in handleConstructorAttr()
1988 S.Diag(AL.getLoc(), diag::err_hlsl_init_priority_unsupported); in handleConstructorAttr()
1991 if (AL.getNumArgs() && in handleConstructorAttr()
1992 !S.checkUInt32Argument(AL, AL.getArgAsExpr(0), priority)) in handleConstructorAttr()
1995 D->addAttr(::new (S.Context) ConstructorAttr(S.Context, AL, priority)); in handleConstructorAttr()
1998 static void handleDestructorAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleDestructorAttr() argument
2000 if (AL.getNumArgs() && in handleDestructorAttr()
2001 !S.checkUInt32Argument(AL, AL.getArgAsExpr(0), priority)) in handleDestructorAttr()
2004 D->addAttr(::new (S.Context) DestructorAttr(S.Context, AL, priority)); in handleDestructorAttr()
2008 static void handleAttrWithMessage(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAttrWithMessage() argument
2011 if (AL.getNumArgs() == 1 && !S.checkStringLiteralArgumentAttr(AL, 0, Str)) in handleAttrWithMessage()
2014 D->addAttr(::new (S.Context) AttrTy(S.Context, AL, Str)); in handleAttrWithMessage()
2244 static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAvailabilityAttr() argument
2247 S.Diag(AL.getRange().getBegin(), diag::warn_deprecated_ignored_on_using) in handleAvailabilityAttr()
2248 << AL; in handleAvailabilityAttr()
2252 if (!AL.checkExactlyNumArgs(S, 1)) in handleAvailabilityAttr()
2254 IdentifierLoc *Platform = AL.getArgAsIdent(0); in handleAvailabilityAttr()
2265 AvailabilityChange Introduced = AL.getAvailabilityIntroduced(); in handleAvailabilityAttr()
2266 AvailabilityChange Deprecated = AL.getAvailabilityDeprecated(); in handleAvailabilityAttr()
2267 AvailabilityChange Obsoleted = AL.getAvailabilityObsoleted(); in handleAvailabilityAttr()
2268 bool IsUnavailable = AL.getUnavailableLoc().isValid(); in handleAvailabilityAttr()
2269 bool IsStrict = AL.getStrictLoc().isValid(); in handleAvailabilityAttr()
2271 if (const auto *SE = dyn_cast_if_present<StringLiteral>(AL.getMessageExpr())) in handleAvailabilityAttr()
2275 dyn_cast_if_present<StringLiteral>(AL.getReplacementExpr())) in handleAvailabilityAttr()
2281 S.Diag(AL.getLoc(), in handleAvailabilityAttr()
2291 S.Diag(AL.getLoc(), diag::warn_availability_fuchsia_unavailable_minor); in handleAvailabilityAttr()
2297 S.Diag(AL.getStrictLoc(), diag::err_availability_unexpected_parameter) in handleAvailabilityAttr()
2300 int PriorityModifier = AL.isPragmaClangAttribute() in handleAvailabilityAttr()
2304 const IdentifierLoc *EnvironmentLoc = AL.getEnvironment(); in handleAvailabilityAttr()
2321 ND, AL, II, false /*Implicit*/, Introduced.Version, Deprecated.Version, in handleAvailabilityAttr()
2377 ND, AL, NewII, true /*Implicit*/, NewIntroduced, NewDeprecated, in handleAvailabilityAttr()
2419 ND, AL, NewII, true /*Implicit*/, NewIntroduced, NewDeprecated, in handleAvailabilityAttr()
2430 return S.getDarwinSDKInfoForAvailabilityChecking(AL.getRange().getBegin(), in handleAvailabilityAttr()
2450 ND, AL, NewII, true /*Implicit*/, in handleAvailabilityAttr()
2492 ND, AL, NewII, true /*Implicit*/, in handleAvailabilityAttr()
2509 const ParsedAttr &AL) { in handleExternalSourceSymbolAttr() argument
2510 if (!AL.checkAtLeastNumArgs(S, 1) || !AL.checkAtMostNumArgs(S, 4)) in handleExternalSourceSymbolAttr()
2514 if (const auto *SE = dyn_cast_if_present<StringLiteral>(AL.getArgAsExpr(0))) in handleExternalSourceSymbolAttr()
2517 if (const auto *SE = dyn_cast_if_present<StringLiteral>(AL.getArgAsExpr(1))) in handleExternalSourceSymbolAttr()
2519 bool IsGeneratedDeclaration = AL.getArgAsIdent(2) != nullptr; in handleExternalSourceSymbolAttr()
2521 if (const auto *SE = dyn_cast_if_present<StringLiteral>(AL.getArgAsExpr(3))) in handleExternalSourceSymbolAttr()
2525 S.Context, AL, Language, DefinedIn, IsGeneratedDeclaration, USR)); in handleExternalSourceSymbolAttr()
2555 static void handleVisibilityAttr(Sema &S, Decl *D, const ParsedAttr &AL, in handleVisibilityAttr() argument
2559 S.Diag(AL.getRange().getBegin(), diag::warn_attribute_ignored) << AL; in handleVisibilityAttr()
2566 S.Diag(AL.getRange().getBegin(), diag::err_attribute_wrong_decl_type) in handleVisibilityAttr()
2567 << AL << AL.isRegularKeywordAttribute() << ExpectedTypeOrNamespace; in handleVisibilityAttr()
2574 if (!S.checkStringLiteralArgumentAttr(AL, 0, TypeStr, &LiteralLoc)) in handleVisibilityAttr()
2579 S.Diag(LiteralLoc, diag::warn_attribute_type_not_supported) << AL in handleVisibilityAttr()
2588 S.Diag(AL.getLoc(), diag::warn_attribute_protected_visibility); in handleVisibilityAttr()
2595 D, AL, (TypeVisibilityAttr::VisibilityType)type); in handleVisibilityAttr()
2597 newAttr = S.mergeVisibilityAttr(D, AL, type); in handleVisibilityAttr()
2603 static void handleSentinelAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleSentinelAttr() argument
2605 if (AL.getNumArgs() > 0) { in handleSentinelAttr()
2606 Expr *E = AL.getArgAsExpr(0); in handleSentinelAttr()
2609 S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type) in handleSentinelAttr()
2610 << AL << 1 << AANT_ArgumentIntegerConstant << E->getSourceRange(); in handleSentinelAttr()
2615 S.Diag(AL.getLoc(), diag::err_attribute_sentinel_less_than_zero) in handleSentinelAttr()
2624 if (AL.getNumArgs() > 1) { in handleSentinelAttr()
2625 Expr *E = AL.getArgAsExpr(1); in handleSentinelAttr()
2628 S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type) in handleSentinelAttr()
2629 << AL << 2 << AANT_ArgumentIntegerConstant << E->getSourceRange(); in handleSentinelAttr()
2637 S.Diag(AL.getLoc(), diag::err_attribute_sentinel_not_zero_or_one) in handleSentinelAttr()
2646 S.Diag(AL.getLoc(), diag::warn_attribute_sentinel_named_arguments); in handleSentinelAttr()
2651 S.Diag(AL.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0; in handleSentinelAttr()
2656 S.Diag(AL.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0; in handleSentinelAttr()
2661 S.Diag(AL.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 1; in handleSentinelAttr()
2674 S.Diag(AL.getLoc(), diag::warn_attribute_sentinel_not_variadic) << m; in handleSentinelAttr()
2678 S.Diag(AL.getLoc(), diag::warn_attribute_wrong_decl_type) in handleSentinelAttr()
2679 << AL << AL.isRegularKeywordAttribute() in handleSentinelAttr()
2684 S.Diag(AL.getLoc(), diag::warn_attribute_wrong_decl_type) in handleSentinelAttr()
2685 << AL << AL.isRegularKeywordAttribute() in handleSentinelAttr()
2689 D->addAttr(::new (S.Context) SentinelAttr(S.Context, AL, sentinel, nullPos)); in handleSentinelAttr()
2692 static void handleWarnUnusedResult(Sema &S, Decl *D, const ParsedAttr &AL) { in handleWarnUnusedResult() argument
2696 S.Diag(AL.getLoc(), diag::warn_attribute_void_function_method) << AL << 0; in handleWarnUnusedResult()
2701 S.Diag(AL.getLoc(), diag::warn_attribute_void_function_method) << AL << 1; in handleWarnUnusedResult()
2706 if (AL.isStandardAttributeSyntax() && !AL.getScopeName()) { in handleWarnUnusedResult()
2710 S.Diag(AL.getLoc(), diag::warn_attribute_wrong_decl_type_str) in handleWarnUnusedResult()
2711 << AL << AL.isRegularKeywordAttribute() in handleWarnUnusedResult()
2720 if (AL.getNumArgs() == 1) { in handleWarnUnusedResult()
2722 S.Diag(AL.getLoc(), diag::ext_cxx20_attr) << AL; in handleWarnUnusedResult()
2728 if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, nullptr)) in handleWarnUnusedResult()
2731 S.Diag(AL.getLoc(), diag::ext_cxx17_attr) << AL; in handleWarnUnusedResult()
2734 if ((!AL.isGNUAttribute() && in handleWarnUnusedResult()
2735 !(AL.isStandardAttributeSyntax() && AL.isClangScope())) && in handleWarnUnusedResult()
2737 S.Diag(AL.getLoc(), diag::warn_unused_result_typedef_unsupported_spelling) in handleWarnUnusedResult()
2738 << AL.isGNUScope(); in handleWarnUnusedResult()
2742 D->addAttr(::new (S.Context) WarnUnusedResultAttr(S.Context, AL, Str)); in handleWarnUnusedResult()
2745 static void handleWeakImportAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleWeakImportAttr() argument
2750 S.Diag(AL.getLoc(), diag::warn_attribute_invalid_on_definition) in handleWeakImportAttr()
2757 S.Diag(AL.getLoc(), diag::warn_attribute_wrong_decl_type) in handleWeakImportAttr()
2758 << AL << AL.isRegularKeywordAttribute() << ExpectedVariableOrFunction; in handleWeakImportAttr()
2763 D->addAttr(::new (S.Context) WeakImportAttr(S.Context, AL)); in handleWeakImportAttr()
2768 static void handleWorkGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) { in handleWorkGroupSize() argument
2771 const Expr *E = AL.getArgAsExpr(i); in handleWorkGroupSize()
2772 if (!S.checkUInt32Argument(AL, E, WGSize[i], i, in handleWorkGroupSize()
2776 S.Diag(AL.getLoc(), diag::err_attribute_argument_is_zero) in handleWorkGroupSize()
2777 << AL << E->getSourceRange(); in handleWorkGroupSize()
2786 S.Diag(AL.getLoc(), diag::warn_duplicate_attribute) << AL; in handleWorkGroupSize()
2789 WorkGroupAttr(S.Context, AL, WGSize[0], WGSize[1], WGSize[2])); in handleWorkGroupSize()
2792 static void handleVecTypeHint(Sema &S, Decl *D, const ParsedAttr &AL) { in handleVecTypeHint() argument
2793 if (!AL.hasParsedType()) { in handleVecTypeHint()
2794 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 1; in handleVecTypeHint()
2799 QualType ParmType = S.GetTypeFromParser(AL.getTypeArg(), &ParmTSI); in handleVecTypeHint()
2805 S.Diag(AL.getLoc(), diag::err_attribute_invalid_argument) << 2 << AL; in handleVecTypeHint()
2811 S.Diag(AL.getLoc(), diag::warn_duplicate_attribute) << AL; in handleVecTypeHint()
2816 D->addAttr(::new (S.Context) VecTypeHintAttr(S.Context, AL, ParmTSI)); in handleVecTypeHint()
2860 static void handleSectionAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleSectionAttr() argument
2865 if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &LiteralLoc)) in handleSectionAttr()
2871 SectionAttr *NewAttr = S.mergeSectionAttr(D, AL, Str); in handleSectionAttr()
2882 static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCodeModelAttr() argument
2886 if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &LiteralLoc)) in handleCodeModelAttr()
2895 D->addAttr(::new (S.Context) CodeModelAttr(S.Context, AL, CM)); in handleCodeModelAttr()
2930 static void handleCodeSegAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCodeSegAttr() argument
2933 if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &LiteralLoc)) in handleCodeSegAttr()
2939 S.Diag(AL.getLoc(), in handleCodeSegAttr()
2947 if (CodeSegAttr *CSA = S.mergeCodeSegAttr(D, AL, Str)) in handleCodeSegAttr()
3030 static void handleTargetVersionAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleTargetVersionAttr() argument
3033 if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &LiteralLoc) || in handleTargetVersionAttr()
3037 ::new (S.Context) TargetVersionAttr(S.Context, AL, Str); in handleTargetVersionAttr()
3041 static void handleTargetAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleTargetAttr() argument
3044 if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &LiteralLoc) || in handleTargetAttr()
3048 TargetAttr *NewAttr = ::new (S.Context) TargetAttr(S.Context, AL, Str); in handleTargetAttr()
3149 static void handleTargetClonesAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleTargetClonesAttr() argument
3157 S.Diag(AL.getLoc(), diag::err_disallowed_duplicate_attribute) << AL; in handleTargetClonesAttr()
3161 if (checkAttrMutualExclusion<TargetClonesAttr>(S, D, AL)) in handleTargetClonesAttr()
3168 for (unsigned I = 0, E = AL.getNumArgs(); I != E; ++I) { in handleTargetClonesAttr()
3171 if (!S.checkStringLiteralArgumentAttr(AL, I, CurStr, &LiteralLoc) || in handleTargetClonesAttr()
3174 cast<StringLiteral>(AL.getArgAsExpr(I)->IgnoreParenCasts()), D, in handleTargetClonesAttr()
3181 if (HasCommas && AL.getNumArgs() > 1) in handleTargetClonesAttr()
3182 S.Diag(AL.getLoc(), diag::warn_target_clone_mixed_values); in handleTargetClonesAttr()
3191 S.Diag(AL.getLoc(), diag::err_target_clone_must_have_default); in handleTargetClonesAttr()
3212 TargetClonesAttr(S.Context, AL, Strings.data(), Strings.size()); in handleTargetClonesAttr()
3216 static void handleMinVectorWidthAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleMinVectorWidthAttr() argument
3217 Expr *E = AL.getArgAsExpr(0); in handleMinVectorWidthAttr()
3219 if (!S.checkUInt32Argument(AL, E, VecWidth)) { in handleMinVectorWidthAttr()
3220 AL.setInvalid(); in handleMinVectorWidthAttr()
3226 S.Diag(AL.getLoc(), diag::warn_duplicate_attribute) << AL; in handleMinVectorWidthAttr()
3230 D->addAttr(::new (S.Context) MinVectorWidthAttr(S.Context, AL, VecWidth)); in handleMinVectorWidthAttr()
3233 static void handleCleanupAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCleanupAttr() argument
3234 Expr *E = AL.getArgAsExpr(0); in handleCleanupAttr()
3309 D->addAttr(::new (S.Context) CleanupAttr(S.Context, AL, FD)); in handleCleanupAttr()
3313 const ParsedAttr &AL) { in handleEnumExtensibilityAttr() argument
3314 if (!AL.isArgIdent(0)) { in handleEnumExtensibilityAttr()
3315 S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type) in handleEnumExtensibilityAttr()
3316 << AL << 0 << AANT_ArgumentIdentifier; in handleEnumExtensibilityAttr()
3321 IdentifierInfo *II = AL.getArgAsIdent(0)->Ident; in handleEnumExtensibilityAttr()
3324 S.Diag(AL.getLoc(), diag::warn_attribute_type_not_supported) << AL << II; in handleEnumExtensibilityAttr()
3329 EnumExtensibilityAttr(S.Context, AL, ExtensibilityKind)); in handleEnumExtensibilityAttr()
3334 static void handleFormatArgAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleFormatArgAttr() argument
3335 const Expr *IdxExpr = AL.getArgAsExpr(0); in handleFormatArgAttr()
3337 if (!S.checkFunctionOrMethodParameterIndex(D, AL, 1, IdxExpr, Idx)) in handleFormatArgAttr()
3347 S.Diag(AL.getLoc(), diag::err_format_attribute_not) in handleFormatArgAttr()
3363 S.Diag(AL.getLoc(), diag::err_format_attribute_result_not) in handleFormatArgAttr()
3369 D->addAttr(::new (S.Context) FormatArgAttr(S.Context, AL, Idx)); in handleFormatArgAttr()
3404 static void handleInitPriorityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleInitPriorityAttr() argument
3406 S.Diag(AL.getLoc(), diag::warn_attribute_ignored) << AL; in handleInitPriorityAttr()
3411 S.Diag(AL.getLoc(), diag::err_hlsl_init_priority_unsupported); in handleInitPriorityAttr()
3416 S.Diag(AL.getLoc(), diag::err_init_priority_object_attr); in handleInitPriorityAttr()
3417 AL.setInvalid(); in handleInitPriorityAttr()
3424 S.Diag(AL.getLoc(), diag::err_init_priority_object_attr); in handleInitPriorityAttr()
3425 AL.setInvalid(); in handleInitPriorityAttr()
3429 Expr *E = AL.getArgAsExpr(0); in handleInitPriorityAttr()
3431 if (!S.checkUInt32Argument(AL, E, prioritynum)) { in handleInitPriorityAttr()
3432 AL.setInvalid(); in handleInitPriorityAttr()
3440 !S.getSourceManager().isInSystemHeader(AL.getLoc())) { in handleInitPriorityAttr()
3441 S.Diag(AL.getLoc(), diag::err_attribute_argument_out_of_range) in handleInitPriorityAttr()
3442 << E->getSourceRange() << AL << 101 << 65535; in handleInitPriorityAttr()
3443 AL.setInvalid(); in handleInitPriorityAttr()
3446 D->addAttr(::new (S.Context) InitPriorityAttr(S.Context, AL, prioritynum)); in handleInitPriorityAttr()
3495 static void handleFormatAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleFormatAttr() argument
3496 if (!AL.isArgIdent(0)) { in handleFormatAttr()
3497 S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type) in handleFormatAttr()
3498 << AL << 1 << AANT_ArgumentIdentifier; in handleFormatAttr()
3507 IdentifierInfo *II = AL.getArgAsIdent(0)->Ident; in handleFormatAttr()
3522 S.Diag(AL.getLoc(), diag::warn_attribute_type_not_supported) in handleFormatAttr()
3523 << AL << II->getName(); in handleFormatAttr()
3528 Expr *IdxExpr = AL.getArgAsExpr(1); in handleFormatAttr()
3530 if (!S.checkUInt32Argument(AL, IdxExpr, Idx, 2)) in handleFormatAttr()
3534 S.Diag(AL.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleFormatAttr()
3535 << AL << 2 << IdxExpr->getSourceRange(); in handleFormatAttr()
3544 S.Diag(AL.getLoc(), in handleFormatAttr()
3558 S.Diag(AL.getLoc(), diag::err_format_attribute_not) in handleFormatAttr()
3564 Expr *FirstArgExpr = AL.getArgAsExpr(2); in handleFormatAttr()
3566 if (!S.checkUInt32Argument(AL, FirstArgExpr, FirstArg, 3)) in handleFormatAttr()
3574 S.Diag(AL.getLoc(), diag::err_format_strftime_third_parameter) in handleFormatAttr()
3583 S.Diag(AL.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleFormatAttr()
3584 << AL << 3 << FirstArgExpr->getSourceRange() in handleFormatAttr()
3591 S.Diag(D->getLocation(), diag::warn_gcc_requires_variadic_function) << AL; in handleFormatAttr()
3596 S.Diag(AL.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleFormatAttr()
3597 << AL << 3 << FirstArgExpr->getSourceRange(); in handleFormatAttr()
3603 FormatAttr *NewAttr = S.mergeFormatAttr(D, AL, II, Idx, FirstArg); in handleFormatAttr()
3609 static void handleCallbackAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCallbackAttr() argument
3611 if (AL.getNumArgs() == 0) { in handleCallbackAttr()
3612 S.Diag(AL.getLoc(), diag::err_callback_attribute_no_callee) in handleCallbackAttr()
3613 << AL.getRange(); in handleCallbackAttr()
3635 for (unsigned I = 0, E = AL.getNumArgs(); I < E; ++I) { in handleCallbackAttr()
3639 if (AL.isArgIdent(I)) { in handleCallbackAttr()
3640 IdentifierLoc *IdLoc = AL.getArgAsIdent(I); in handleCallbackAttr()
3643 S.Diag(AL.getLoc(), diag::err_callback_attribute_argument_unknown) in handleCallbackAttr()
3650 } else if (AL.isArgExpr(I)) { in handleCallbackAttr()
3651 Expr *IdxExpr = AL.getArgAsExpr(I); in handleCallbackAttr()
3654 if (!S.checkUInt32Argument(AL, IdxExpr, (uint32_t &)ArgIdx, I + 1, in handleCallbackAttr()
3656 S.Diag(AL.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleCallbackAttr()
3657 << AL << (I + 1) << IdxExpr->getSourceRange(); in handleCallbackAttr()
3663 S.Diag(AL.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleCallbackAttr()
3664 << AL << (I + 1) << IdxExpr->getSourceRange(); in handleCallbackAttr()
3674 S.Diag(AL.getLoc(), diag::err_callback_implicit_this_not_available) in handleCallbackAttr()
3692 S.Diag(AL.getLoc(), diag::err_callback_attribute_invalid_callee) in handleCallbackAttr()
3693 << AL.getRange(); in handleCallbackAttr()
3703 S.Diag(AL.getLoc(), diag::err_callback_callee_no_function_type) in handleCallbackAttr()
3704 << AL.getRange(); in handleCallbackAttr()
3715 S.Diag(AL.getLoc(), diag::err_callback_callee_no_function_type) in handleCallbackAttr()
3716 << AL.getRange(); in handleCallbackAttr()
3721 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) in handleCallbackAttr()
3722 << AL << (unsigned)(EncodingIndices.size() - 1); in handleCallbackAttr()
3727 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) in handleCallbackAttr()
3728 << AL << (unsigned)(EncodingIndices.size() - 1); in handleCallbackAttr()
3733 S.Diag(AL.getLoc(), diag::err_callback_callee_is_variadic) << AL.getRange(); in handleCallbackAttr()
3739 S.Diag(AL.getLoc(), diag::err_callback_attribute_multiple) << AL.getRange(); in handleCallbackAttr()
3744 S.Context, AL, EncodingIndices.data(), EncodingIndices.size())); in handleCallbackAttr()
3755 static void handleCalledOnceAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCalledOnceAttr() argument
3760 S.Diag(AL.getLoc(), diag::err_called_once_attribute_wrong_type); in handleCalledOnceAttr()
3764 D->addAttr(::new (S.Context) CalledOnceAttr(S.Context, AL)); in handleCalledOnceAttr()
3767 static void handleTransparentUnionAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleTransparentUnionAttr() argument
3777 S.Diag(AL.getLoc(), diag::warn_attribute_wrong_decl_type) in handleTransparentUnionAttr()
3778 << AL << AL.isRegularKeywordAttribute() << ExpectedUnion; in handleTransparentUnionAttr()
3784 S.Diag(AL.getLoc(), in handleTransparentUnionAttr()
3792 S.Diag(AL.getLoc(), diag::warn_transparent_union_attribute_zero_fields); in handleTransparentUnionAttr()
3835 RD->addAttr(::new (S.Context) TransparentUnionAttr(S.Context, AL)); in handleTransparentUnionAttr()
3847 static void handleAnnotateAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAnnotateAttr() argument
3851 if (!S.checkStringLiteralArgumentAttr(AL, 0, Str)) in handleAnnotateAttr()
3855 Args.reserve(AL.getNumArgs() - 1); in handleAnnotateAttr()
3856 for (unsigned Idx = 1; Idx < AL.getNumArgs(); Idx++) { in handleAnnotateAttr()
3857 assert(!AL.isArgIdent(Idx)); in handleAnnotateAttr()
3858 Args.push_back(AL.getArgAsExpr(Idx)); in handleAnnotateAttr()
3861 S.AddAnnotationAttr(D, AL, Str, Args); in handleAnnotateAttr()
3864 static void handleAlignValueAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAlignValueAttr() argument
3865 S.AddAlignValueAttr(D, AL, AL.getArgAsExpr(0)); in handleAlignValueAttr()
3908 static void handleAlignedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAlignedAttr() argument
3909 if (AL.hasParsedType()) { in handleAlignedAttr()
3910 const ParsedType &TypeArg = AL.getTypeArg(); in handleAlignedAttr()
3914 if (AL.isPackExpansion() && in handleAlignedAttr()
3916 S.Diag(AL.getEllipsisLoc(), in handleAlignedAttr()
3921 if (!AL.isPackExpansion() && in handleAlignedAttr()
3926 S.AddAlignedAttr(D, AL, TInfo, AL.isPackExpansion()); in handleAlignedAttr()
3931 if (AL.getNumArgs() > 1) { in handleAlignedAttr()
3932 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 1; in handleAlignedAttr()
3936 if (AL.getNumArgs() == 0) { in handleAlignedAttr()
3937 D->addAttr(::new (S.Context) AlignedAttr(S.Context, AL, true, nullptr)); in handleAlignedAttr()
3941 Expr *E = AL.getArgAsExpr(0); in handleAlignedAttr()
3942 if (AL.isPackExpansion() && !E->containsUnexpandedParameterPack()) { in handleAlignedAttr()
3943 S.Diag(AL.getEllipsisLoc(), in handleAlignedAttr()
3948 if (!AL.isPackExpansion() && S.DiagnoseUnexpandedParameterPack(E)) in handleAlignedAttr()
3951 S.AddAlignedAttr(D, AL, E, AL.isPackExpansion()); in handleAlignedAttr()
4281 static void handleModeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleModeAttr() argument
4284 if (!AL.isArgIdent(0)) { in handleModeAttr()
4285 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleModeAttr()
4286 << AL << AANT_ArgumentIdentifier; in handleModeAttr()
4290 IdentifierInfo *Name = AL.getArgAsIdent(0)->Ident; in handleModeAttr()
4292 S.AddModeAttr(D, AL, Name); in handleModeAttr()
4440 static void handleNoDebugAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleNoDebugAttr() argument
4441 D->addAttr(::new (S.Context) NoDebugAttr(S.Context, AL)); in handleNoDebugAttr()
4460 const ParsedAttr &AL) { in mergeInternalLinkageAttr() argument
4465 Diag(AL.getLoc(), diag::warn_attribute_wrong_decl_type) in mergeInternalLinkageAttr()
4466 << AL << AL.isRegularKeywordAttribute() in mergeInternalLinkageAttr()
4478 return ::new (Context) InternalLinkageAttr(Context, AL); in mergeInternalLinkageAttr()
4481 Sema::mergeInternalLinkageAttr(Decl *D, const InternalLinkageAttr &AL) { in mergeInternalLinkageAttr() argument
4486 Diag(AL.getLocation(), diag::warn_attribute_wrong_decl_type) in mergeInternalLinkageAttr()
4487 << &AL << AL.isRegularKeywordAttribute() in mergeInternalLinkageAttr()
4499 return ::new (Context) InternalLinkageAttr(Context, AL); in mergeInternalLinkageAttr()
4534 static void handleAlwaysInlineAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAlwaysInlineAttr() argument
4536 S.mergeAlwaysInlineAttr(D, AL, AL.getAttrName())) in handleAlwaysInlineAttr()
4540 static void handleMinSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleMinSizeAttr() argument
4541 if (MinSizeAttr *MinSize = S.mergeMinSizeAttr(D, AL)) in handleMinSizeAttr()
4545 static void handleOptimizeNoneAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleOptimizeNoneAttr() argument
4546 if (OptimizeNoneAttr *Optnone = S.mergeOptimizeNoneAttr(D, AL)) in handleOptimizeNoneAttr()
4550 static void handleConstantAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleConstantAttr() argument
4553 S.Diag(AL.getLoc(), diag::err_cuda_nonstatic_constdev); in handleConstantAttr()
4563 D->addAttr(::new (S.Context) CUDAConstantAttr(S.Context, AL)); in handleConstantAttr()
4566 static void handleSharedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleSharedAttr() argument
4572 S.Diag(AL.getLoc(), diag::err_cuda_extern_shared) << VD; in handleSharedAttr()
4576 S.CUDA().DiagIfHostCode(AL.getLoc(), diag::err_cuda_host_shared) in handleSharedAttr()
4579 D->addAttr(::new (S.Context) CUDASharedAttr(S.Context, AL)); in handleSharedAttr()
4582 static void handleGlobalAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleGlobalAttr() argument
4606 if (AL.getKind() == ParsedAttr::AT_NVPTXKernel) in handleGlobalAttr()
4607 D->addAttr(::new (S.Context) NVPTXKernelAttr(S.Context, AL)); in handleGlobalAttr()
4609 D->addAttr(::new (S.Context) CUDAGlobalAttr(S.Context, AL)); in handleGlobalAttr()
4618 static void handleDeviceAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleDeviceAttr() argument
4621 S.Diag(AL.getLoc(), diag::err_cuda_nonstatic_constdev); in handleDeviceAttr()
4631 D->addAttr(::new (S.Context) CUDADeviceAttr(S.Context, AL)); in handleDeviceAttr()
4634 static void handleManagedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleManagedAttr() argument
4637 S.Diag(AL.getLoc(), diag::err_cuda_nonstatic_constdev); in handleManagedAttr()
4642 D->addAttr(::new (S.Context) HIPManagedAttr(S.Context, AL)); in handleManagedAttr()
4647 static void handleGNUInlineAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleGNUInlineAttr() argument
4650 S.Diag(AL.getLoc(), diag::warn_gnu_inline_attribute_requires_inline); in handleGNUInlineAttr()
4655 S.Diag(AL.getLoc(), diag::warn_gnu_inline_cplusplus_without_extern); in handleGNUInlineAttr()
4657 D->addAttr(::new (S.Context) GNUInlineAttr(S.Context, AL)); in handleGNUInlineAttr()
4660 static void handleCallConvAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCallConvAttr() argument
4667 AL, CC, /*FD*/ nullptr, in handleCallConvAttr()
4672 S.Diag(AL.getLoc(), diag::warn_attribute_wrong_decl_type) in handleCallConvAttr()
4673 << AL << AL.isRegularKeywordAttribute() << ExpectedFunctionOrMethod; in handleCallConvAttr()
4677 switch (AL.getKind()) { in handleCallConvAttr()
4679 D->addAttr(::new (S.Context) FastCallAttr(S.Context, AL)); in handleCallConvAttr()
4682 D->addAttr(::new (S.Context) StdCallAttr(S.Context, AL)); in handleCallConvAttr()
4685 D->addAttr(::new (S.Context) ThisCallAttr(S.Context, AL)); in handleCallConvAttr()
4688 D->addAttr(::new (S.Context) CDeclAttr(S.Context, AL)); in handleCallConvAttr()
4691 D->addAttr(::new (S.Context) PascalAttr(S.Context, AL)); in handleCallConvAttr()
4694 D->addAttr(::new (S.Context) SwiftCallAttr(S.Context, AL)); in handleCallConvAttr()
4697 D->addAttr(::new (S.Context) SwiftAsyncCallAttr(S.Context, AL)); in handleCallConvAttr()
4700 D->addAttr(::new (S.Context) VectorCallAttr(S.Context, AL)); in handleCallConvAttr()
4703 D->addAttr(::new (S.Context) MSABIAttr(S.Context, AL)); in handleCallConvAttr()
4706 D->addAttr(::new (S.Context) SysVABIAttr(S.Context, AL)); in handleCallConvAttr()
4709 D->addAttr(::new (S.Context) RegCallAttr(S.Context, AL)); in handleCallConvAttr()
4724 D->addAttr(::new (S.Context) PcsAttr(S.Context, AL, PCS)); in handleCallConvAttr()
4728 D->addAttr(::new (S.Context) AArch64VectorPcsAttr(S.Context, AL)); in handleCallConvAttr()
4731 D->addAttr(::new (S.Context) AArch64SVEPcsAttr(S.Context, AL)); in handleCallConvAttr()
4734 D->addAttr(::new (S.Context) AMDGPUKernelCallAttr(S.Context, AL)); in handleCallConvAttr()
4737 D->addAttr(::new (S.Context) IntelOclBiccAttr(S.Context, AL)); in handleCallConvAttr()
4740 D->addAttr(::new (S.Context) PreserveMostAttr(S.Context, AL)); in handleCallConvAttr()
4743 D->addAttr(::new (S.Context) PreserveAllAttr(S.Context, AL)); in handleCallConvAttr()
4746 D->addAttr(::new (S.Context) M68kRTDAttr(S.Context, AL)); in handleCallConvAttr()
4749 D->addAttr(::new (S.Context) PreserveNoneAttr(S.Context, AL)); in handleCallConvAttr()
4752 D->addAttr(::new (S.Context) RISCVVectorCCAttr(S.Context, AL)); in handleCallConvAttr()
4759 static void handleSuppressAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleSuppressAttr() argument
4760 if (AL.getAttributeSpellingListIndex() == SuppressAttr::CXX11_gsl_suppress) { in handleSuppressAttr()
4762 if (!AL.checkAtLeastNumArgs(S, 1)) in handleSuppressAttr()
4767 for (unsigned I = 0, E = AL.getNumArgs(); I != E; ++I) { in handleSuppressAttr()
4770 if (!S.checkStringLiteralArgumentAttr(AL, I, RuleName, nullptr)) in handleSuppressAttr()
4776 SuppressAttr(S.Context, AL, DiagnosticIdentifiers.data(), in handleSuppressAttr()
4780 static void handleLifetimeCategoryAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleLifetimeCategoryAttr() argument
4783 if (AL.hasParsedType()) { in handleLifetimeCategoryAttr()
4784 ParmType = S.GetTypeFromParser(AL.getTypeArg(), &DerefTypeLoc); in handleLifetimeCategoryAttr()
4793 S.Diag(AL.getLoc(), diag::err_attribute_invalid_argument) in handleLifetimeCategoryAttr()
4794 << SelectIdx << AL; in handleLifetimeCategoryAttr()
4805 if (AL.getKind() == ParsedAttr::AT_Owner) { in handleLifetimeCategoryAttr()
4806 if (checkAttrMutualExclusion<PointerAttr>(S, D, AL)) in handleLifetimeCategoryAttr()
4813 S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible) in handleLifetimeCategoryAttr()
4814 << AL << OAttr in handleLifetimeCategoryAttr()
4815 << (AL.isRegularKeywordAttribute() || in handleLifetimeCategoryAttr()
4822 Redecl->addAttr(::new (S.Context) OwnerAttr(S.Context, AL, DerefTypeLoc)); in handleLifetimeCategoryAttr()
4825 if (checkAttrMutualExclusion<OwnerAttr>(S, D, AL)) in handleLifetimeCategoryAttr()
4832 S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible) in handleLifetimeCategoryAttr()
4833 << AL << PAttr in handleLifetimeCategoryAttr()
4834 << (AL.isRegularKeywordAttribute() || in handleLifetimeCategoryAttr()
4842 PointerAttr(S.Context, AL, DerefTypeLoc)); in handleLifetimeCategoryAttr()
4847 static void handleRandomizeLayoutAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleRandomizeLayoutAttr() argument
4848 if (checkAttrMutualExclusion<NoRandomizeLayoutAttr>(S, D, AL)) in handleRandomizeLayoutAttr()
4851 D->addAttr(::new (S.Context) RandomizeLayoutAttr(S.Context, AL)); in handleRandomizeLayoutAttr()
4855 const ParsedAttr &AL) { in handleNoRandomizeLayoutAttr() argument
4856 if (checkAttrMutualExclusion<RandomizeLayoutAttr>(S, D, AL)) in handleNoRandomizeLayoutAttr()
4859 D->addAttr(::new (S.Context) NoRandomizeLayoutAttr(S.Context, AL)); in handleNoRandomizeLayoutAttr()
5037 bool Sema::CheckRegparmAttr(const ParsedAttr &AL, unsigned &numParams) { in CheckRegparmAttr() argument
5038 if (AL.isInvalid()) in CheckRegparmAttr()
5041 if (!AL.checkExactlyNumArgs(*this, 1)) { in CheckRegparmAttr()
5042 AL.setInvalid(); in CheckRegparmAttr()
5047 Expr *NumParamsExpr = AL.getArgAsExpr(0); in CheckRegparmAttr()
5048 if (!checkUInt32Argument(AL, NumParamsExpr, NP)) { in CheckRegparmAttr()
5049 AL.setInvalid(); in CheckRegparmAttr()
5054 Diag(AL.getLoc(), diag::err_attribute_regparm_wrong_platform) in CheckRegparmAttr()
5056 AL.setInvalid(); in CheckRegparmAttr()
5062 Diag(AL.getLoc(), diag::err_attribute_regparm_invalid_number) in CheckRegparmAttr()
5064 AL.setInvalid(); in CheckRegparmAttr()
5084 const CUDALaunchBoundsAttr &AL, in makeLaunchBoundsArgExpr() argument
5097 << &AL << Idx << AANT_ArgumentIntegerConstant << E->getSourceRange(); in makeLaunchBoundsArgExpr()
5108 << &AL << Idx << E->getSourceRange(); in makeLaunchBoundsArgExpr()
5160 static void handleLaunchBoundsAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleLaunchBoundsAttr() argument
5161 if (!AL.checkAtLeastNumArgs(S, 1) || !AL.checkAtMostNumArgs(S, 3)) in handleLaunchBoundsAttr()
5164 S.AddLaunchBoundsAttr(D, AL, AL.getArgAsExpr(0), in handleLaunchBoundsAttr()
5165 AL.getNumArgs() > 1 ? AL.getArgAsExpr(1) : nullptr, in handleLaunchBoundsAttr()
5166 AL.getNumArgs() > 2 ? AL.getArgAsExpr(2) : nullptr); in handleLaunchBoundsAttr()
5170 const ParsedAttr &AL) { in handleArgumentWithTypeTagAttr() argument
5171 if (!AL.isArgIdent(0)) { in handleArgumentWithTypeTagAttr()
5172 S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type) in handleArgumentWithTypeTagAttr()
5173 << AL << /* arg num = */ 1 << AANT_ArgumentIdentifier; in handleArgumentWithTypeTagAttr()
5178 if (!S.checkFunctionOrMethodParameterIndex(D, AL, 2, AL.getArgAsExpr(1), in handleArgumentWithTypeTagAttr()
5183 if (!S.checkFunctionOrMethodParameterIndex(D, AL, 3, AL.getArgAsExpr(2), in handleArgumentWithTypeTagAttr()
5187 bool IsPointer = AL.getAttrName()->getName() == "pointer_with_type_tag"; in handleArgumentWithTypeTagAttr()
5193 S.Diag(AL.getLoc(), diag::err_attribute_pointers_only) << AL << 0; in handleArgumentWithTypeTagAttr()
5197 S.Context, AL, AL.getArgAsIdent(0)->Ident, ArgumentIdx, TypeTagIdx, in handleArgumentWithTypeTagAttr()
5202 const ParsedAttr &AL) { in handleTypeTagForDatatypeAttr() argument
5203 if (!AL.isArgIdent(0)) { in handleTypeTagForDatatypeAttr()
5204 S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type) in handleTypeTagForDatatypeAttr()
5205 << AL << 1 << AANT_ArgumentIdentifier; in handleTypeTagForDatatypeAttr()
5209 if (!AL.checkExactlyNumArgs(S, 1)) in handleTypeTagForDatatypeAttr()
5213 S.Diag(AL.getLoc(), diag::err_attribute_wrong_decl_type) in handleTypeTagForDatatypeAttr()
5214 << AL << AL.isRegularKeywordAttribute() << ExpectedVariable; in handleTypeTagForDatatypeAttr()
5218 IdentifierInfo *PointerKind = AL.getArgAsIdent(0)->Ident; in handleTypeTagForDatatypeAttr()
5220 S.GetTypeFromParser(AL.getMatchingCType(), &MatchingCTypeLoc); in handleTypeTagForDatatypeAttr()
5224 S.Context, AL, PointerKind, MatchingCTypeLoc, AL.getLayoutCompatible(), in handleTypeTagForDatatypeAttr()
5225 AL.getMustBeNull())); in handleTypeTagForDatatypeAttr()
5228 static void handleXRayLogArgsAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleXRayLogArgsAttr() argument
5231 if (!S.checkFunctionOrMethodParameterIndex(D, AL, 1, AL.getArgAsExpr(0), in handleXRayLogArgsAttr()
5238 XRayLogArgsAttr(S.Context, AL, ArgCount.getSourceIndex())); in handleXRayLogArgsAttr()
5242 const ParsedAttr &AL) { in handlePatchableFunctionEntryAttr() argument
5244 S.Diag(AL.getLoc(), diag::err_aix_attr_unsupported) << AL; in handlePatchableFunctionEntryAttr()
5248 if (!S.checkUInt32Argument(AL, AL.getArgAsExpr(0), Count, 0, true)) in handlePatchableFunctionEntryAttr()
5250 if (AL.getNumArgs() == 2) { in handlePatchableFunctionEntryAttr()
5251 Expr *Arg = AL.getArgAsExpr(1); in handlePatchableFunctionEntryAttr()
5252 if (!S.checkUInt32Argument(AL, Arg, Offset, 1, true)) in handlePatchableFunctionEntryAttr()
5255 S.Diag(S.getAttrLoc(AL), diag::err_attribute_argument_out_of_range) in handlePatchableFunctionEntryAttr()
5256 << &AL << 0 << Count << Arg->getBeginLoc(); in handlePatchableFunctionEntryAttr()
5261 PatchableFunctionEntryAttr(S.Context, AL, Count, Offset)); in handlePatchableFunctionEntryAttr()
5264 static void handleBuiltinAliasAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleBuiltinAliasAttr() argument
5265 if (!AL.isArgIdent(0)) { in handleBuiltinAliasAttr()
5266 S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type) in handleBuiltinAliasAttr()
5267 << AL << 1 << AANT_ArgumentIdentifier; in handleBuiltinAliasAttr()
5271 IdentifierInfo *Ident = AL.getArgAsIdent(0)->Ident; in handleBuiltinAliasAttr()
5284 S.Diag(AL.getLoc(), diag::err_attribute_builtin_alias) << AL; in handleBuiltinAliasAttr()
5288 D->addAttr(::new (S.Context) BuiltinAliasAttr(S.Context, AL, Ident)); in handleBuiltinAliasAttr()
5291 static void handleNullableTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleNullableTypeAttr() argument
5292 if (AL.isUsedAsTypeAttr()) in handleNullableTypeAttr()
5297 S.Diag(AL.getRange().getBegin(), diag::err_attribute_wrong_decl_type_str) in handleNullableTypeAttr()
5298 << AL << AL.isRegularKeywordAttribute() << "classes"; in handleNullableTypeAttr()
5302 handleSimpleAttribute<TypeNullableAttr>(S, D, AL); in handleNullableTypeAttr()
5305 static void handlePreferredTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handlePreferredTypeAttr() argument
5306 if (!AL.hasParsedType()) { in handlePreferredTypeAttr()
5307 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 1; in handlePreferredTypeAttr()
5312 QualType QT = S.GetTypeFromParser(AL.getTypeArg(), &ParmTSI); in handlePreferredTypeAttr()
5317 D->addAttr(::new (S.Context) PreferredTypeAttr(S.Context, AL, ParmTSI)); in handlePreferredTypeAttr()
5339 static void handleUuidAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleUuidAttr() argument
5341 S.Diag(AL.getLoc(), diag::err_attribute_not_supported_in_lang) in handleUuidAttr()
5342 << AL << AttributeLangSupport::C; in handleUuidAttr()
5348 if (!S.checkStringLiteralArgumentAttr(AL, 0, OrigStrRef, &LiteralLoc)) in handleUuidAttr()
5391 if (AL.isMicrosoftAttribute()) // Check for [uuid(...)] spelling. in handleUuidAttr()
5392 S.Diag(AL.getLoc(), diag::warn_atl_uuid_deprecated); in handleUuidAttr()
5394 UuidAttr *UA = S.mergeUuidAttr(D, AL, OrigStrRef, Guid); in handleUuidAttr()
5399 static void handleMSInheritanceAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleMSInheritanceAttr() argument
5401 S.Diag(AL.getLoc(), diag::err_attribute_not_supported_in_lang) in handleMSInheritanceAttr()
5402 << AL << AttributeLangSupport::C; in handleMSInheritanceAttr()
5406 D, AL, /*BestCase=*/true, (MSInheritanceModel)AL.getSemanticSpelling()); in handleMSInheritanceAttr()
5413 static void handleDeclspecThreadAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleDeclspecThreadAttr() argument
5416 S.Diag(AL.getLoc(), diag::err_thread_unsupported); in handleDeclspecThreadAttr()
5420 S.Diag(AL.getLoc(), diag::err_declspec_thread_on_thread_variable); in handleDeclspecThreadAttr()
5424 S.Diag(AL.getLoc(), diag::err_thread_non_global) << "__declspec(thread)"; in handleDeclspecThreadAttr()
5427 D->addAttr(::new (S.Context) ThreadAttr(S.Context, AL)); in handleDeclspecThreadAttr()
5430 static void handleMSConstexprAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleMSConstexprAttr() argument
5432 S.Diag(AL.getLoc(), diag::warn_unknown_attribute_ignored) in handleMSConstexprAttr()
5433 << AL << AL.getRange(); in handleMSConstexprAttr()
5438 S.Diag(AL.getLoc(), diag::err_ms_constexpr_cannot_be_applied) in handleMSConstexprAttr()
5444 S.Diag(AL.getLoc(), diag::err_ms_constexpr_cannot_be_applied) in handleMSConstexprAttr()
5449 D->addAttr(::new (S.Context) MSConstexprAttr(S.Context, AL)); in handleMSConstexprAttr()
5452 static void handleAbiTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAbiTagAttr() argument
5454 for (unsigned I = 0, E = AL.getNumArgs(); I != E; ++I) { in handleAbiTagAttr()
5456 if (!S.checkStringLiteralArgumentAttr(AL, I, Tag)) in handleAbiTagAttr()
5463 S.Diag(AL.getLoc(), diag::warn_attr_abi_tag_namespace) << 0; in handleAbiTagAttr()
5467 S.Diag(AL.getLoc(), diag::warn_attr_abi_tag_namespace) << 1; in handleAbiTagAttr()
5470 if (AL.getNumArgs() == 0) in handleAbiTagAttr()
5472 } else if (!AL.checkAtLeastNumArgs(S, 1)) in handleAbiTagAttr()
5480 AbiTagAttr(S.Context, AL, Tags.data(), Tags.size())); in handleAbiTagAttr()
5491 static void handleBTFDeclTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleBTFDeclTagAttr() argument
5493 if (!S.checkStringLiteralArgumentAttr(AL, 0, Str)) in handleBTFDeclTagAttr()
5498 D->addAttr(::new (S.Context) BTFDeclTagAttr(S.Context, AL, Str)); in handleBTFDeclTagAttr()
5501 BTFDeclTagAttr *Sema::mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL) { in mergeBTFDeclTagAttr() argument
5502 if (hasBTFDeclTagAttr(D, AL.getBTFDeclTag())) in mergeBTFDeclTagAttr()
5504 return ::new (Context) BTFDeclTagAttr(Context, AL, AL.getBTFDeclTag()); in mergeBTFDeclTagAttr()
5507 static void handleInterruptAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleInterruptAttr() argument
5511 S.MSP430().handleInterruptAttr(D, AL); in handleInterruptAttr()
5515 S.MIPS().handleInterruptAttr(D, AL); in handleInterruptAttr()
5518 S.M68k().handleInterruptAttr(D, AL); in handleInterruptAttr()
5522 S.X86().handleAnyInterruptAttr(D, AL); in handleInterruptAttr()
5525 S.AVR().handleInterruptAttr(D, AL); in handleInterruptAttr()
5529 S.RISCV().handleInterruptAttr(D, AL); in handleInterruptAttr()
5532 S.ARM().handleInterruptAttr(D, AL); in handleInterruptAttr()
5537 static void handleLayoutVersion(Sema &S, Decl *D, const ParsedAttr &AL) { in handleLayoutVersion() argument
5539 Expr *VersionExpr = static_cast<Expr *>(AL.getArgAsExpr(0)); in handleLayoutVersion()
5540 if (!S.checkUInt32Argument(AL, AL.getArgAsExpr(0), Version)) in handleLayoutVersion()
5545 S.Diag(AL.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleLayoutVersion()
5546 << AL << Version << VersionExpr->getSourceRange(); in handleLayoutVersion()
5555 D->addAttr(::new (S.Context) LayoutVersionAttr(S.Context, AL, Version)); in handleLayoutVersion()
5651 static void handleCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCapabilityAttr() argument
5662 if (AL.getKind() == ParsedAttr::AT_Capability && in handleCapabilityAttr()
5663 !S.checkStringLiteralArgumentAttr(AL, 0, N, &LiteralLoc)) in handleCapabilityAttr()
5666 D->addAttr(::new (S.Context) CapabilityAttr(S.Context, AL, N)); in handleCapabilityAttr()
5669 static void handleAssertCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAssertCapabilityAttr() argument
5671 if (!checkLockFunAttrCommon(S, D, AL, Args)) in handleAssertCapabilityAttr()
5675 AssertCapabilityAttr(S.Context, AL, Args.data(), Args.size())); in handleAssertCapabilityAttr()
5679 const ParsedAttr &AL) { in handleAcquireCapabilityAttr() argument
5681 if (!checkLockFunAttrCommon(S, D, AL, Args)) in handleAcquireCapabilityAttr()
5684 D->addAttr(::new (S.Context) AcquireCapabilityAttr(S.Context, AL, Args.data(), in handleAcquireCapabilityAttr()
5689 const ParsedAttr &AL) { in handleTryAcquireCapabilityAttr() argument
5691 if (!checkTryLockFunAttrCommon(S, D, AL, Args)) in handleTryAcquireCapabilityAttr()
5695 S.Context, AL, AL.getArgAsExpr(0), Args.data(), Args.size())); in handleTryAcquireCapabilityAttr()
5699 const ParsedAttr &AL) { in handleReleaseCapabilityAttr() argument
5702 checkAttrArgsAreCapabilityObjs(S, D, AL, Args, 0, true); in handleReleaseCapabilityAttr()
5704 D->addAttr(::new (S.Context) ReleaseCapabilityAttr(S.Context, AL, Args.data(), in handleReleaseCapabilityAttr()
5709 const ParsedAttr &AL) { in handleRequiresCapabilityAttr() argument
5710 if (!AL.checkAtLeastNumArgs(S, 1)) in handleRequiresCapabilityAttr()
5715 checkAttrArgsAreCapabilityObjs(S, D, AL, Args); in handleRequiresCapabilityAttr()
5720 RequiresCapabilityAttr(S.Context, AL, Args.data(), Args.size()); in handleRequiresCapabilityAttr()
5725 static void handleDeprecatedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleDeprecatedAttr() argument
5728 S.Diag(AL.getLoc(), diag::warn_deprecated_anonymous_namespace); in handleDeprecatedAttr()
5736 S.Diag(AL.getRange().getBegin(), diag::warn_deprecated_ignored_on_using) in handleDeprecatedAttr()
5737 << AL; in handleDeprecatedAttr()
5743 if (AL.isArgExpr(0) && AL.getArgAsExpr(0) && in handleDeprecatedAttr()
5744 !S.checkStringLiteralArgumentAttr(AL, 0, Str)) in handleDeprecatedAttr()
5748 if (AL.isDeclspecAttribute() || AL.isStandardAttributeSyntax()) in handleDeprecatedAttr()
5749 AL.checkAtMostNumArgs(S, 1); in handleDeprecatedAttr()
5750 else if (AL.isArgExpr(1) && AL.getArgAsExpr(1) && in handleDeprecatedAttr()
5751 !S.checkStringLiteralArgumentAttr(AL, 1, Replacement)) in handleDeprecatedAttr()
5754 if (!S.getLangOpts().CPlusPlus14 && AL.isCXX11Attribute() && !AL.isGNUScope()) in handleDeprecatedAttr()
5755 S.Diag(AL.getLoc(), diag::ext_cxx14_attr) << AL; in handleDeprecatedAttr()
5757 D->addAttr(::new (S.Context) DeprecatedAttr(S.Context, AL, Str, Replacement)); in handleDeprecatedAttr()
5771 static void handleNoSanitizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleNoSanitizeAttr() argument
5772 if (!AL.checkAtLeastNumArgs(S, 1)) in handleNoSanitizeAttr()
5777 for (unsigned I = 0, E = AL.getNumArgs(); I != E; ++I) { in handleNoSanitizeAttr()
5781 if (!S.checkStringLiteralArgumentAttr(AL, I, SanitizerName, &LiteralLoc)) in handleNoSanitizeAttr()
5790 << AL << SanitizerName; in handleNoSanitizeAttr()
5794 D->addAttr(::new (S.Context) NoSanitizeAttr(S.Context, AL, Sanitizers.data(), in handleNoSanitizeAttr()
5799 const ParsedAttr &AL) { in handleNoSanitizeSpecificAttr() argument
5800 StringRef AttrName = AL.getAttrName()->getName(); in handleNoSanitizeSpecificAttr()
5809 << AL << AL.isRegularKeywordAttribute() << ExpectedFunction; in handleNoSanitizeSpecificAttr()
5820 if (AL.isStandardAttributeSyntax()) in handleNoSanitizeSpecificAttr()
5823 AttributeCommonInfo Info = AL; in handleNoSanitizeSpecificAttr()
5829 static void handleInternalLinkageAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleInternalLinkageAttr() argument
5830 if (InternalLinkageAttr *Internal = S.mergeInternalLinkageAttr(D, AL)) in handleInternalLinkageAttr()
5834 static void handleZeroCallUsedRegsAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleZeroCallUsedRegsAttr() argument
5838 if (!S.checkStringLiteralArgumentAttr(AL, 0, KindStr, &LiteralLoc)) in handleZeroCallUsedRegsAttr()
5844 << AL << KindStr; in handleZeroCallUsedRegsAttr()
5849 D->addAttr(ZeroCallUsedRegsAttr::Create(S.Context, Kind, AL)); in handleZeroCallUsedRegsAttr()
5852 static void handleCountedByAttrField(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCountedByAttrField() argument
5856 auto *CountExpr = AL.getArgAsExpr(0); in handleCountedByAttrField()
5862 switch (AL.getKind()) { in handleCountedByAttrField()
5893 const ParsedAttr &AL) { in handleFunctionReturnThunksAttr() argument
5896 if (!S.checkStringLiteralArgumentAttr(AL, 0, KindStr, &LiteralLoc)) in handleFunctionReturnThunksAttr()
5902 << AL << KindStr; in handleFunctionReturnThunksAttr()
5909 D->addAttr(FunctionReturnThunksAttr::Create(S.Context, Kind, AL)); in handleFunctionReturnThunksAttr()
5913 const ParsedAttr &AL) { in handleAvailableOnlyInDefaultEvalMethod() argument
5915 handleSimpleAttribute<AvailableOnlyInDefaultEvalMethodAttr>(S, D, AL); in handleAvailableOnlyInDefaultEvalMethod()
5918 static void handleNoMergeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleNoMergeAttr() argument
5921 S.Diag(AL.getLoc(), diag::warn_attribute_ignored_non_function_pointer) in handleNoMergeAttr()
5922 << AL << VDecl; in handleNoMergeAttr()
5925 D->addAttr(NoMergeAttr::Create(S.Context, AL)); in handleNoMergeAttr()
5928 static void handleNoUniqueAddressAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleNoUniqueAddressAttr() argument
5929 D->addAttr(NoUniqueAddressAttr::Create(S.Context, AL)); in handleNoUniqueAddressAttr()
5945 static void handleUninitializedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleUninitializedAttr() argument
5948 D->addAttr(::new (S.Context) UninitializedAttr(S.Context, AL)); in handleUninitializedAttr()
5951 static void handleMIGServerRoutineAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleMIGServerRoutineAttr() argument
5970 handleSimpleAttribute<MIGServerRoutineAttr>(S, D, AL); in handleMIGServerRoutineAttr()
5973 static void handleMSAllocatorAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleMSAllocatorAttr() argument
5978 S.Diag(AL.getLoc(), diag::warn_declspec_allocator_nonpointer) in handleMSAllocatorAttr()
5979 << AL.getRange() << RetTy; in handleMSAllocatorAttr()
5984 handleSimpleAttribute<MSAllocatorAttr>(S, D, AL); in handleMSAllocatorAttr()
5987 static void handleAcquireHandleAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleAcquireHandleAttr() argument
5988 if (AL.isUsedAsTypeAttr()) in handleAcquireHandleAttr()
5993 S.Diag(AL.getLoc(), diag::err_attribute_output_parameter) in handleAcquireHandleAttr()
5994 << AL.getRange(); in handleAcquireHandleAttr()
5999 if (!S.checkStringLiteralArgumentAttr(AL, 0, Argument)) in handleAcquireHandleAttr()
6001 D->addAttr(AcquireHandleAttr::Create(S.Context, Argument, AL)); in handleAcquireHandleAttr()
6005 static void handleHandleAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleHandleAttr() argument
6007 if (!S.checkStringLiteralArgumentAttr(AL, 0, Argument)) in handleHandleAttr()
6009 D->addAttr(Attr::Create(S.Context, Argument, AL)); in handleHandleAttr()
6013 static void handleUnsafeBufferUsage(Sema &S, Decl *D, const ParsedAttr &AL) { in handleUnsafeBufferUsage() argument
6014 D->addAttr(Attr::Create(S.Context, AL)); in handleUnsafeBufferUsage()
6017 static void handleCFGuardAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleCFGuardAttr() argument
6020 if (!AL.isArgIdent(0)) { in handleCFGuardAttr()
6021 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleCFGuardAttr()
6022 << AL << AANT_ArgumentIdentifier; in handleCFGuardAttr()
6027 IdentifierInfo *II = AL.getArgAsIdent(0)->Ident; in handleCFGuardAttr()
6029 S.Diag(AL.getLoc(), diag::warn_attribute_type_not_supported) << AL << II; in handleCFGuardAttr()
6033 D->addAttr(::new (S.Context) CFGuardAttr(S.Context, AL, Arg)); in handleCFGuardAttr()
6048 static void handleEnforceTCBAttr(Sema &S, Decl *D, const ParsedAttr &AL) { in handleEnforceTCBAttr() argument
6050 if (!S.checkStringLiteralArgumentAttr(AL, 0, Argument)) in handleEnforceTCBAttr()
6058 S.Diag(AL.getLoc(), diag::err_tcb_conflicting_attributes) in handleEnforceTCBAttr()
6059 << AL.getAttrName()->getName() << ConflictingAttr->getAttrName()->getName() in handleEnforceTCBAttr()
6069 D->addAttr(AttrTy::Create(S.Context, Argument, AL)); in handleEnforceTCBAttr()
6073 static AttrTy *mergeEnforceTCBAttrImpl(Sema &S, Decl *D, const AttrTy &AL) { in mergeEnforceTCBAttrImpl() argument
6075 StringRef TCBName = AL.getTCBName(); in mergeEnforceTCBAttrImpl()
6080 << AL.getAttrName()->getName() << TCBName; in mergeEnforceTCBAttrImpl()
6083 S.Diag(AL.getLoc(), diag::note_conflicting_attribute); in mergeEnforceTCBAttrImpl()
6091 return ::new(Context) AttrTy(Context, AL, AL.getTCBName()); in mergeEnforceTCBAttrImpl()
6094 EnforceTCBAttr *Sema::mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL) { in mergeEnforceTCBAttr() argument
6096 *this, D, AL); in mergeEnforceTCBAttr()
6100 Decl *D, const EnforceTCBLeafAttr &AL) { in mergeEnforceTCBLeafAttr() argument
6102 *this, D, AL); in mergeEnforceTCBLeafAttr()
6106 const ParsedAttr &AL) { in handleVTablePointerAuthentication() argument
6108 const uint32_t NumArgs = AL.getNumArgs(); in handleVTablePointerAuthentication()
6110 S.Diag(AL.getLoc(), diag::err_attribute_too_many_arguments) << AL << 4; in handleVTablePointerAuthentication()
6111 AL.setInvalid(); in handleVTablePointerAuthentication()
6115 S.Diag(AL.getLoc(), diag::err_attribute_too_few_arguments) << AL; in handleVTablePointerAuthentication()
6116 AL.setInvalid(); in handleVTablePointerAuthentication()
6121 S.Diag(AL.getLoc(), diag::err_duplicated_vtable_pointer_auth) << Decl; in handleVTablePointerAuthentication()
6122 AL.setInvalid(); in handleVTablePointerAuthentication()
6126 if (AL.isArgIdent(0)) { in handleVTablePointerAuthentication()
6127 IdentifierLoc *IL = AL.getArgAsIdent(0); in handleVTablePointerAuthentication()
6131 AL.setInvalid(); in handleVTablePointerAuthentication()
6135 S.Diag(AL.getLoc(), diag::err_no_default_vtable_pointer_auth) << 0; in handleVTablePointerAuthentication()
6136 AL.setInvalid(); in handleVTablePointerAuthentication()
6139 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleVTablePointerAuthentication()
6140 << AL << AANT_ArgumentIdentifier; in handleVTablePointerAuthentication()
6146 if (AL.getNumArgs() > 1) { in handleVTablePointerAuthentication()
6147 if (AL.isArgIdent(1)) { in handleVTablePointerAuthentication()
6148 IdentifierLoc *IL = AL.getArgAsIdent(1); in handleVTablePointerAuthentication()
6153 AL.setInvalid(); in handleVTablePointerAuthentication()
6159 AL.setInvalid(); in handleVTablePointerAuthentication()
6162 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleVTablePointerAuthentication()
6163 << AL << AANT_ArgumentIdentifier; in handleVTablePointerAuthentication()
6169 if (AL.getNumArgs() > 2) { in handleVTablePointerAuthentication()
6170 if (AL.isArgIdent(2)) { in handleVTablePointerAuthentication()
6171 IdentifierLoc *IL = AL.getArgAsIdent(2); in handleVTablePointerAuthentication()
6175 AL.setInvalid(); in handleVTablePointerAuthentication()
6179 S.Diag(AL.getLoc(), diag::err_no_default_vtable_pointer_auth) << 2; in handleVTablePointerAuthentication()
6180 AL.setInvalid(); in handleVTablePointerAuthentication()
6183 S.Diag(AL.getLoc(), diag::err_attribute_argument_type) in handleVTablePointerAuthentication()
6184 << AL << AANT_ArgumentIdentifier; in handleVTablePointerAuthentication()
6191 S.Diag(AL.getLoc(), diag::err_missing_custom_discrimination) << AL << 4; in handleVTablePointerAuthentication()
6192 AL.setInvalid(); in handleVTablePointerAuthentication()
6196 S.Diag(AL.getLoc(), diag::err_attribute_too_many_arguments) << AL << 4; in handleVTablePointerAuthentication()
6197 AL.setInvalid(); in handleVTablePointerAuthentication()
6200 if (!AL.isArgExpr(3) || !S.checkUInt32Argument(AL, AL.getArgAsExpr(3), in handleVTablePointerAuthentication()
6202 S.Diag(AL.getLoc(), diag::err_invalid_custom_discrimination); in handleVTablePointerAuthentication()
6203 AL.setInvalid(); in handleVTablePointerAuthentication()
6206 S.Diag(AL.getLoc(), diag::err_attribute_too_many_arguments) << AL << 3; in handleVTablePointerAuthentication()
6207 AL.setInvalid(); in handleVTablePointerAuthentication()
6211 S.Context, AL, KeyType, AddressDiversityMode, ED, in handleVTablePointerAuthentication()
6221 static bool MustDelayAttributeArguments(const ParsedAttr &AL) { in MustDelayAttributeArguments() argument
6223 if (!AL.acceptsExprPack()) in MustDelayAttributeArguments()
6226 bool AttrHasVariadicArg = AL.hasVariadicArg(); in MustDelayAttributeArguments()
6227 unsigned AttrNumArgs = AL.getNumArgMembers(); in MustDelayAttributeArguments()
6228 for (size_t I = 0; I < std::min(AL.getNumArgs(), AttrNumArgs); ++I) { in MustDelayAttributeArguments()
6234 Expr *E = AL.getArgAsExpr(I); in MustDelayAttributeArguments()
6235 bool ArgMemberCanHoldExpr = AL.isParamExpr(I); in MustDelayAttributeArguments()
6254 ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL, in ProcessDeclAttribute() argument
6256 if (AL.isInvalid() || AL.getKind() == ParsedAttr::IgnoredAttribute) in ProcessDeclAttribute()
6265 if ((S.getLangOpts().CPlusPlus ? AL.isCXX11Attribute() in ProcessDeclAttribute()
6266 : AL.isC23Attribute()) && in ProcessDeclAttribute()
6273 if (AL.getKind() == ParsedAttr::UnknownAttribute || in ProcessDeclAttribute()
6274 !AL.existsInTarget(S.Context.getTargetInfo())) { in ProcessDeclAttribute()
6275 S.Diag(AL.getLoc(), in ProcessDeclAttribute()
6276 AL.isRegularKeywordAttribute() in ProcessDeclAttribute()
6278 : AL.isDeclspecAttribute() in ProcessDeclAttribute()
6281 << AL << AL.getRange(); in ProcessDeclAttribute()
6286 bool MustDelayArgs = MustDelayAttributeArguments(AL); in ProcessDeclAttribute()
6289 if (S.checkCommonAttributeFeatures(D, AL, MustDelayArgs)) in ProcessDeclAttribute()
6293 AL.handleAttrWithDelayedArgs(S, D); in ProcessDeclAttribute()
6297 switch (AL.getKind()) { in ProcessDeclAttribute()
6299 if (AL.getInfo().handleDeclAttribute(S, D, AL) != ParsedAttrInfo::NotHandled) in ProcessDeclAttribute()
6301 if (!AL.isStmtAttr()) { in ProcessDeclAttribute()
6302 assert(AL.isTypeAttr() && "Non-type attribute not handled"); in ProcessDeclAttribute()
6304 if (AL.isTypeAttr()) { in ProcessDeclAttribute()
6307 if (!AL.isStandardAttributeSyntax() && !AL.isRegularKeywordAttribute()) { in ProcessDeclAttribute()
6322 if (AL.slidesFromDeclToDeclSpecLegacyBehavior() && in ProcessDeclAttribute()
6327 if (AL.isClangScope()) { in ProcessDeclAttribute()
6328 S.Diag(AL.getLoc(), diag::warn_type_attribute_deprecated_on_decl) in ProcessDeclAttribute()
6329 << AL << D->getLocation(); in ProcessDeclAttribute()
6337 if (AL.getKind() == ParsedAttr::AT_Regparm) { in ProcessDeclAttribute()
6350 if (AL.getKind() == ParsedAttr::AT_VectorSize) { in ProcessDeclAttribute()
6360 if (AL.getKind() == ParsedAttr::AT_NoDeref) { in ProcessDeclAttribute()
6371 S.Diag(AL.getLoc(), diag::err_attribute_invalid_on_decl) in ProcessDeclAttribute()
6372 << AL << AL.isRegularKeywordAttribute() << D->getLocation(); in ProcessDeclAttribute()
6375 handleInterruptAttr(S, D, AL); in ProcessDeclAttribute()
6378 S.X86().handleForceAlignArgPointerAttr(D, AL); in ProcessDeclAttribute()
6381 handleSimpleAttribute<ReadOnlyPlacementAttr>(S, D, AL); in ProcessDeclAttribute()
6385 handleDLLAttr(S, D, AL); in ProcessDeclAttribute()
6388 S.AMDGPU().handleAMDGPUFlatWorkGroupSizeAttr(D, AL); in ProcessDeclAttribute()
6391 S.AMDGPU().handleAMDGPUWavesPerEUAttr(D, AL); in ProcessDeclAttribute()
6394 S.AMDGPU().handleAMDGPUNumSGPRAttr(D, AL); in ProcessDeclAttribute()
6397 S.AMDGPU().handleAMDGPUNumVGPRAttr(D, AL); in ProcessDeclAttribute()
6400 S.AMDGPU().handleAMDGPUMaxNumWorkGroupsAttr(D, AL); in ProcessDeclAttribute()
6403 S.AVR().handleSignalAttr(D, AL); in ProcessDeclAttribute()
6406 S.BPF().handlePreserveAccessIndexAttr(D, AL); in ProcessDeclAttribute()
6409 handleSimpleAttribute<BPFPreserveStaticOffsetAttr>(S, D, AL); in ProcessDeclAttribute()
6412 handleBTFDeclTagAttr(S, D, AL); in ProcessDeclAttribute()
6415 S.Wasm().handleWebAssemblyExportNameAttr(D, AL); in ProcessDeclAttribute()
6418 S.Wasm().handleWebAssemblyImportModuleAttr(D, AL); in ProcessDeclAttribute()
6421 S.Wasm().handleWebAssemblyImportNameAttr(D, AL); in ProcessDeclAttribute()
6424 S.ObjC().handleIBOutlet(D, AL); in ProcessDeclAttribute()
6427 S.ObjC().handleIBOutletCollection(D, AL); in ProcessDeclAttribute()
6430 handleIFuncAttr(S, D, AL); in ProcessDeclAttribute()
6433 handleAliasAttr(S, D, AL); in ProcessDeclAttribute()
6436 handleAlignedAttr(S, D, AL); in ProcessDeclAttribute()
6439 handleAlignValueAttr(S, D, AL); in ProcessDeclAttribute()
6442 handleAllocSizeAttr(S, D, AL); in ProcessDeclAttribute()
6445 handleAlwaysInlineAttr(S, D, AL); in ProcessDeclAttribute()
6448 handleAnalyzerNoReturnAttr(S, D, AL); in ProcessDeclAttribute()
6451 handleTLSModelAttr(S, D, AL); in ProcessDeclAttribute()
6454 handleAnnotateAttr(S, D, AL); in ProcessDeclAttribute()
6457 handleAvailabilityAttr(S, D, AL); in ProcessDeclAttribute()
6460 handleDependencyAttr(S, scope, D, AL); in ProcessDeclAttribute()
6464 handleCPUSpecificAttr(S, D, AL); in ProcessDeclAttribute()
6467 handleCommonAttr(S, D, AL); in ProcessDeclAttribute()
6470 handleConstantAttr(S, D, AL); in ProcessDeclAttribute()
6473 handlePassObjectSizeAttr(S, D, AL); in ProcessDeclAttribute()
6476 handleConstructorAttr(S, D, AL); in ProcessDeclAttribute()
6479 handleDeprecatedAttr(S, D, AL); in ProcessDeclAttribute()
6482 handleDestructorAttr(S, D, AL); in ProcessDeclAttribute()
6485 handleEnableIfAttr(S, D, AL); in ProcessDeclAttribute()
6488 handleErrorAttr(S, D, AL); in ProcessDeclAttribute()
6491 handleExcludeFromExplicitInstantiationAttr(S, D, AL); in ProcessDeclAttribute()
6494 handleDiagnoseIfAttr(S, D, AL); in ProcessDeclAttribute()
6497 handleDiagnoseAsBuiltinAttr(S, D, AL); in ProcessDeclAttribute()
6500 handleNoBuiltinAttr(S, D, AL); in ProcessDeclAttribute()
6503 handleExtVectorTypeAttr(S, D, AL); in ProcessDeclAttribute()
6506 handleExternalSourceSymbolAttr(S, D, AL); in ProcessDeclAttribute()
6509 handleMinSizeAttr(S, D, AL); in ProcessDeclAttribute()
6512 handleOptimizeNoneAttr(S, D, AL); in ProcessDeclAttribute()
6515 handleEnumExtensibilityAttr(S, D, AL); in ProcessDeclAttribute()
6518 S.SYCL().handleKernelAttr(D, AL); in ProcessDeclAttribute()
6521 handleSimpleAttribute<SYCLSpecialClassAttr>(S, D, AL); in ProcessDeclAttribute()
6524 handleFormatAttr(S, D, AL); in ProcessDeclAttribute()
6527 handleFormatArgAttr(S, D, AL); in ProcessDeclAttribute()
6530 handleCallbackAttr(S, D, AL); in ProcessDeclAttribute()
6533 handleCalledOnceAttr(S, D, AL); in ProcessDeclAttribute()
6537 handleGlobalAttr(S, D, AL); in ProcessDeclAttribute()
6540 handleDeviceAttr(S, D, AL); in ProcessDeclAttribute()
6543 handleManagedAttr(S, D, AL); in ProcessDeclAttribute()
6546 handleGNUInlineAttr(S, D, AL); in ProcessDeclAttribute()
6549 handleLaunchBoundsAttr(S, D, AL); in ProcessDeclAttribute()
6552 handleRestrictAttr(S, D, AL); in ProcessDeclAttribute()
6555 handleModeAttr(S, D, AL); in ProcessDeclAttribute()
6559 handleNonNullAttrParameter(S, PVD, AL); in ProcessDeclAttribute()
6561 handleNonNullAttr(S, D, AL); in ProcessDeclAttribute()
6564 handleReturnsNonNullAttr(S, D, AL); in ProcessDeclAttribute()
6567 handleNoEscapeAttr(S, D, AL); in ProcessDeclAttribute()
6570 handleSimpleAttribute<MaybeUndefAttr>(S, D, AL); in ProcessDeclAttribute()
6573 handleAssumeAlignedAttr(S, D, AL); in ProcessDeclAttribute()
6576 handleAllocAlignAttr(S, D, AL); in ProcessDeclAttribute()
6579 handleOwnershipAttr(S, D, AL); in ProcessDeclAttribute()
6582 handleNakedAttr(S, D, AL); in ProcessDeclAttribute()
6585 handleNoReturnAttr(S, D, AL); in ProcessDeclAttribute()
6588 handleStandardNoReturnAttr(S, D, AL); in ProcessDeclAttribute()
6591 handleNoCfCheckAttr(S, D, AL); in ProcessDeclAttribute()
6594 if (!AL.isUsedAsTypeAttr()) in ProcessDeclAttribute()
6595 handleSimpleAttribute<NoThrowAttr>(S, D, AL); in ProcessDeclAttribute()
6598 handleSharedAttr(S, D, AL); in ProcessDeclAttribute()
6601 handleVecReturnAttr(S, D, AL); in ProcessDeclAttribute()
6604 S.ObjC().handleOwnershipAttr(D, AL); in ProcessDeclAttribute()
6607 S.ObjC().handlePreciseLifetimeAttr(D, AL); in ProcessDeclAttribute()
6610 S.ObjC().handleReturnsInnerPointerAttr(D, AL); in ProcessDeclAttribute()
6613 S.ObjC().handleRequiresSuperAttr(D, AL); in ProcessDeclAttribute()
6616 S.ObjC().handleBridgeAttr(D, AL); in ProcessDeclAttribute()
6619 S.ObjC().handleBridgeMutableAttr(D, AL); in ProcessDeclAttribute()
6622 S.ObjC().handleBridgeRelatedAttr(D, AL); in ProcessDeclAttribute()
6625 S.ObjC().handleDesignatedInitializer(D, AL); in ProcessDeclAttribute()
6628 S.ObjC().handleRuntimeName(D, AL); in ProcessDeclAttribute()
6631 S.ObjC().handleBoxable(D, AL); in ProcessDeclAttribute()
6634 S.ObjC().handleNSErrorDomain(D, AL); in ProcessDeclAttribute()
6639 S.ObjC().AddXConsumedAttr(D, AL, in ProcessDeclAttribute()
6640 S.ObjC().parsedAttrToRetainOwnershipKind(AL), in ProcessDeclAttribute()
6645 S, D, AL, S.ObjC().isValidOSObjectOutParameter(D), in ProcessDeclAttribute()
6647 /*Extra Args=*/AL, /*pointer-to-OSObject-pointer*/ 3, AL.getRange()); in ProcessDeclAttribute()
6651 S, D, AL, S.ObjC().isValidOSObjectOutParameter(D), in ProcessDeclAttribute()
6653 /*Extra Args=*/AL, /*pointer-to-OSObject-poointer*/ 3, AL.getRange()); in ProcessDeclAttribute()
6662 S.ObjC().handleXReturnsXRetainedAttr(D, AL); in ProcessDeclAttribute()
6665 handleWorkGroupSize<WorkGroupSizeHintAttr>(S, D, AL); in ProcessDeclAttribute()
6668 handleWorkGroupSize<ReqdWorkGroupSizeAttr>(S, D, AL); in ProcessDeclAttribute()
6671 S.OpenCL().handleSubGroupSize(D, AL); in ProcessDeclAttribute()
6674 handleVecTypeHint(S, D, AL); in ProcessDeclAttribute()
6677 handleInitPriorityAttr(S, D, AL); in ProcessDeclAttribute()
6680 handlePackedAttr(S, D, AL); in ProcessDeclAttribute()
6683 handlePreferredName(S, D, AL); in ProcessDeclAttribute()
6686 handleSectionAttr(S, D, AL); in ProcessDeclAttribute()
6689 handleCodeModelAttr(S, D, AL); in ProcessDeclAttribute()
6692 handleRandomizeLayoutAttr(S, D, AL); in ProcessDeclAttribute()
6695 handleNoRandomizeLayoutAttr(S, D, AL); in ProcessDeclAttribute()
6698 handleCodeSegAttr(S, D, AL); in ProcessDeclAttribute()
6701 handleTargetAttr(S, D, AL); in ProcessDeclAttribute()
6704 handleTargetVersionAttr(S, D, AL); in ProcessDeclAttribute()
6707 handleTargetClonesAttr(S, D, AL); in ProcessDeclAttribute()
6710 handleMinVectorWidthAttr(S, D, AL); in ProcessDeclAttribute()
6713 handleAttrWithMessage<UnavailableAttr>(S, D, AL); in ProcessDeclAttribute()
6716 S.OpenMP().handleOMPAssumeAttr(D, AL); in ProcessDeclAttribute()
6719 S.ObjC().handleDirectAttr(D, AL); in ProcessDeclAttribute()
6722 S.ObjC().handleDirectMembersAttr(D, AL); in ProcessDeclAttribute()
6723 handleSimpleAttribute<ObjCDirectMembersAttr>(S, D, AL); in ProcessDeclAttribute()
6726 S.ObjC().handleSuppresProtocolAttr(D, AL); in ProcessDeclAttribute()
6729 handleUnusedAttr(S, D, AL); in ProcessDeclAttribute()
6732 handleVisibilityAttr(S, D, AL, false); in ProcessDeclAttribute()
6735 handleVisibilityAttr(S, D, AL, true); in ProcessDeclAttribute()
6738 handleWarnUnusedResult(S, D, AL); in ProcessDeclAttribute()
6741 handleWeakRefAttr(S, D, AL); in ProcessDeclAttribute()
6744 handleWeakImportAttr(S, D, AL); in ProcessDeclAttribute()
6747 handleTransparentUnionAttr(S, D, AL); in ProcessDeclAttribute()
6750 S.ObjC().handleMethodFamilyAttr(D, AL); in ProcessDeclAttribute()
6753 S.ObjC().handleNSObject(D, AL); in ProcessDeclAttribute()
6756 S.ObjC().handleIndependentClass(D, AL); in ProcessDeclAttribute()
6759 S.ObjC().handleBlocksAttr(D, AL); in ProcessDeclAttribute()
6762 handleSentinelAttr(S, D, AL); in ProcessDeclAttribute()
6765 handleCleanupAttr(S, D, AL); in ProcessDeclAttribute()
6768 handleNoDebugAttr(S, D, AL); in ProcessDeclAttribute()
6771 S.ARM().handleCmseNSEntryAttr(D, AL); in ProcessDeclAttribute()
6794 handleCallConvAttr(S, D, AL); in ProcessDeclAttribute()
6797 handleSuppressAttr(S, D, AL); in ProcessDeclAttribute()
6801 handleLifetimeCategoryAttr(S, D, AL); in ProcessDeclAttribute()
6804 S.OpenCL().handleAccessAttr(D, AL); in ProcessDeclAttribute()
6807 S.OpenCL().handleNoSVMAttr(D, AL); in ProcessDeclAttribute()
6810 S.Swift().AddParameterABIAttr(D, AL, ParameterABI::SwiftContext); in ProcessDeclAttribute()
6813 S.Swift().AddParameterABIAttr(D, AL, ParameterABI::SwiftAsyncContext); in ProcessDeclAttribute()
6816 S.Swift().AddParameterABIAttr(D, AL, ParameterABI::SwiftErrorResult); in ProcessDeclAttribute()
6819 S.Swift().AddParameterABIAttr(D, AL, ParameterABI::SwiftIndirectResult); in ProcessDeclAttribute()
6822 handleInternalLinkageAttr(S, D, AL); in ProcessDeclAttribute()
6825 handleZeroCallUsedRegsAttr(S, D, AL); in ProcessDeclAttribute()
6828 handleFunctionReturnThunksAttr(S, D, AL); in ProcessDeclAttribute()
6831 handleNoMergeAttr(S, D, AL); in ProcessDeclAttribute()
6834 handleNoUniqueAddressAttr(S, D, AL); in ProcessDeclAttribute()
6838 handleAvailableOnlyInDefaultEvalMethod(S, D, AL); in ProcessDeclAttribute()
6845 handleCountedByAttrField(S, D, AL); in ProcessDeclAttribute()
6850 handleLayoutVersion(S, D, AL); in ProcessDeclAttribute()
6853 handleUuidAttr(S, D, AL); in ProcessDeclAttribute()
6856 handleMSInheritanceAttr(S, D, AL); in ProcessDeclAttribute()
6859 handleDeclspecThreadAttr(S, D, AL); in ProcessDeclAttribute()
6862 handleMSConstexprAttr(S, D, AL); in ProcessDeclAttribute()
6865 handleSimpleAttribute<HybridPatchableAttr>(S, D, AL); in ProcessDeclAttribute()
6870 S.HLSL().handleNumThreadsAttr(D, AL); in ProcessDeclAttribute()
6873 handleSimpleAttribute<HLSLSV_GroupIndexAttr>(S, D, AL); in ProcessDeclAttribute()
6876 S.HLSL().handleSV_DispatchThreadIDAttr(D, AL); in ProcessDeclAttribute()
6879 S.HLSL().handlePackOffsetAttr(D, AL); in ProcessDeclAttribute()
6882 S.HLSL().handleShaderAttr(D, AL); in ProcessDeclAttribute()
6885 S.HLSL().handleResourceBindingAttr(D, AL); in ProcessDeclAttribute()
6888 S.HLSL().handleResourceClassAttr(D, AL); in ProcessDeclAttribute()
6891 S.HLSL().handleParamModifierAttr(D, AL); in ProcessDeclAttribute()
6895 handleAbiTagAttr(S, D, AL); in ProcessDeclAttribute()
6898 handleCFGuardAttr(S, D, AL); in ProcessDeclAttribute()
6903 handleAssertExclusiveLockAttr(S, D, AL); in ProcessDeclAttribute()
6906 handleAssertSharedLockAttr(S, D, AL); in ProcessDeclAttribute()
6909 handlePtGuardedVarAttr(S, D, AL); in ProcessDeclAttribute()
6912 handleNoSanitizeAttr(S, D, AL); in ProcessDeclAttribute()
6915 handleNoSanitizeSpecificAttr(S, D, AL); in ProcessDeclAttribute()
6918 handleGuardedByAttr(S, D, AL); in ProcessDeclAttribute()
6921 handlePtGuardedByAttr(S, D, AL); in ProcessDeclAttribute()
6924 handleExclusiveTrylockFunctionAttr(S, D, AL); in ProcessDeclAttribute()
6927 handleLockReturnedAttr(S, D, AL); in ProcessDeclAttribute()
6930 handleLocksExcludedAttr(S, D, AL); in ProcessDeclAttribute()
6933 handleSharedTrylockFunctionAttr(S, D, AL); in ProcessDeclAttribute()
6936 handleAcquiredBeforeAttr(S, D, AL); in ProcessDeclAttribute()
6939 handleAcquiredAfterAttr(S, D, AL); in ProcessDeclAttribute()
6945 handleCapabilityAttr(S, D, AL); in ProcessDeclAttribute()
6948 handleRequiresCapabilityAttr(S, D, AL); in ProcessDeclAttribute()
6952 handleAssertCapabilityAttr(S, D, AL); in ProcessDeclAttribute()
6955 handleAcquireCapabilityAttr(S, D, AL); in ProcessDeclAttribute()
6958 handleReleaseCapabilityAttr(S, D, AL); in ProcessDeclAttribute()
6961 handleTryAcquireCapabilityAttr(S, D, AL); in ProcessDeclAttribute()
6966 handleConsumableAttr(S, D, AL); in ProcessDeclAttribute()
6969 handleCallableWhenAttr(S, D, AL); in ProcessDeclAttribute()
6972 handleParamTypestateAttr(S, D, AL); in ProcessDeclAttribute()
6975 handleReturnTypestateAttr(S, D, AL); in ProcessDeclAttribute()
6978 handleSetTypestateAttr(S, D, AL); in ProcessDeclAttribute()
6981 handleTestTypestateAttr(S, D, AL); in ProcessDeclAttribute()
6986 handleArgumentWithTypeTagAttr(S, D, AL); in ProcessDeclAttribute()
6989 handleTypeTagForDatatypeAttr(S, D, AL); in ProcessDeclAttribute()
6994 S.Swift().handleAsyncName(D, AL); in ProcessDeclAttribute()
6997 S.Swift().handleAttrAttr(D, AL); in ProcessDeclAttribute()
7000 S.Swift().handleBridge(D, AL); in ProcessDeclAttribute()
7003 S.Swift().handleError(D, AL); in ProcessDeclAttribute()
7006 S.Swift().handleName(D, AL); in ProcessDeclAttribute()
7009 S.Swift().handleNewType(D, AL); in ProcessDeclAttribute()
7012 S.Swift().handleAsyncAttr(D, AL); in ProcessDeclAttribute()
7015 S.Swift().handleAsyncError(D, AL); in ProcessDeclAttribute()
7020 handleXRayLogArgsAttr(S, D, AL); in ProcessDeclAttribute()
7024 handlePatchableFunctionEntryAttr(S, D, AL); in ProcessDeclAttribute()
7029 handleDestroyAttr(S, D, AL); in ProcessDeclAttribute()
7033 handleUninitializedAttr(S, D, AL); in ProcessDeclAttribute()
7037 S.ObjC().handleExternallyRetainedAttr(D, AL); in ProcessDeclAttribute()
7041 handleMIGServerRoutineAttr(S, D, AL); in ProcessDeclAttribute()
7045 handleMSAllocatorAttr(S, D, AL); in ProcessDeclAttribute()
7049 S.ARM().handleBuiltinAliasAttr(D, AL); in ProcessDeclAttribute()
7053 handleSimpleAttribute<ArmLocallyStreamingAttr>(S, D, AL); in ProcessDeclAttribute()
7057 S.ARM().handleNewAttr(D, AL); in ProcessDeclAttribute()
7061 handleAcquireHandleAttr(S, D, AL); in ProcessDeclAttribute()
7065 handleHandleAttr<ReleaseHandleAttr>(S, D, AL); in ProcessDeclAttribute()
7069 handleUnsafeBufferUsage<UnsafeBufferUsageAttr>(S, D, AL); in ProcessDeclAttribute()
7073 handleHandleAttr<UseHandleAttr>(S, D, AL); in ProcessDeclAttribute()
7077 handleEnforceTCBAttr<EnforceTCBAttr, EnforceTCBLeafAttr>(S, D, AL); in ProcessDeclAttribute()
7081 handleEnforceTCBAttr<EnforceTCBLeafAttr, EnforceTCBAttr>(S, D, AL); in ProcessDeclAttribute()
7085 handleBuiltinAliasAttr(S, D, AL); in ProcessDeclAttribute()
7089 handlePreferredTypeAttr(S, D, AL); in ProcessDeclAttribute()
7093 handleSimpleAttribute<UsingIfExistsAttr>(S, D, AL); in ProcessDeclAttribute()
7097 handleNullableTypeAttr(S, D, AL); in ProcessDeclAttribute()
7101 handleVTablePointerAuthentication(S, D, AL); in ProcessDeclAttribute()
7112 for (const ParsedAttr &AL : AttrList) in ProcessDeclAttributeList() local
7113 ProcessDeclAttribute(*this, S, D, AL, Options); in ProcessDeclAttributeList()
7181 for (const ParsedAttr &AL : AttrList) in ProcessDeclAttributeDelayed() local
7182 if (AL.getKind() == ParsedAttr::AT_TransparentUnion) { in ProcessDeclAttributeDelayed()
7183 handleTransparentUnionAttr(*this, D, AL); in ProcessDeclAttributeDelayed()
7195 for (const ParsedAttr &AL : AttrList) { in ProcessAccessDeclAttributeList() local
7196 if (AL.getKind() == ParsedAttr::AT_Annotate) { in ProcessAccessDeclAttributeList()
7197 ProcessDeclAttribute(*this, nullptr, ASDecl, AL, in ProcessAccessDeclAttributeList()
7200 Diag(AL.getLoc(), diag::err_only_annotate_after_access_spec); in ProcessAccessDeclAttributeList()
7210 for (const ParsedAttr &AL : A) { in checkUnusedDeclAttributes() local
7212 if (AL.isUsedAsTypeAttr() || AL.isInvalid()) in checkUnusedDeclAttributes()
7214 if (AL.getKind() == ParsedAttr::IgnoredAttribute) in checkUnusedDeclAttributes()
7217 if (AL.getKind() == ParsedAttr::UnknownAttribute) { in checkUnusedDeclAttributes()
7218 S.Diag(AL.getLoc(), diag::warn_unknown_attribute_ignored) in checkUnusedDeclAttributes()
7219 << AL << AL.getRange(); in checkUnusedDeclAttributes()
7221 S.Diag(AL.getLoc(), diag::warn_attribute_not_on_decl) << AL in checkUnusedDeclAttributes()
7222 << AL.getRange(); in checkUnusedDeclAttributes()
7338 for (ParsedAttr &AL : Src) { in ProcessDeclAttributes()
7342 if ((AL.isStandardAttributeSyntax() || AL.isAlignas()) && in ProcessDeclAttributes()
7343 AL.slidesFromDeclToDeclSpecLegacyBehavior()) { in ProcessDeclAttributes()
7348 AL.diagnoseAppertainsTo(*this, D); in ProcessDeclAttributes()
7350 NonSlidingAttrs.addAtEnd(&AL); in ProcessDeclAttributes()