Home | History | Annotate | Download | only in Sema

Lines Matching full:attr

210 static bool checkAttributeNumArgs(Sema &S, const AttributeList &Attr,
212 if (Attr.getNumArgs() != Num) {
213 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
214 << Attr.getName() << Num;
224 static bool checkAttributeAtLeastNumArgs(Sema &S, const AttributeList &Attr,
226 if (Attr.getNumArgs() < Num) {
227 S.Diag(Attr.getLoc(), diag::err_attribute_too_few_arguments) << Num;
324 const AttributeList &Attr) {
341 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_decl_not_pointer)
342 << Attr.getName()->getName() << QT;
344 S.Diag(Attr.getLoc(), diag::err_attribute_can_be_applied_only_to_value_decl)
345 << Attr.getName();
375 static void checkForLockableRecord(Sema &S, Decl *D, const AttributeList &Attr,
381 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_argument_not_class)
382 << Attr.getName() << Ty.getAsString();
407 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_argument_not_lockable)
408 << Attr.getName() << Ty.getAsString();
417 const AttributeList &Attr,
421 for(unsigned Idx = Sidx; Idx < Attr.getNumArgs(); ++Idx) {
422 Expr *ArgExp = Attr.getArg(Idx);
441 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_ignored) <<
442 Attr.getName();
470 Attr.getLoc(), diag::err_attribute_argument_out_of_range)
471 << Attr.getName() << Idx + 1 << NumParams;
478 checkForLockableRecord(S, D, Attr, ArgTy);
499 const AttributeList &Attr) {
500 assert(!Attr.isInvalid());
502 if (!checkAttributeNumArgs(S, Attr, 0))
507 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
508 << Attr.getName() << ThreadExpectedFieldOrGlobalVar;
515 static void handleGuardedVarAttr(Sema &S, Decl *D, const AttributeList &Attr) {
516 if (!checkGuardedVarAttrCommon(S, D, Attr))
520 GuardedVarAttr(Attr.getRange(), S.Context,
521 Attr.getAttributeSpellingListIndex()));
525 const AttributeList &Attr) {
526 if (!checkGuardedVarAttrCommon(S, D, Attr))
529 if (!threadSafetyCheckIsPointer(S, D, Attr))
533 PtGuardedVarAttr(Attr.getRange(), S.Context,
534 Attr.getAttributeSpellingListIndex()));
538 const AttributeList &Attr,
540 assert(!Attr.isInvalid());
542 if (!checkAttributeNumArgs(S, Attr, 1))
547 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
548 << Attr.getName() << ThreadExpectedFieldOrGlobalVar;
554 checkAttrArgsAreLockableObjs(S, D, Attr, Args);
564 static void handleGuardedByAttr(Sema &S, Decl *D, const AttributeList &Attr) {
566 if (!checkGuardedByAttrCommon(S, D, Attr, Arg))
569 D->addAttr(::new (S.Context) GuardedByAttr(Attr.getRange(), S.Context, Arg));
573 const AttributeList &Attr) {
575 if (!checkGuardedByAttrCommon(S, D, Attr, Arg))
578 if (!threadSafetyCheckIsPointer(S, D, Attr))
581 D->addAttr(::new (S.Context) PtGuardedByAttr(Attr.getRange(),
586 const AttributeList &Attr) {
587 assert(!Attr.isInvalid());
589 if (!checkAttributeNumArgs(S, Attr, 0))
594 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
595 << Attr.getName() << ThreadExpectedClassOrStruct;
602 static void handleLockableAttr(Sema &S, Decl *D, const AttributeList &Attr) {
603 if (!checkLockableAttrCommon(S, D, Attr))
606 D->addAttr(::new (S.Context) LockableAttr(Attr.getRange(), S.Context));
610 const AttributeList &Attr) {
611 if (!checkLockableAttrCommon(S, D, Attr))
615 ScopedLockableAttr(Attr.getRange(), S.Context,
616 Attr.getAttributeSpellingListIndex()));
620 const AttributeList &Attr) {
621 assert(!Attr.isInvalid());
623 if (!checkAttributeNumArgs(S, Attr, 0))
627 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
628 << Attr.getName() << ThreadExpectedFunctionOrMethod;
632 D->addAttr(::new (S.Context) NoThreadSafetyAnalysisAttr(Attr.getRange(),
637 const AttributeList &Attr) {
638 assert(!Attr.isInvalid());
640 if (!checkAttributeNumArgs(S, Attr, 0))
644 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
645 << Attr.getName() << ExpectedFunctionOrMethod;
650 NoSanitizeAddressAttr(Attr.getRange(), S.Context,
651 Attr.getAttributeSpellingListIndex()));
655 const AttributeList &Attr) {
656 assert(!Attr.isInvalid());
658 if (!checkAttributeNumArgs(S, Attr, 0))
662 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
663 << Attr.getName() << ExpectedFunctionOrMethod;
667 D->addAttr(::new (S.Context) NoSanitizeMemoryAttr(Attr.getRange(),
672 const AttributeList &Attr) {
673 assert(!Attr.isInvalid());
675 if (!checkAttributeNumArgs(S, Attr, 0))
679 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
680 << Attr.getName() << ExpectedFunctionOrMethod;
684 D->addAttr(::new (S.Context) NoSanitizeThreadAttr(Attr.getRange(),
689 const AttributeList &Attr,
691 assert(!Attr.isInvalid());
693 if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
699 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
700 << Attr.getName() << ThreadExpectedFieldOrGlobalVar;
709 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_decl_not_lockable)
710 << Attr.getName();
716 checkAttrArgsAreLockableObjs(S, D, Attr, Args);
724 const AttributeList &Attr) {
726 if (!checkAcquireOrderAttrCommon(S, D, Attr, Args))
731 AcquiredAfterAttr(Attr.getRange(), S.Context,
733 Attr.getAttributeSpellingListIndex()));
737 const AttributeList &Attr) {
739 if (!checkAcquireOrderAttrCommon(S, D, Attr, Args))
744 AcquiredBeforeAttr(Attr.getRange(), S.Context,
746 Attr.getAttributeSpellingListIndex()));
750 const AttributeList &Attr,
752 assert(!Attr.isInvalid());
758 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
759 << Attr.getName() << ThreadExpectedFunctionOrMethod;
764 checkAttrArgsAreLockableObjs(S, D, Attr, Args, 0, /*ParamIdxOk=*/true);
770 const AttributeList &Attr) {
772 if (!checkLockFunAttrCommon(S, D, Attr, Args))
778 SharedLockFunctionAttr(Attr.getRange(), S.Context, StartArg, Size,
779 Attr.getAttributeSpellingListIndex()));
783 const AttributeList &Attr) {
785 if (!checkLockFunAttrCommon(S, D, Attr, Args))
791 ExclusiveLockFunctionAttr(Attr.getRange(), S.Context,
793 Attr.getAttributeSpellingListIndex()));
797 const AttributeList &Attr) {
799 if (!checkLockFunAttrCommon(S, D, Attr, Args))
805 AssertSharedLockAttr(Attr.getRange(), S.Context, StartArg, Size,
806 Attr.getAttributeSpellingListIndex()));
810 const AttributeList &Attr) {
812 if (!checkLockFunAttrCommon(S, D, Attr, Args))
818 AssertExclusiveLockAttr(Attr.getRange(), S.Context,
820 Attr.getAttributeSpellingListIndex()));
825 const AttributeList &Attr,
827 assert(!Attr.isInvalid());
829 if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
833 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
834 << Attr.getName() << ThreadExpectedFunctionOrMethod;
838 if (!isIntOrBool(Attr.getArg(0))) {
839 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
840 << Attr.getName() << 1 << AANT_ArgumentIntOrBool;
845 checkAttrArgsAreLockableObjs(S, D, Attr, Args, 1);
851 const AttributeList &Attr) {
853 if (!checkTryLockFunAttrCommon(S, D, Attr, Args))
859 SharedTrylockFunctionAttr(Attr.getRange(), S.Context,
860 Attr.getArg(0), StartArg, Size,
861 Attr.getAttributeSpellingListIndex()));
865 const AttributeList &Attr) {
867 if (!checkTryLockFunAttrCommon(S, D, Attr, Args))
873 ExclusiveTrylockFunctionAttr(Attr.getRange(), S.Context,
874 Attr.getArg(0), StartArg, Size,
875 Attr.getAttributeSpellingListIndex()));
879 const AttributeList &Attr,
881 assert(!Attr.isInvalid());
883 if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
887 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
888 << Attr.getName() << ThreadExpectedFunctionOrMethod;
893 checkAttrArgsAreLockableObjs(S, D, Attr, Args);
901 const AttributeList &Attr) {
903 if (!checkLocksRequiredCommon(S, D, Attr, Args))
908 ExclusiveLocksRequiredAttr(Attr.getRange(), S.Context,
910 Attr.getAttributeSpellingListIndex()));
914 const AttributeList &Attr) {
916 if (!checkLocksRequiredCommon(S, D, Attr, Args))
921 SharedLocksRequiredAttr(Attr.getRange(), S.Context,
923 Attr.getAttributeSpellingListIndex()));
927 const AttributeList &Attr) {
928 assert(!Attr.isInvalid());
933 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
934 << Attr.getName() << ThreadExpectedFunctionOrMethod;
940 checkAttrArgsAreLockableObjs(S, D, Attr, Args, 0, /*ParamIdxOk=*/true);
945 UnlockFunctionAttr(Attr.getRange(), S.Context, StartArg, Size,
946 Attr.getAttributeSpellingListIndex()));
950 const AttributeList &Attr) {
951 assert(!Attr.isInvalid());
953 if (!checkAttributeNumArgs(S, Attr, 1))
957 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
958 << Attr.getName() << ThreadExpectedFunctionOrMethod;
964 checkAttrArgsAreLockableObjs(S, D, Attr, Args);
970 LockReturnedAttr(Attr.getRange(), S.Context, Args[0],
971 Attr.getAttributeSpellingListIndex()));
975 const AttributeList &Attr) {
976 assert(!Attr.isInvalid());
978 if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
982 S.Diag(Attr.getLoc(), diag::warn_thread_attribute_wrong_decl_type)
983 << Attr.getName() << ThreadExpectedFunctionOrMethod;
989 checkAttrArgsAreLockableObjs(S, D, Attr, Args);
996 LocksExcludedAttr(Attr.getRange(), S.Context, StartArg, Size,
997 Attr.getAttributeSpellingListIndex()));
1002 const AttributeList &Attr) {
1007 S.Diag(Attr.getLoc(), diag::err_typecheck_ext_vector_not_typedef);
1015 static void handlePackedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1017 if (!checkAttributeNumArgs(S, Attr, 0))
1021 TD->addAttr(::new (S.Context) PackedAttr(Attr.getRange(), S.Context));
1028 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored_for_field_of_type)
1029 << Attr.getName() << FD->getType();
1032 PackedAttr(Attr.getRange(), S.Context,
1033 Attr.getAttributeSpellingListIndex()));
1035 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
1038 static void handleMsStructAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1041 MsStructAttr(Attr.getRange(), S.Context,
1042 Attr.getAttributeSpellingListIndex()));
1044 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
1047 static void handleIBAction(Sema &S, Decl *D, const AttributeList &Attr) {
1049 if (!checkAttributeNumArgs(S, Attr, 0))
1056 IBActionAttr(Attr.getRange(), S.Context,
1057 Attr.getAttributeSpellingListIndex()));
1061 S.Diag(Attr.getLoc(), diag::warn_attribute_ibaction) << Attr.getName();
1064 static bool checkIBOutletCommon(Sema &S, Decl *D, const AttributeList &Attr) {
1070 S.Diag(Attr.getLoc(), diag::warn_iboutlet_object_type)
1071 << Attr.getName() << VD->getType() << 0;
1077 S.Diag(Attr.getLoc(), diag::warn_iboutlet_object_type)
1078 << Attr.getName() << PD->getType() << 1;
1083 S.Diag(Attr.getLoc(), diag::warn_attribute_iboutlet) << Attr.getName();
1090 static void handleIBOutlet(Sema &S, Decl *D, const AttributeList &Attr) {
1092 if (!checkAttributeNumArgs(S, Attr, 0))
1095 if (!checkIBOutletCommon(S, D, Attr))
1099 IBOutletAttr(Attr.getRange(), S.Context,
1100 Attr.getAttributeSpellingListIndex()));
1104 const AttributeList &Attr) {
1107 if (Attr.getParameterName() && Attr.getNumArgs() > 0) {
1108 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
1109 << Attr.getName() << 1;
1113 if (!checkIBOutletCommon(S, D, Attr))
1116 IdentifierInfo *II = Attr.getParameterName();
1120 ParsedType TypeRep = S.getTypeName(*II, Attr.getLoc(),
1123 S.Diag(Attr.getLoc(), diag::err_iboutletcollection_type) << II;
1132 S.Diag(Attr.getLoc(), diag::err_iboutletcollection_type) << II;
1136 IBOutletCollectionAttr(Attr.getRange(),S.Context,
1137 QT, Attr.getParameterLoc(),
1138 Attr.getAttributeSpellingListIndex()));
1156 static void handleAllocSizeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1158 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1159 << Attr.getName() << ExpectedFunctionOrMethod;
1163 if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
1167 for (unsigned i = 0; i < Attr.getNumArgs(); ++i) {
1168 Expr *Ex = Attr.getArg(i);
1170 if (!checkFunctionOrMethodArgumentIndex(S, D, Attr.getName()->getName(),
1171 Attr.getLoc(), i + 1, Ex, Idx))
1177 S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
1178 << Attr.getName() << AANT_ArgumentIntegerConstant
1187 S.Diag(Attr.getLoc(), diag::warn_ns_attribute_wrong_return_type)
1188 << Attr.getName() << 0 /*function*/<< 1 /*pointer*/ << D->getSourceRange();
1192 AllocSizeAttr(Attr.getRange(), S.Context,
1194 Attr.getAttributeSpellingListIndex()));
1197 static void handleNonNullAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1201 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1202 << Attr.getName() << ExpectedFunction;
1207 for (unsigned i = 0; i < Attr.getNumArgs(); ++i) {
1208 Expr *Ex = Attr.getArg(i);
1210 if (!checkFunctionOrMethodArgumentIndex(S, D, Attr.getName()->getName(),
1211 Attr.getLoc(), i + 1, Ex, Idx))
1220 S.Diag(Attr.getLoc(), diag::warn_nonnull_pointers_only)
1242 if (Attr.getLoc().isFileID())
1243 S.Diag(Attr.getLoc(), diag::warn_attribute_nonnull_no_pointers);
1252 NonNullAttr(Attr.getRange(), S.Context, start, size,
1253 Attr.getAttributeSpellingListIndex()));
1389 static void handleWeakRefAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1391 if (Attr.getNumArgs() > 1) {
1392 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
1393 << Attr.getName() << 1;
1398 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
1399 << Attr.getName() << ExpectedVariableOrFunction;
1417 S.Diag(Attr.getLoc(), diag::err_attribute_weakref_not_global_context) <<
1444 if (Attr.getNumArgs() == 1) {
1445 Expr *Arg = Attr.getArg(0);
1450 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
1451 << Attr.getName() << 1 << AANT_ArgumentString;
1456 D->addAttr(::new (S.Context) AliasAttr(Attr.getRange(), S.Context,
1461 WeakRefAttr(Attr.getRange(), S.Context,
1462 Attr.getAttributeSpellingListIndex()));
1465 static void handleAliasAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1467 if (!checkAttributeNumArgs(S, Attr, 1))
1470 Expr *Arg = Attr.getArg(0);
1475 S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
1476 << Attr.getName() << AANT_ArgumentString;
1481 S.Diag(Attr.getLoc(), diag::err_alias_not_supported_on_darwin);
1487 D->addAttr(::new (S.Context) AliasAttr(Attr.getRange(), S.Context,
1489 Attr.getAttributeSpellingListIndex()));
1492 static void handleMinSizeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1494 if (!checkAttributeNumArgs(S, Attr, 0))
1498 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
1499 << Attr.getName() << ExpectedFunctionOrMethod;
1504 MinSizeAttr(Attr.getRange(), S.Context,
1505 Attr.getAttributeSpellingListIndex()));
1508 static void handleColdAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1510 if (!checkAttributeNumArgs(S, Attr, 0))
1514 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1515 << Attr.getName() << ExpectedFunction;
1520 S.Diag(Attr.getLoc(), diag::err_attributes_are_not_compatible)
1521 << Attr.getName() << "hot";
1525 D->addAttr(::new (S.Context) ColdAttr(Attr.getRange(), S.Context,
1526 Attr.getAttributeSpellingListIndex()));
1529 static void handleHotAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1531 if (!checkAttributeNumArgs(S, Attr, 0))
1535 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1536 << Attr.getName() << ExpectedFunction;
1541 S.Diag(Attr.getLoc(), diag::err_attributes_are_not_compatible)
1542 << Attr.getName() << "cold";
1546 D->addAttr(::new (S.Context) HotAttr(Attr.getRange(), S.Context,
1547 Attr.getAttributeSpellingListIndex()));
1550 static void handleNakedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1552 if (!checkAttributeNumArgs(S, Attr, 0))
1556 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1557 << Attr.getName() << ExpectedFunction;
1562 NakedAttr(Attr.getRange(), S.Context,
1563 Attr.getAttributeSpellingListIndex()));
1567 const AttributeList &Attr) {
1569 if (Attr.hasParameterOrArguments()) {
1570 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
1571 << Attr.getName() << 0;
1576 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1577 << Attr.getName() << ExpectedFunction;
1582 AlwaysInlineAttr(Attr.getRange(), S.Context,
1583 Attr.getAttributeSpellingListIndex()));
1587 const AttributeList &Attr) {
1589 if (!checkAttributeNumArgs(S, Attr, 1))
1592 Expr *Arg = Attr.getArg(0);
1598 S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
1599 << Attr.getName() << AANT_ArgumentString;
1604 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
1605 << Attr.getName() << ExpectedTLSVar;
1613 S.Diag(Attr.getLoc(), diag::err_attr_tlsmodel_arg);
1618 TLSModelAttr(Attr.getRange(), S.Context, Model,
1619 Attr.getAttributeSpellingListIndex()));
1622 static void handleMallocAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1624 if (Attr.hasParameterOrArguments()) {
1625 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
1626 << Attr.getName() << 0;
1634 MallocAttr(Attr.getRange(), S.Context,
1635 Attr.getAttributeSpellingListIndex()));
1640 S.Diag(Attr.getLoc(), diag::warn_attribute_malloc_pointer_only);
1643 static void handleMayAliasAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1645 if (!checkAttributeNumArgs(S, Attr, 0))
1649 MayAliasAttr(Attr.getRange(), S.Context,
1650 Attr.getAttributeSpellingListIndex()));
1653 static void handleNoCommonAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1654 assert(!Attr.isInvalid());
1657 NoCommonAttr(Attr.getRange(), S.Context,
1658 Attr.getAttributeSpellingListIndex()));
1660 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1661 << Attr.getName() << ExpectedVariable;
1664 static void handleCommonAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1665 assert(!Attr.isInvalid());
1668 S.Diag(Attr.getLoc(), diag::err_common_not_supported_cplusplus);
1674 CommonAttr(Attr.getRange(), S.Context,
1675 Attr.getAttributeSpellingListIndex()));
1677 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1678 << Attr.getName() << ExpectedVariable;
1681 static void handleNoReturnAttr(Sema &S, Decl *D, const AttributeList &attr) {
1684 if (S.CheckNoReturnAttr(attr)) return;
1687 S.Diag(attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1688 << attr.getName() << ExpectedFunctionOrMethod;
1693 NoReturnAttr(attr.getRange(), S.Context,
1694 attr.getAttributeSpellingListIndex()));
1697 bool Sema::CheckNoReturnAttr(const AttributeList &attr) {
1698 if (attr.hasParameterOrArguments()) {
1699 Diag(attr.getLoc(), diag::err_attribute_wrong_number_arguments)
1700 << attr.getName() << 0;
1701 attr.setInvalid();
1709 const AttributeList &Attr) {
1714 if(!checkAttributeNumArgs(S, Attr, 0))
1721 S.Diag(Attr.getLoc(),
1722 Attr.isCXX11Attribute() ? diag::err_attribute_wrong_decl_type
1724 << Attr.getName() << ExpectedFunctionMethodOrBlock;
1730 AnalyzerNoReturnAttr(Attr.getRange(), S.Context,
1731 Attr.getAttributeSpellingListIndex()));
1735 const AttributeList &Attr) {
1736 // C++11 [dcl.attr.noreturn]p1:
1741 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
1742 << Attr.getName() << ExpectedFunctionOrMethod;
1747 CXX11NoReturnAttr(Attr.getRange(), S.Context,
1748 Attr.getAttributeSpellingListIndex()));
1752 static void handleVecReturnAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1777 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
1778 << Attr.getName() << ExpectedClass;
1783 S.Diag(Attr.getLoc(), diag::err_repeat_attribute) << "vecreturn";
1791 S.Diag(Attr.getLoc(), diag::err_attribute_vecreturn_only_vector_member);
1796 S.Diag(Attr.getLoc(), diag::err_attribute_vecreturn_only_pod_record);
1803 S.Diag(Attr.getLoc(), diag::err_attribute_vecreturn_only_vector_member);
1810 VecReturnAttr(Attr.getRange(), S.Context,
1811 Attr.getAttributeSpellingListIndex()));
1815 const AttributeList &Attr) {
1820 S.Diag(Attr.getLoc(),
1825 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
1826 << Attr.getName() << ExpectedFunctionMethodOrParameter;
1831 Attr.getRange(), S.Context,
1832 Attr.getAttributeSpellingListIndex()));
1835 static void handleUnusedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1837 if (Attr.hasParameterOrArguments()) {
1838 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
1839 << Attr.getName() << 0;
1845 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1846 << Attr.getName() << ExpectedVariableFunctionOrLabel;
1851 UnusedAttr(Attr.getRange(), S.Context,
1852 Attr.getAttributeSpellingListIndex()));
1856 const AttributeList &Attr) {
1858 if (Attr.hasParameterOrArguments()) {
1859 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
1860 << Attr.getName() << 0;
1865 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1866 << Attr.getName() << ExpectedFunction;
1871 ReturnsTwiceAttr(Attr.getRange(), S.Context,
1872 Attr.getAttributeSpellingListIndex()));
1875 static void handleUsedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1877 if (Attr.hasParameterOrArguments()) {
1878 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
1879 << Attr.getName() << 0;
1885 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "used";
1889 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1890 << Attr.getName() << ExpectedVariableOrFunction;
1895 UsedAttr(Attr.getRange(), S.Context,
1896 Attr.getAttributeSpellingListIndex()));
1899 static void handleConstructorAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1901 if (Attr.getNumArgs() > 1) {
1902 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 1;
1907 if (Attr.getNumArgs() > 0) {
1908 Expr *E = Attr.getArg(0);
1912 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
1913 << Attr.getName() << 1 << AANT_ArgumentIntegerConstant
1921 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1922 << Attr.getName() << ExpectedFunction;
1927 ConstructorAttr(Attr.getRange(), S.Context, priority,
1928 Attr.getAttributeSpellingListIndex()));
1931 static void handleDestructorAttr(Sema &S, Decl *D, const AttributeList &Attr) {
1933 if (Attr.getNumArgs() > 1) {
1934 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 1;
1939 if (Attr.getNumArgs() > 0) {
1940 Expr *E = Attr.getArg(0);
1944 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
1945 << Attr
1953 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
1954 << Attr.getName() << ExpectedFunction;
1959 DestructorAttr(Attr.getRange(), S.Context, priority,
1960 Attr.getAttributeSpellingListIndex()));
1965 const AttributeList &Attr) {
1966 unsigned NumArgs = Attr.getNumArgs();
1968 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 1;
1975 StringLiteral *SE = dyn_cast<StringLiteral>(Attr.getArg(0));
1977 S.Diag(Attr.getArg(0)->getLocStart(), diag::err_attribute_argument_type)
1978 << Attr.getName() << AANT_ArgumentString;
1984 D->addAttr(::new (S.Context) AttrTy(Attr.getRange(), S.Context, Str,
1985 Attr.getAttributeSpellingListIndex()));
1989 const AttributeList &Attr) {
1990 if (!checkAttributeNumArgs(S, Attr, 0))
1994 ArcWeakrefUnavailableAttr(Attr.getRange(), S.Context,
1995 Attr.getAttributeSpellingListIndex()));
1999 const AttributeList &Attr) {
2001 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
2002 << Attr.getName() << ExpectedObjectiveCInterface;
2006 if (!checkAttributeNumArgs(S, Attr, 0))
2010 ObjCRootClassAttr(Attr.getRange(), S.Context,
2011 Attr.getAttributeSpellingListIndex()));
2015 const AttributeList &Attr) {
2017 S.Diag(Attr.getLoc(), diag::err_suppress_autosynthesis);
2021 if (!checkAttributeNumArgs(S, Attr, 0))
2025 ObjCRequiresPropertyDefsAttr(Attr.getRange(), S.Context,
2026 Attr.getAttributeSpellingListIndex()));
2212 const AttributeList &Attr) {
2213 IdentifierInfo *Platform = Attr.getParameterName();
2214 SourceLocation PlatformLoc = Attr.getParameterLoc();
2215 unsigned Index = Attr.getAttributeSpellingListIndex();
2223 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
2227 AvailabilityChange Introduced = Attr.getAvailabilityIntroduced();
2228 AvailabilityChange Deprecated = Attr.getAvailabilityDeprecated();
2229 AvailabilityChange Obsoleted = Attr.getAvailabilityObsoleted();
2230 bool IsUnavailable = Attr.getUnavailableLoc().isValid();
2233 dyn_cast_or_null<const StringLiteral>(Attr.getMessageExpr());
2237 AvailabilityAttr *NewAttr = S.mergeAvailabilityAttr(ND, Attr.getRange(),
2279 static void handleVisibilityAttr(Sema &S, Decl *D, const AttributeList &Attr,
2283 S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
2284 << Attr.getName();
2293 S.Diag(Attr.getRange().getBegin(), diag::err_attribute_wrong_decl_type)
2294 << Attr.getName() << ExpectedTypeOrNamespace;
2299 if (!checkAttributeNumArgs(S, Attr, 1))
2302 Expr *Arg = Attr.getArg(0);
2307 S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
2308 << Attr.getName() << AANT_ArgumentString;
2325 S.Diag(Attr.getLoc(), diag::warn_attribute_protected_visibility);
2331 S.Diag(Attr.getLoc(), diag::warn_attribute_unknown_visibility) << TypeStr;
2335 unsigned Index = Attr.getAttributeSpellingListIndex();
2336 clang::Attr *newAttr;
2338 newAttr = S.mergeTypeVisibilityAttr(D, Attr.getRange(),
2342 newAttr = S.mergeVisibilityAttr(D, Attr.getRange(), type, Index);
2349 const AttributeList &Attr) {
2352 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
2357 if (Attr.getNumArgs() != 0 || !Attr.getParameterName()) {
2358 if (!Attr.getParameterName() && Attr.getNumArgs() == 1) {
2359 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
2360 << Attr.getName() << 1 << AANT_ArgumentString;
2362 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
2363 << Attr.getName() << 0;
2365 Attr.setInvalid();
2369 StringRef param = Attr.getParameterName()->getName();
2386 S.Diag(Attr.getParameterLoc(), diag::warn_unknown_method_family);
2398 method->addAttr(new (S.Context) ObjCMethodFamilyAttr(Attr.getRange(),
2403 const AttributeList &Attr) {
2404 if (!checkAttributeNumArgs(S, Attr, 0))
2409 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
2410 << Attr.getName() << ExpectedObjectiveCInterface;
2415 ObjCExceptionAttr(Attr.getRange(), S.Context,
2416 Attr.getAttributeSpellingListIndex()));
2419 static void handleObjCNSObject(Sema &S, Decl *D, const AttributeList &Attr) {
2420 if (!checkAttributeNumArgs(S, Attr, 0))
2446 ObjCNSObjectAttr(Attr.getRange(), S.Context,
2447 Attr.getAttributeSpellingListIndex()));
2451 handleOverloadableAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2452 if (!checkAttributeNumArgs(S, Attr, 0))
2456 S.Diag(Attr.getLoc(), diag::err_attribute_overloadable_not_function);
2461 OverloadableAttr(Attr.getRange(), S.Context,
2462 Attr.getAttributeSpellingListIndex()));
2465 static void handleBlocksAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2466 if (!Attr.getParameterName()) {
2467 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
2468 << Attr.getName() << 1 << AANT_ArgumentString;
2472 if (Attr.getNumArgs() != 0) {
2473 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
2474 << Attr.getName() << 1;
2479 if (Attr.getParameterName()->isStr("byref"))
2482 S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported)
2483 << "blocks" << Attr.getParameterName();
2488 BlocksAttr(Attr.getRange(), S.Context, type,
2489 Attr.getAttributeSpellingListIndex()));
2492 static void handleSentinelAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2494 if (Attr.getNumArgs() > 2) {
2495 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 2;
2500 if (Attr.getNumArgs() > 0) {
2501 Expr *E = Attr.getArg(0);
2505 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
2506 << Attr.getName() << 1 << AANT_ArgumentIntegerConstant
2512 S.Diag(Attr.getLoc(), diag::err_attribute_sentinel_less_than_zero)
2521 if (Attr.getNumArgs() > 1) {
2522 Expr *E = Attr.getArg(1);
2526 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
2527 << Attr.getName() << 2 << AANT_ArgumentIntegerConstant
2536 S.Diag(Attr.getLoc(), diag::err_attribute_sentinel_not_zero_or_one)
2545 S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_named_arguments);
2550 S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0;
2555 S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0;
2560 S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 1;
2570 S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << m;
2574 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
2575 << Attr.getName() << ExpectedFunctionMethodOrBlock;
2579 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
2580 << Attr.getName() << ExpectedFunctionMethodOrBlock;
2584 SentinelAttr(Attr.getRange(), S.Context, sentinel, nullPos,
2585 Attr.getAttributeSpellingListIndex()));
2588 static void handleWarnUnusedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2590 if (!checkAttributeNumArgs(S, Attr, 0))
2594 RD->addAttr(::new (S.Context) WarnUnusedAttr(Attr.getRange(), S.Context));
2596 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
2599 static void handleWarnUnusedResult(Sema &S, Decl *D, const AttributeList &Attr) {
2601 if (!checkAttributeNumArgs(S, Attr, 0))
2605 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
2606 << Attr.getName() << ExpectedFunctionMethodOrClass;
2611 S.Diag(Attr.getLoc(), diag::warn_attribute_void_function_method)
2612 << Attr.getName() << 0;
2617 S.Diag(Attr.getLoc(), diag::warn_attribute_void_function_method)
2618 << Attr.getName() << 1;
2623 WarnUnusedResultAttr(Attr.getRange(), S.Context,
2624 Attr.getAttributeSpellingListIndex()));
2627 static void handleWeakAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2629 if (Attr.hasParameterOrArguments()) {
2630 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
2631 << Attr.getName() << 0;
2637 D->addAttr(::new (S.Context) WeakAttr(Attr.getRange(), S.Context));
2640 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
2641 << Attr.getName() << ExpectedVariableOrFunction;
2648 WeakAttr(Attr.getRange(), S.Context,
2649 Attr.getAttributeSpellingListIndex()));
2652 static void handleWeakImportAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2654 if (!checkAttributeNumArgs(S, Attr, 0))
2662 S.Diag(Attr.getLoc(), diag::warn_attribute_invalid_on_definition)
2669 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
2670 << Attr.getName() << ExpectedVariableOrFunction;
2676 WeakImportAttr(Attr.getRange(), S.Context,
2677 Attr.getAttributeSpellingListIndex()));
2682 const AttributeList &Attr) {
2683 assert(Attr.getKind() == AttributeList::AT_ReqdWorkGroupSize
2684 || Attr.getKind() == AttributeList::AT_WorkGroupSizeHint);
2687 if (!checkAttributeNumArgs(S, Attr, 3)) return;
2691 Expr *E = Attr.getArg(i);
2695 S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
2696 << Attr.getName() << AANT_ArgumentIntegerConstant
2703 if (Attr.getKind() == AttributeList::AT_ReqdWorkGroupSize
2709 S.Diag(Attr.getLoc(), diag::warn_duplicate_attribute) <<
2710 Attr.getName();
2714 if (Attr.getKind() == AttributeList::AT_WorkGroupSizeHint
2720 S.Diag(Attr.getLoc(), diag::warn_duplicate_attribute) <<
2721 Attr.getName();
2725 if (Attr.getKind() == AttributeList::AT_ReqdWorkGroupSize)
2727 ReqdWorkGroupSizeAttr(Attr.getRange(), S.Context,
2729 Attr.getAttributeSpellingListIndex()));
2732 WorkGroupSizeHintAttr(Attr.getRange(), S.Context,
2734 Attr.getAttributeSpellingListIndex()));
2737 static void handleVecTypeHint(Sema &S, Decl *D, const AttributeList &Attr) {
2738 assert(Attr.getKind() == AttributeList::AT_VecTypeHint);
2741 if (!checkAttributeNumArgs(S, Attr, 1))
2744 QualType ParmType = S.GetTypeFromParser(Attr.getTypeArg());
2749 S.Diag(Attr.getLoc(), diag::err_attribute_argument_vec_type_hint)
2754 if (Attr.getKind() == AttributeList::AT_VecTypeHint &&
2758 S.Diag(Attr.getLoc(), diag::warn_duplicate_attribute) << Attr.getName();
2763 D->addAttr(::new (S.Context) VecTypeHintAttr(Attr.getLoc(), S.Context,
2764 ParmType, Attr.getLoc()));
2767 static void handleEndianAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2769 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << "endian"
2771 StringRef EndianType = Attr.getParameterName()->getName();
2773 S.Diag(Attr.getLoc(), diag::warn_attribute_unknown_endian) << EndianType;
2790 static void handleSectionAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2792 if (!checkAttributeNumArgs(S, Attr, 1))
2797 Expr *ArgExpr = Attr.getArg(0);
2801 << Attr.getName() << AANT_ArgumentString;
2819 unsigned Index = Attr.getAttributeSpellingListIndex();
2820 SectionAttr *NewAttr = S.mergeSectionAttr(D, Attr.getRange(),
2827 static void handleNothrowAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2829 if (Attr.hasParameterOrArguments()) {
2830 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
2831 << Attr.getName() << 0;
2837 Existing->setRange(Attr.getRange());
2840 NoThrowAttr(Attr.getRange(), S.Context,
2841 Attr.getAttributeSpellingListIndex()));
2845 static void handleConstAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2847 if (Attr.hasParameterOrArguments()) {
2848 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
2849 << Attr.getName() << 0;
2855 Existing->setRange(Attr.getRange());
2858 ConstAttr(Attr.getRange(), S.Context,
2859 Attr.getAttributeSpellingListIndex() ));
2863 static void handlePureAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2865 if (!checkAttributeNumArgs(S, Attr, 0))
2869 PureAttr(Attr.getRange(), S.Context,
2870 Attr.getAttributeSpellingListIndex()));
2873 Attr) {
2874 if (!Attr.getParameterName()) {
2875 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
2876 << Attr.getName() << 1;
2880 if (Attr.getNumArgs() != 0) {
2881 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
2882 << Attr.getName() << 1;
2889 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "cleanup";
2896 = S.LookupSingleName(S.TUScope, Attr.getParameterName(),
2897 Attr.getParameterLoc(), Sema::LookupOrdinaryName);
2899 S.Diag(Attr.getParameterLoc(), diag::err_attribute_cleanup_arg_not_found) <<
2900 Attr.getParameterName();
2906 S.Diag(Attr.getParameterLoc(),
2908 << Attr.getParameterName();
2913 S.Diag(Attr.getParameterLoc(),
2915 << Attr.getParameterName();
2925 S.Diag(Attr.getParameterLoc(),
2927 Attr.getParameterName() << ParamTy << Ty;
2932 CleanupAttr(Attr.getRange(), S.Context, FD,
2933 Attr.getAttributeSpellingListIndex()));
2934 S.MarkFunctionReferenced(Attr.getParameterLoc(), FD);
2935 S.DiagnoseUseOfDecl(FD, Attr.getParameterLoc());
2940 static void handleFormatArgAttr(Sema &S, Decl *D, const AttributeList &Attr) {
2941 if (!checkAttributeNumArgs(S, Attr, 1))
2945 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
2946 << Attr.getName() << ExpectedFunction;
2950 Expr *IdxExpr = Attr.getArg(0);
2952 if (!checkFunctionOrMethodArgumentIndex(S, D, Attr.getName()->getName(),
2953 Attr.getLoc(), 1, IdxExpr, ArgIdx))
2965 S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
2976 S.Diag(Attr.getLoc(), diag::err_format_attribute_result_not)
2989 FormatArgAttr(Attr.getRange(), S.Context, Val.getZExtValue(),
2990 Attr.getAttributeSpellingListIndex()));
3023 const AttributeList &Attr) {
3025 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
3030 S.Diag(Attr.getLoc(), diag::err_init_priority_object_attr);
3031 Attr.setInvalid();
3038 S.Diag(Attr.getLoc(), diag::err_init_priority_object_attr);
3039 Attr.setInvalid();
3043 if (!checkAttributeNumArgs(S, Attr, 1)) {
3044 Attr.setInvalid();
3047 Expr *priorityExpr = Attr.getArg(0);
3052 S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
3053 << Attr.getName() << AANT_ArgumentIntegerConstant
3055 Attr.setInvalid();
3060 S.Diag(Attr.getLoc(), diag::err_attribute_argument_outof_range)
3062 Attr.setInvalid();
3066 InitPriorityAttr(Attr.getRange(), S.Context, prioritynum,
3067 Attr.getAttributeSpellingListIndex()));
3096 static void handleFormatAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3098 if (!Attr.getParameterName()) {
3099 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
3100 << Attr.getName() << 1 << AANT_ArgumentString;
3104 if (Attr.getNumArgs() != 2) {
3105 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
3106 << Attr.getName() << 3;
3111 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3112 << Attr.getName() << ExpectedFunction;
3122 StringRef Format = Attr.getParameterName()->getName();
3135 S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported)
3136 << "format" << Attr.getParameterName()->getName();
3141 Expr *IdxExpr = Attr.getArg(0);
3145 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
3146 << Attr.getName() << 2 << AANT_ArgumentIntegerConstant
3152 S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds)
3162 S.Diag(Attr.getLoc(),
3175 S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
3184 S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
3191 S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
3197 Expr *FirstArgExpr = Attr.getArg(1);
3201 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
3202 << Attr.getName() << 3 << AANT_ArgumentIntegerConstant
3221 S.Diag(Attr.getLoc(), diag::err_format_strftime_third_parameter)
3227 S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds)
3232 FormatAttr *NewAttr = S.mergeFormatAttr(D, Attr.getRange(), Format,
3235 Attr.getAttributeSpellingListIndex());
3241 const AttributeList &Attr) {
3243 if (!checkAttributeNumArgs(S, Attr, 0))
3256 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3257 << Attr.getName() << ExpectedUnion;
3262 S.Diag(Attr.getLoc(),
3270 S.Diag(Attr.getLoc(), diag::warn_transparent_union_attribute_zero_fields);
3305 TransparentUnionAttr(Attr.getRange(), S.Context,
3306 Attr.getAttributeSpellingListIndex()));
3309 static void handleAnnotateAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3311 if (!checkAttributeNumArgs(S, Attr, 1))
3314 Expr *ArgExpr = Attr.getArg(0);
3321 << Attr.getName() << AANT_ArgumentString;
3334 AnnotateAttr(Attr.getRange(), S.Context, SE->getString(),
3335 Attr.getAttributeSpellingListIndex()));
3338 static void handleAlignedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3340 Attr.getNumArgs() > 1) {
3341 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
3342 << Attr.getName() << 1;
3346 if (Attr.getNumArgs() == 0) {
3347 D->addAttr(::new (S.Context) AlignedAttr(Attr.getRange(), S.Context,
3348 true, 0, Attr.getAttributeSpellingListIndex()));
3352 Expr *E = Attr.getArg(0);
3353 if (Attr.isPackExpansion() && !E->containsUnexpandedParameterPack()) {
3354 S.Diag(Attr.getEllipsisLoc(),
3359 if (!Attr.isPackExpansion() && S.DiagnoseUnexpandedParameterPack(E))
3362 S.AddAlignedAttr(Attr.getRange(), D, E, Attr.getAttributeSpellingListIndex(),
3363 Attr.isPackExpansion());
3417 // FIXME: Cache the number on the Attr object?
3456 // FIXME: Cache the number on the Attr object if non-dependent?
3506 static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3511 if (!checkAttributeNumArgs(S, Attr, 0))
3515 IdentifierInfo *Name = Attr.getParameterName();
3517 S.Diag(Attr.getLoc(), diag::err_attribute_argument_type) << Attr.getName()
3522 StringRef Str = Attr.getParameterName()->getName();
3575 << "mode" << Attr.getRange();
3580 S.Diag(Attr.getLoc(), diag::err_mode_not_primitive);
3583 S.Diag(Attr.getLoc(), diag::err_mode_wrong_type);
3586 S.Diag(Attr.getLoc(), diag::err_mode_wrong_type);
3589 S.Diag(Attr.getLoc(), diag::err_mode_wrong_type);
3601 S.Diag(Attr.getLoc(), diag::err_unknown_machine_mode) << Name;
3604 S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name;
3608 S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name;
3618 S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name;
3654 S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name;
3678 ModeAttr(Attr.getRange(), S.Context, Name,
3679 Attr.getAttributeSpellingListIndex()));
3682 static void handleNoDebugAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3684 if (!checkAttributeNumArgs(S, Attr, 0))
3689 S.Diag(Attr.getLoc(),
3691 << Attr.getName();
3693 S.Diag(Attr.getLoc(),
3695 << Attr.getName();
3700 NoDebugAttr(Attr.getRange(), S.Context,
3701 Attr.getAttributeSpellingListIndex()));
3704 static void handleNoInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3706 if (!checkAttributeNumArgs(S, Attr, 0))
3711 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3712 << Attr.getName() << ExpectedFunction;
3717 NoInlineAttr(Attr.getRange(), S.Context,
3718 Attr.getAttributeSpellingListIndex()));
3722 const AttributeList &Attr) {
3724 if (!checkAttributeNumArgs(S, Attr, 0))
3729 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3730 << Attr.getName() << ExpectedFunction;
3735 NoInstrumentFunctionAttr(Attr.getRange(), S.Context,
3736 Attr.getAttributeSpellingListIndex()));
3739 static void handleKernelAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3741 D->addAttr(::new (S.Context) KernelAttr(Attr.getRange(), S.Context));
3743 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "kernel";
3747 static void handleConstantAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3750 if (Attr.hasParameterOrArguments()) {
3751 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
3752 << Attr.getName() << 0;
3757 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3758 << Attr.getName() << ExpectedVariable;
3763 CUDAConstantAttr(Attr.getRange(), S.Context,
3764 Attr.getAttributeSpellingListIndex()));
3766 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "constant";
3770 static void handleDeviceAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3773 if (Attr.getNumArgs() != 0) {
3774 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
3775 << Attr.getName() << 0;
3780 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3781 << Attr.getName() << ExpectedVariableOrFunction;
3786 CUDADeviceAttr(Attr.getRange(), S.Context,
3787 Attr.getAttributeSpellingListIndex()));
3789 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "device";
3793 static void handleGlobalAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3796 if (!checkAttributeNumArgs(S, Attr, 0))
3800 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3801 << Attr.getName() << ExpectedFunction;
3821 CUDAGlobalAttr(Attr.getRange(), S.Context,
3822 Attr.getAttributeSpellingListIndex()));
3824 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "global";
3828 static void handleHostAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3831 if (!checkAttributeNumArgs(S, Attr, 0))
3836 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3837 << Attr
3842 CUDAHostAttr(Attr.getRange(), S.Context,
3843 Attr.getAttributeSpellingListIndex()));
3845 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "host";
3849 static void handleSharedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3852 if (!checkAttributeNumArgs(S, Attr, 0))
3856 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3857 << Attr.getName() << ExpectedVariable;
3862 CUDASharedAttr(Attr.getRange(), S.Context,
3863 Attr.getAttributeSpellingListIndex()));
3865 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "shared";
3869 static void handleGNUInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3871 if (!checkAttributeNumArgs(S, Attr, 0))
3876 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3877 << Attr.getName() << ExpectedFunction;
3882 S.Diag(Attr.getLoc(), diag::warn_gnu_inline_attribute_requires_inline);
3887 GNUInlineAttr(Attr.getRange(), S.Context,
3888 Attr.getAttributeSpellingListIndex()));
3891 static void handleCallConvAttr(Sema &S, Decl *D, const AttributeList &Attr) {
3895 // Diagnostic is emitted elsewhere: here we store the (valid) Attr
3898 if (S.CheckCallingConvAttr(Attr, CC, FD))
3902 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
3903 << Attr.getName() << ExpectedFunctionOrMethod;
3907 switch (Attr.getKind()) {
3910 FastCallAttr(Attr.getRange(), S.Context,
3911 Attr.getAttributeSpellingListIndex()));
3915 StdCallAttr(Attr.getRange(), S.Context,
3916 Attr.getAttributeSpellingListIndex()));
3920 ThisCallAttr(Attr.getRange(), S.Context,
3921 Attr.getAttributeSpellingListIndex()));
3925 CDeclAttr(Attr.getRange(), S.Context,
3926 Attr.getAttributeSpellingListIndex()));
3930 PascalAttr(Attr.getRange(), S.Context,
3931 Attr.getAttributeSpellingListIndex()));
3947 PcsAttr(Attr.getRange(), S.Context, PCS,
3948 Attr.getAttributeSpellingListIndex()));
3953 PnaclCallAttr(Attr.getRange(), S.Context,
3954 Attr.getAttributeSpellingListIndex()));
3958 IntelOclBiccAttr(Attr.getRange(), S.Context,
3959 Attr.getAttributeSpellingListIndex()));
3967 static void handleOpenCLKernelAttr(Sema &S, Decl *D, const AttributeList &Attr){
3968 assert(!Attr.isInvalid());
3969 D->addAttr(::new (S.Context) OpenCLKernelAttr(Attr.getRange(), S.Context));
3972 static void handleOpenCLImageAccessAttr(Sema &S, Decl *D, const AttributeList &Attr){
3973 assert(!Attr.isInvalid());
3975 Expr *E = Attr.getArg(0);
3979 S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
3980 << Attr.getName() << AANT_ArgumentIntegerConstant
3986 Attr.getRange(), S.Context, ArgNum.getZExtValue()));
3989 bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC,
3991 if (attr.isInvalid())
3994 unsigned ReqArgs = attr.getKind() == AttributeList::AT_Pcs ? 1 : 0;
3995 if (attr.getNumArgs() != ReqArgs || attr.getParameterName()) {
3996 Diag(attr.getLoc(), diag::err_attribute_wrong_number_arguments)
3997 << attr.getName() << ReqArgs;
3998 attr.setInvalid();
4004 switch (attr.getKind()) {
4011 Expr *Arg = attr.getArg(0);
4014 Diag(attr.getLoc(), diag::err_attribute_argument_type) << attr.getName()
4016 attr.setInvalid();
4029 attr.setInvalid();
4030 Diag(attr.getLoc(), diag::err_invalid_pcs);
4041 Diag(attr.getLoc(), diag::warn_cconv_ignored) << attr.getName();
4053 static void handleRegparmAttr(Sema &S, Decl *D, const AttributeList &Attr) {
4057 if (S.CheckRegparmAttr(Attr, numParams))
4061 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
4062 << Attr.getName() << ExpectedFunctionOrMethod;
4067 RegparmAttr(Attr.getRange(), S.Context, numParams,
4068 Attr.getAttributeSpellingListIndex()));
4073 bool Sema::CheckRegparmAttr(const AttributeList &Attr, unsigned &numParams) {
4074 if (Attr.isInvalid())
4077 if (!checkAttributeNumArgs(*this, Attr, 1)) {
4078 Attr.setInvalid();
4082 Expr *NumParamsExpr = Attr.getArg(0);
4086 Diag(Attr.getLoc(), diag::err_attribute_argument_type)
4087 << Attr.getName() << AANT_ArgumentIntegerConstant
4089 Attr.setInvalid();
4094 Diag(Attr.getLoc(), diag::err_attribute_regparm_wrong_platform)
4096 Attr.setInvalid();
4102 Diag(Attr.getLoc(), diag::err_attribute_regparm_invalid_number)
4104 Attr.setInvalid();
4111 static void handleLaunchBoundsAttr(Sema &S, Decl *D, const AttributeList &Attr){
4114 if (Attr.getNumArgs() != 1 && Attr.getNumArgs() != 2) {
4116 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 2;
4121 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
4122 << Attr.getName() << ExpectedFunctionOrMethod;
4126 Expr *MaxThreadsExpr = Attr.getArg(0);
4131 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
4132 << Attr.getName() << 1 << AANT_ArgumentIntegerConstant
4138 if (Attr.getNumArgs() > 1) {
4139 Expr *MinBlocksExpr = Attr.getArg(1);
4143 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
4144 << Attr.getName() << 2 << AANT_ArgumentIntegerConstant
4151 CUDALaunchBoundsAttr(Attr.getRange(), S.Context,
4154 Attr.getAttributeSpellingListIndex()));
4156 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "launch_bounds";
4161 const AttributeList &Attr) {
4162 StringRef AttrName = Attr.getName()->getName();
4163 if (!Attr.getParameterName()) {
4164 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
4165 << Attr.getName() << /* arg num = */ 1 << AANT_ArgumentIdentifier;
4169 if (Attr.getNumArgs() != 2) {
4170 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
4171 << Attr.getName() << /* required args = */ 3;
4175 IdentifierInfo *ArgumentKind = Attr.getParameterName();
4178 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
4179 << Attr.getName() << ExpectedFunctionOrMethod;
4185 Attr.getLoc(), 2,
4186 Attr.getArg(0), ArgumentIdx))
4191 Attr.getLoc(), 3,
4192 Attr.getArg(1), TypeTagIdx))
4200 S.Diag(Attr.getLoc(), diag::err_attribute_pointers_only)
4201 << Attr.getName();
4206 ArgumentWithTypeTagAttr(Attr.getRange(), S.Context, ArgumentKind,
4208 Attr.getAttributeSpellingListIndex()));
4212 const AttributeList &Attr) {
4213 IdentifierInfo *PointerKind = Attr.getParameterName();
4215 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
4216 << Attr.getName() << 1 << AANT_ArgumentIdentifier;
4220 QualType MatchingCType = S.GetTypeFromParser(Attr.getMatchingCType(), NULL);
4223 TypeTagForDatatypeAttr(Attr.getRange(), S.Context, PointerKind,
4225 Attr.getLayoutCompatible(),
4226 Attr.getMustBeNull(),
4227 Attr.getAttributeSpellingListIndex()));
4245 static void handleNSConsumedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
4249 << Attr.getRange() << Attr.getName() << ExpectedParameter;
4254 if (Attr.getKind() == AttributeList::AT_NSConsumed) {
4264 << Attr.getRange() << Attr.getName() << cf;
4270 CFConsumedAttr(Attr.getRange(), S.Context,
4271 Attr.getAttributeSpellingListIndex()));
4274 NSConsumedAttr(Attr.getRange(), S.Context,
4275 Attr.getAttributeSpellingListIndex()));
4279 const AttributeList &Attr) {
4282 << Attr.getRange() << Attr.getName() << ExpectedMethod;
4287 NSConsumesSelfAttr(Attr.getRange(), S.Context,
4288 Attr.getAttributeSpellingListIndex()));
4292 const AttributeList &Attr) {
4299 (Attr.getKind() == AttributeList::AT_NSReturnsRetained))
4307 << Attr.getRange() << Attr.getName()
4314 switch (Attr.getKind()) {
4332 << Attr.getRange() << Attr.getName() << isa<ObjCMethodDecl>(D) << cf;
4336 switch (Attr.getKind()) {
4341 NSReturnsAutoreleasedAttr(Attr.getRange(), S.Context,
4342 Attr.getAttributeSpellingListIndex()));
4346 CFReturnsNotRetainedAttr(Attr.getRange(), S.Context,
4347 Attr.getAttributeSpellingListIndex()));
4351 NSReturnsNotRetainedAttr(Attr.getRange(), S.Context,
4352 Attr.getAttributeSpellingListIndex()));
4356 CFReturnsRetainedAttr(Attr.getRange(), S.Context,
4357 Attr.getAttributeSpellingListIndex()));
4361 NSReturnsRetainedAttr(Attr.getRange(), S.Context,
4362 Attr.getAttributeSpellingListIndex()));
4368 const AttributeList &attr) {
4369 SourceLocation loc = attr.getLoc();
4375 << SourceRange(loc, loc) << attr.getName() << ExpectedMethod;
4386 << attr.getName() << /*method*/ 1 << /*non-retainable pointer*/ 2;
4393 ObjCReturnsInnerPointerAttr(attr.getRange(), S.Context,
4394 attr.getAttributeSpellingListIndex()));
4398 const AttributeList &attr) {
4399 SourceLocation loc = attr.getLoc();
4404 << SourceRange(loc, loc) << attr.getName() << ExpectedMethod;
4410 << attr.getName() << 0;
4416 << attr.getName() << 1;
4421 ObjCRequiresSuperAttr(attr.getRange(), S.Context,
4422 attr.getAttributeSpellingListIndex()));
4436 Attr *Existing;
4463 const AttributeList &Attr) {
4467 << Attr.getRange() << Attr.getName() << ExpectedStruct;
4470 IdentifierInfo *ParmName = Attr.getParameterName();
4477 LookupResult R(S, DeclarationName(ParmName), Attr.getParameterLoc(),
4489 NSBridgedAttr(Attr.getRange(), S.Context, ParmName,
4490 Attr.getAttributeSpellingListIndex()));
4494 const AttributeList &Attr) {
4498 << Attr.getRange() << Attr.getName() << ExpectedVariable;
4502 const AttributeList &Attr) {
4505 << Attr.getRange() << Attr.getName() << ExpectedVariable;
4514 S.Diag(Attr.getLoc(), diag::err_objc_precise_lifetime_bad_type)
4538 S.Diag(Attr.getLoc(), diag::warn_objc_precise_lifetime_meaningless)
4544 ObjCPreciseLifetimeAttr(Attr.getRange(), S.Context,
4545 Attr.getAttributeSpellingListIndex()));
4554 static bool checkMicrosoftExt(Sema &S, const AttributeList &Attr,
4558 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
4562 static void handleUuidAttr(Sema &S, Decl *D, const AttributeList &Attr) {
4563 if (!checkMicrosoftExt(S, Attr, S.LangOpts.Borland))
4567 if (!checkAttributeNumArgs(S, Attr, 1))
4570 Expr *Arg = Attr.getArg(0);
4573 S.Diag(Attr.getLoc(), diag::err_attribute_argument_type)
4574 << Attr.getName() << AANT_ArgumentString;
4585 S.Diag(Attr.getLoc(), diag::err_attribute_uuid_malformed_guid);
4589 S.Diag(Attr.getLoc(), diag::err_attribute_uuid_malformed_guid);
4602 S.Diag(Attr.getLoc(), diag::err_attribute_uuid_malformed_guid);
4606 S.Diag(Attr.getLoc(), diag::err_attribute_uuid_malformed_guid);
4613 UuidAttr(Attr.getRange(), S.Context, Str->getString(),
4614 Attr.getAttributeSpellingListIndex()));
4617 static void handleInheritanceAttr(Sema &S, Decl *D, const AttributeList &Attr) {
4618 if (!checkMicrosoftExt(S, Attr))
4621 AttributeList::Kind Kind = Attr.getKind();
4625 SingleInheritanceAttr(Attr.getRange(), S.Context,
4626 Attr.getAttributeSpellingListIndex()));
4630 MultipleInheritanceAttr(Attr.getRange(), S.Context,
4631 Attr.getAttributeSpellingListIndex()));
4635 VirtualInheritanceAttr(Attr.getRange(), S.Context,
4636 Attr.getAttributeSpellingListIndex()));
4639 static void handlePortabilityAttr(Sema &S, Decl *D, const AttributeList &Attr) {
4640 if (!checkMicrosoftExt(S, Attr))
4643 AttributeList::Kind Kind = Attr.getKind();
4646 ::new (S.Context) Win64Attr(Attr.getRange(), S.Context,
4647 Attr.getAttributeSpellingListIndex()));
4650 static void handleForceInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) {
4651 if (!checkMicrosoftExt(S, Attr))
4654 ForceInlineAttr(Attr.getRange(), S.Context,
4655 Attr.getAttributeSpellingListIndex()));
4658 static void handleSelectAnyAttr(Sema &S, Decl *D, const AttributeList &Attr) {
4659 if (!checkMicrosoftExt(S, Attr))
4664 SelectAnyAttr(Attr.getRange(), S.Context,
4665 Attr.getAttributeSpellingListIndex()));
4673 const AttributeList &Attr) {
4674 switch (Attr.getKind()) {
4675 case AttributeList::AT_CUDADevice: handleDeviceAttr (S, D, Attr); break;
4676 case AttributeList::AT_CUDAHost: handleHostAttr (S, D, Attr); break;
4677 case AttributeList::AT_Overloadable:handleOverloadableAttr(S, D, Attr); break;
4678 case AttributeList::AT_Kernel: handleKernelAttr (S, D, Attr); break;
4685 const AttributeList &Attr) {
4686 switch (Attr.getKind()) {
4687 case AttributeList::AT_IBAction: handleIBAction(S, D, Attr); break;
4688 case AttributeList::AT_IBOutlet: handleIBOutlet(S, D, Attr); break;
4690 handleIBOutletCollection(S, D, Attr); break;
4710 case AttributeList::AT_Alias: handleAliasAttr (S, D, Attr); break;
4711 case AttributeList::AT_Aligned: handleAlignedAttr (S, D, Attr); break;
4712 case AttributeList::AT_AllocSize: handleAllocSizeAttr (S, D, Attr); break;
4714 handleAlwaysInlineAttr (S, D, Attr); break;
4716 handleAnalyzerNoReturnAttr (S, D, Attr); break;
4717 case AttributeList::AT_TLSModel: handleTLSModelAttr (S, D, Attr); break;
4718 case AttributeList::AT_Annotate: handleAnnotateAttr (S, D, Attr); break;
4719 case AttributeList::AT_Availability:handleAvailabilityAttr(S, D, Attr); break;
4721 handleDependencyAttr(S, scope, D, Attr);
4723 case AttributeList::AT_Common: handleCommonAttr (S, D, Attr); break;
4724 case AttributeList::AT_CUDAConstant:handleConstantAttr (S, D, Attr); break;
4725 case AttributeList::AT_Constructor: handleConstructorAttr (S, D, Attr); break;
4727 handleCXX11NoReturnAttr(S, D, Attr);
4730 handleAttrWithMessage<DeprecatedAttr>(S, D, Attr);
4732 case AttributeList::AT_Destructor: handleDestructorAttr (S, D, Attr); break;
4734 handleExtVectorTypeAttr(S, scope, D, Attr);
4737 handleMinSizeAttr(S, D, Attr);
4739 case AttributeList::AT_Format: handleFormatAttr (S, D, Attr); break;
4740 case AttributeList::AT_FormatArg: handleFormatArgAttr (S, D, Attr); break;
4741 case AttributeList::AT_CUDAGlobal: handleGlobalAttr (S, D, Attr); break;
4742 case AttributeList::AT_GNUInline: handleGNUInlineAttr (S, D, Attr); break;
4744 handleLaunchBoundsAttr(S, D, Attr);
4746 case AttributeList::AT_Mode: handleModeAttr (S, D, Attr); break;
4747 case AttributeList::AT_Malloc: handleMallocAttr (S, D, Attr); break;
4748 case AttributeList::AT_MayAlias: handleMayAliasAttr (S, D, Attr); break;
4749 case AttributeList::AT_NoCommon: handleNoCommonAttr (S, D, Attr); break;
4750 Attr); break;
4754 handleOwnershipAttr (S, D, Attr); break;
4755 case AttributeList::AT_Cold: handleColdAttr (S, D, Attr); break;
4756 case AttributeList::AT_Hot: handleHotAttr (S, D, Attr); break;
4757 case AttributeList::AT_Naked: handleNakedAttr (S, D, Attr); break;
4758 case AttributeList::AT_NoReturn: handleNoReturnAttr (S, D, Attr); break;
4759 case AttributeList::AT_NoThrow: handleNothrowAttr (S, D, Attr); break;
4760 case AttributeList::AT_CUDAShared: handleSharedAttr (S, D, Attr); break;
4761 case AttributeList::AT_VecReturn: handleVecReturnAttr (S, D, Attr); break;
4764 handleObjCOwnershipAttr(S, D, Attr); break;
4766 handleObjCPreciseLifetimeAttr(S, D, Attr); break;
4769 handleObjCReturnsInnerPointerAttr(S, D, Attr); break;
4772 handleObjCRequiresSuperAttr(S, D, Attr); break;
4775 handleNSBridgedAttr(S, scope, D, Attr); break;
4779 handleCFTransferAttr(S, D, Attr); break;
4783 case AttributeList::AT_NSConsumed: handleNSConsumedAttr (S, D, Attr); break;
4785 handleNSConsumesSelfAttr(S, D, Attr); break;
4792 handleNSReturnsRetainedAttr(S, D, Attr); break;
4796 handleWorkGroupSize(S, D, Attr); break;
4799 handleVecTypeHint(S, D, Attr); break;
4802 handleEndianAttr(S, D, Attr);
4806 handleInitPriorityAttr(S, D, Attr); break;
4808 case AttributeList::AT_Packed: handlePackedAttr (S, D, Attr); break;
4809 case AttributeList::AT_Section: handleSectionAttr (S, D, Attr); break;
4811 handleAttrWithMessage<UnavailableAttr>(S, D, Attr);
4814 handleArcWeakrefUnavailableAttr (S, D, Attr);
4817 handleObjCRootClassAttr(S, D, Attr);
4820 handleObjCRequiresPropertyDefsAttr (S, D, Attr);
4822 case AttributeList::AT_Unused: handleUnusedAttr (S, D, Attr); break;
4824 handleReturnsTwiceAttr(S, D, Attr);
4826 case AttributeList::AT_Used: handleUsedAttr (S, D, Attr); break;
4828 handleVisibilityAttr(S, D, Attr, false);
4831 handleVisibilityAttr(S, D, Attr, true);
4834 handleWarnUnusedAttr(S, D, Attr);
4836 case AttributeList::AT_WarnUnusedResult: handleWarnUnusedResult(S, D, Attr);
4838 case AttributeList::AT_Weak: handleWeakAttr (S, D, Attr); break;
4839 case AttributeList::AT_WeakRef: handleWeakRefAttr (S, D, Attr); break;
4840 case AttributeList::AT_WeakImport: handleWeakImportAttr (S, D, Attr); break;
4842 handleTransparentUnionAttr(S, D, Attr);
4845 handleObjCExceptionAttr(S, D, Attr);
4848 handleObjCMethodFamilyAttr(S, D, Attr);
4850 case AttributeList::AT_ObjCNSObject:handleObjCNSObject (S, D, Attr); break;
4851 case AttributeList::AT_Blocks: handleBlocksAttr (S, D, Attr); break;
4852 case AttributeList::AT_Sentinel: handleSentinelAttr (S, D, Attr); break;
4853 case AttributeList::AT_Const: handleConstAttr (S, D, Attr); break;
4854 case AttributeList::AT_Pure: handlePureAttr (S, D, Attr); break;
4855 case AttributeList::AT_Cleanup: handleCleanupAttr (S, D, Attr); break;
4856 case AttributeList::AT_NoDebug: handleNoDebugAttr (S, D, Attr); break;
4857 case AttributeList::AT_NoInline: handleNoInlineAttr (S, D, Attr); break;
4858 case AttributeList::AT_Regparm: handleRegparmAttr (S, D, Attr); break;
4863 handleNoInstrumentFunctionAttr(S, D, Attr);
4873 handleCallConvAttr(S, D, Attr);
4876 handleOpenCLKernelAttr(S, D, Attr);
4879 handleOpenCLImageAccessAttr(S, D, Attr);
4885 handleMsStructAttr(S, D, Attr);
4888 handleUuidAttr(S, D, Attr);
4893 handleInheritanceAttr(S, D, Attr);
4896 handlePortabilityAttr(S, D, Attr);
4899 handleForceInlineAttr(S, D, Attr);
4902 handleSelectAnyAttr(S, D, Attr);
4907 handleAssertExclusiveLockAttr(S, D, Attr);
4910 handleAssertSharedLockAttr(S, D, Attr);
4913 handleGuardedVarAttr(S, D, Attr);
4916 handlePtGuardedVarAttr(S, D, Attr);
4919 handleScopedLockableAttr(S, D, Attr);
4922 handleNoSanitizeAddressAttr(S, D, Attr);
4925 handleNoThreadSafetyAnalysis(S, D, Attr);
4928 handleNoSanitizeThread(S, D, Attr);
4931 handleNoSanitizeMemory(S, D, Attr);
4934 handleLockableAttr(S, D, Attr);
4937 handleGuardedByAttr(S, D, Attr);
4940 handlePtGuardedByAttr(S, D, Attr);
4943 handleExclusiveLockFunctionAttr(S, D, Attr);
4946 handleExclusiveLocksRequiredAttr(S, D, Attr);
4949 handleExclusiveTrylockFunctionAttr(S, D, Attr);
4952 handleLockReturnedAttr(S, D, Attr);
4955 handleLocksExcludedAttr(S, D, Attr);
4958 handleSharedLockFunctionAttr(S, D, Attr);
4961 handleSharedLocksRequiredAttr(S, D, Attr);
4964 handleSharedTrylockFunctionAttr(S, D, Attr);
4967 handleUnlockFunAttr(S, D, Attr);
4970 handleAcquiredBeforeAttr(S, D, Attr);
4973 handleAcquiredAfterAttr(S, D, Attr);
4978 handleArgumentWithTypeTagAttr(S, D, Attr);
4981 handleTypeTagForDatatypeAttr(S, D, Attr);
4987 if (!TargetAttrs.ProcessDeclAttribute(scope, D, Attr, S))
4988 S.Diag(Attr.getLoc(), Attr.isDeclspecAttribute() ?
4990 diag::warn_unknown_attribute_ignored) << Attr.getName();
4999 const AttributeList &Attr,
5002 if (Attr.isInvalid())
5007 if (Attr.isCXX11Attribute() && !IncludeCXX11Attributes)
5011 ProcessNonInheritableDeclAttr(S, scope, D, Attr);
5014 ProcessInheritableDeclAttr(S, scope, D, Attr);