Lines Matching refs:D
54 static const FunctionType *getFunctionType(const Decl *D, in getFunctionType() argument
57 if (const ValueDecl *decl = dyn_cast<ValueDecl>(D)) in getFunctionType()
59 else if (const FieldDecl *decl = dyn_cast<FieldDecl>(D)) in getFunctionType()
61 else if (const TypedefNameDecl* decl = dyn_cast<TypedefNameDecl>(D)) in getFunctionType()
79 static bool isFunction(const Decl *D) { in isFunction() argument
80 return getFunctionType(D, false) != NULL; in isFunction()
86 static bool isFunctionOrMethod(const Decl *D) { in isFunctionOrMethod() argument
87 return isFunction(D) || isa<ObjCMethodDecl>(D); in isFunctionOrMethod()
93 static bool isFunctionOrMethodOrBlock(const Decl *D) { in isFunctionOrMethodOrBlock() argument
94 if (isFunctionOrMethod(D)) in isFunctionOrMethodOrBlock()
97 if (const VarDecl *V = dyn_cast<VarDecl>(D)) { in isFunctionOrMethodOrBlock()
101 return isa<BlockDecl>(D); in isFunctionOrMethodOrBlock()
106 static bool hasDeclarator(const Decl *D) { in hasDeclarator() argument
108 return isa<DeclaratorDecl>(D) || isa<BlockDecl>(D) || isa<TypedefNameDecl>(D) || in hasDeclarator()
109 isa<ObjCPropertyDecl>(D); in hasDeclarator()
115 static bool hasFunctionProto(const Decl *D) { in hasFunctionProto() argument
116 if (const FunctionType *FnTy = getFunctionType(D)) in hasFunctionProto()
119 assert(isa<ObjCMethodDecl>(D) || isa<BlockDecl>(D)); in hasFunctionProto()
127 static unsigned getFunctionOrMethodNumArgs(const Decl *D) { in getFunctionOrMethodNumArgs() argument
128 if (const FunctionType *FnTy = getFunctionType(D)) in getFunctionOrMethodNumArgs()
130 if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) in getFunctionOrMethodNumArgs()
132 return cast<ObjCMethodDecl>(D)->param_size(); in getFunctionOrMethodNumArgs()
135 static QualType getFunctionOrMethodArgType(const Decl *D, unsigned Idx) { in getFunctionOrMethodArgType() argument
136 if (const FunctionType *FnTy = getFunctionType(D)) in getFunctionOrMethodArgType()
138 if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) in getFunctionOrMethodArgType()
141 return cast<ObjCMethodDecl>(D)->param_begin()[Idx]->getType(); in getFunctionOrMethodArgType()
144 static QualType getFunctionOrMethodResultType(const Decl *D) { in getFunctionOrMethodResultType() argument
145 if (const FunctionType *FnTy = getFunctionType(D)) in getFunctionOrMethodResultType()
147 return cast<ObjCMethodDecl>(D)->getResultType(); in getFunctionOrMethodResultType()
150 static bool isFunctionOrMethodVariadic(const Decl *D) { in isFunctionOrMethodVariadic() argument
151 if (const FunctionType *FnTy = getFunctionType(D)) { in isFunctionOrMethodVariadic()
154 } else if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) in isFunctionOrMethodVariadic()
157 return cast<ObjCMethodDecl>(D)->isVariadic(); in isFunctionOrMethodVariadic()
161 static bool isInstanceMethod(const Decl *D) { in isInstanceMethod() argument
162 if (const CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(D)) in isInstanceMethod()
228 static bool checkFunctionOrMethodArgumentIndex(Sema &S, const Decl *D, in checkFunctionOrMethodArgumentIndex() argument
235 assert(isFunctionOrMethod(D) && hasFunctionProto(D)); in checkFunctionOrMethodArgumentIndex()
239 const bool HasImplicitThisParam = isInstanceMethod(D); in checkFunctionOrMethodArgumentIndex()
240 const unsigned NumArgs = getFunctionOrMethodNumArgs(D) + HasImplicitThisParam; in checkFunctionOrMethodArgumentIndex()
252 if (Idx < FirstIdx || (!isFunctionOrMethodVariadic(D) && Idx > NumArgs)) { in checkFunctionOrMethodArgumentIndex()
275 static bool mayBeSharedVariable(const Decl *D) { in mayBeSharedVariable() argument
276 if (isa<FieldDecl>(D)) in mayBeSharedVariable()
278 if (const VarDecl *vd = dyn_cast<VarDecl>(D)) in mayBeSharedVariable()
310 static bool threadSafetyCheckIsPointer(Sema &S, const Decl *D, in threadSafetyCheckIsPointer() argument
312 if (const ValueDecl *vd = dyn_cast<ValueDecl>(D)) { in threadSafetyCheckIsPointer()
362 static void checkForLockableRecord(Sema &S, Decl *D, const AttributeList &Attr, in checkForLockableRecord() argument
403 static void checkAttrArgsAreLockableObjs(Sema &S, Decl *D, in checkAttrArgsAreLockableObjs() argument
449 FunctionDecl *FD = dyn_cast<FunctionDecl>(D); in checkAttrArgsAreLockableObjs()
465 checkForLockableRecord(S, D, Attr, ArgTy); in checkAttrArgsAreLockableObjs()
485 static bool checkGuardedVarAttrCommon(Sema &S, Decl *D, in checkGuardedVarAttrCommon() argument
493 if (!mayBeSharedVariable(D)) { in checkGuardedVarAttrCommon()
502 static void handleGuardedVarAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleGuardedVarAttr() argument
503 if (!checkGuardedVarAttrCommon(S, D, Attr)) in handleGuardedVarAttr()
506 D->addAttr(::new (S.Context) GuardedVarAttr(Attr.getRange(), S.Context)); in handleGuardedVarAttr()
509 static void handlePtGuardedVarAttr(Sema &S, Decl *D, in handlePtGuardedVarAttr() argument
511 if (!checkGuardedVarAttrCommon(S, D, Attr)) in handlePtGuardedVarAttr()
514 if (!threadSafetyCheckIsPointer(S, D, Attr)) in handlePtGuardedVarAttr()
517 D->addAttr(::new (S.Context) PtGuardedVarAttr(Attr.getRange(), S.Context)); in handlePtGuardedVarAttr()
520 static bool checkGuardedByAttrCommon(Sema &S, Decl *D, in checkGuardedByAttrCommon() argument
529 if (!mayBeSharedVariable(D)) { in checkGuardedByAttrCommon()
537 checkAttrArgsAreLockableObjs(S, D, Attr, Args); in checkGuardedByAttrCommon()
547 static void handleGuardedByAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleGuardedByAttr() argument
549 if (!checkGuardedByAttrCommon(S, D, Attr, Arg)) in handleGuardedByAttr()
552 D->addAttr(::new (S.Context) GuardedByAttr(Attr.getRange(), S.Context, Arg)); in handleGuardedByAttr()
555 static void handlePtGuardedByAttr(Sema &S, Decl *D, in handlePtGuardedByAttr() argument
558 if (!checkGuardedByAttrCommon(S, D, Attr, Arg)) in handlePtGuardedByAttr()
561 if (!threadSafetyCheckIsPointer(S, D, Attr)) in handlePtGuardedByAttr()
564 D->addAttr(::new (S.Context) PtGuardedByAttr(Attr.getRange(), in handlePtGuardedByAttr()
568 static bool checkLockableAttrCommon(Sema &S, Decl *D, in checkLockableAttrCommon() argument
576 if (!isa<CXXRecordDecl>(D)) { in checkLockableAttrCommon()
585 static void handleLockableAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleLockableAttr() argument
586 if (!checkLockableAttrCommon(S, D, Attr)) in handleLockableAttr()
589 D->addAttr(::new (S.Context) LockableAttr(Attr.getRange(), S.Context)); in handleLockableAttr()
592 static void handleScopedLockableAttr(Sema &S, Decl *D, in handleScopedLockableAttr() argument
594 if (!checkLockableAttrCommon(S, D, Attr)) in handleScopedLockableAttr()
597 D->addAttr(::new (S.Context) ScopedLockableAttr(Attr.getRange(), S.Context)); in handleScopedLockableAttr()
600 static void handleNoThreadSafetyAttr(Sema &S, Decl *D, in handleNoThreadSafetyAttr() argument
607 if (!isa<FunctionDecl>(D) && !isa<FunctionTemplateDecl>(D)) { in handleNoThreadSafetyAttr()
613 D->addAttr(::new (S.Context) NoThreadSafetyAnalysisAttr(Attr.getRange(), in handleNoThreadSafetyAttr()
617 static void handleNoAddressSafetyAttr(Sema &S, Decl *D, in handleNoAddressSafetyAttr() argument
624 if (!isa<FunctionDecl>(D) && !isa<FunctionTemplateDecl>(D)) { in handleNoAddressSafetyAttr()
630 D->addAttr(::new (S.Context) NoAddressSafetyAnalysisAttr(Attr.getRange(), in handleNoAddressSafetyAttr()
634 static bool checkAcquireOrderAttrCommon(Sema &S, Decl *D, in checkAcquireOrderAttrCommon() argument
643 ValueDecl *VD = dyn_cast<ValueDecl>(D); in checkAcquireOrderAttrCommon()
644 if (!VD || !mayBeSharedVariable(D)) { in checkAcquireOrderAttrCommon()
662 checkAttrArgsAreLockableObjs(S, D, Attr, Args); in checkAcquireOrderAttrCommon()
669 static void handleAcquiredAfterAttr(Sema &S, Decl *D, in handleAcquiredAfterAttr() argument
672 if (!checkAcquireOrderAttrCommon(S, D, Attr, Args)) in handleAcquiredAfterAttr()
676 D->addAttr(::new (S.Context) AcquiredAfterAttr(Attr.getRange(), S.Context, in handleAcquiredAfterAttr()
680 static void handleAcquiredBeforeAttr(Sema &S, Decl *D, in handleAcquiredBeforeAttr() argument
683 if (!checkAcquireOrderAttrCommon(S, D, Attr, Args)) in handleAcquiredBeforeAttr()
687 D->addAttr(::new (S.Context) AcquiredBeforeAttr(Attr.getRange(), S.Context, in handleAcquiredBeforeAttr()
691 static bool checkLockFunAttrCommon(Sema &S, Decl *D, in checkLockFunAttrCommon() argument
699 if (!isa<FunctionDecl>(D) && !isa<FunctionTemplateDecl>(D)) { in checkLockFunAttrCommon()
706 checkAttrArgsAreLockableObjs(S, D, Attr, Args, 0, /*ParamIdxOk=*/true); in checkLockFunAttrCommon()
711 static void handleSharedLockFunctionAttr(Sema &S, Decl *D, in handleSharedLockFunctionAttr() argument
714 if (!checkLockFunAttrCommon(S, D, Attr, Args)) in handleSharedLockFunctionAttr()
719 D->addAttr(::new (S.Context) SharedLockFunctionAttr(Attr.getRange(), in handleSharedLockFunctionAttr()
724 static void handleExclusiveLockFunctionAttr(Sema &S, Decl *D, in handleExclusiveLockFunctionAttr() argument
727 if (!checkLockFunAttrCommon(S, D, Attr, Args)) in handleExclusiveLockFunctionAttr()
732 D->addAttr(::new (S.Context) ExclusiveLockFunctionAttr(Attr.getRange(), in handleExclusiveLockFunctionAttr()
737 static bool checkTryLockFunAttrCommon(Sema &S, Decl *D, in checkTryLockFunAttrCommon() argument
745 if (!isa<FunctionDecl>(D) && !isa<FunctionTemplateDecl>(D)) { in checkTryLockFunAttrCommon()
758 checkAttrArgsAreLockableObjs(S, D, Attr, Args, 1); in checkTryLockFunAttrCommon()
763 static void handleSharedTrylockFunctionAttr(Sema &S, Decl *D, in handleSharedTrylockFunctionAttr() argument
766 if (!checkTryLockFunAttrCommon(S, D, Attr, Args)) in handleSharedTrylockFunctionAttr()
771 D->addAttr(::new (S.Context) SharedTrylockFunctionAttr(Attr.getRange(), in handleSharedTrylockFunctionAttr()
777 static void handleExclusiveTrylockFunctionAttr(Sema &S, Decl *D, in handleExclusiveTrylockFunctionAttr() argument
780 if (!checkTryLockFunAttrCommon(S, D, Attr, Args)) in handleExclusiveTrylockFunctionAttr()
785 D->addAttr(::new (S.Context) ExclusiveTrylockFunctionAttr(Attr.getRange(), in handleExclusiveTrylockFunctionAttr()
791 static bool checkLocksRequiredCommon(Sema &S, Decl *D, in checkLocksRequiredCommon() argument
799 if (!isa<FunctionDecl>(D) && !isa<FunctionTemplateDecl>(D)) { in checkLocksRequiredCommon()
806 checkAttrArgsAreLockableObjs(S, D, Attr, Args); in checkLocksRequiredCommon()
813 static void handleExclusiveLocksRequiredAttr(Sema &S, Decl *D, in handleExclusiveLocksRequiredAttr() argument
816 if (!checkLocksRequiredCommon(S, D, Attr, Args)) in handleExclusiveLocksRequiredAttr()
820 D->addAttr(::new (S.Context) ExclusiveLocksRequiredAttr(Attr.getRange(), in handleExclusiveLocksRequiredAttr()
826 static void handleSharedLocksRequiredAttr(Sema &S, Decl *D, in handleSharedLocksRequiredAttr() argument
829 if (!checkLocksRequiredCommon(S, D, Attr, Args)) in handleSharedLocksRequiredAttr()
833 D->addAttr(::new (S.Context) SharedLocksRequiredAttr(Attr.getRange(), in handleSharedLocksRequiredAttr()
839 static void handleUnlockFunAttr(Sema &S, Decl *D, in handleUnlockFunAttr() argument
845 if (!isa<FunctionDecl>(D) && !isa<FunctionTemplateDecl>(D)) { in handleUnlockFunAttr()
853 checkAttrArgsAreLockableObjs(S, D, Attr, Args, 0, /*ParamIdxOk=*/true); in handleUnlockFunAttr()
857 D->addAttr(::new (S.Context) UnlockFunctionAttr(Attr.getRange(), S.Context, in handleUnlockFunAttr()
861 static void handleLockReturnedAttr(Sema &S, Decl *D, in handleLockReturnedAttr() argument
869 if (!isa<FunctionDecl>(D) && !isa<FunctionTemplateDecl>(D)) { in handleLockReturnedAttr()
880 checkAttrArgsAreLockableObjs(S, D, Attr, Args); in handleLockReturnedAttr()
885 D->addAttr(::new (S.Context) LockReturnedAttr(Attr.getRange(), S.Context, in handleLockReturnedAttr()
889 static void handleLocksExcludedAttr(Sema &S, Decl *D, in handleLocksExcludedAttr() argument
896 if (!isa<FunctionDecl>(D) && !isa<FunctionTemplateDecl>(D)) { in handleLocksExcludedAttr()
904 checkAttrArgsAreLockableObjs(S, D, Attr, Args); in handleLocksExcludedAttr()
910 D->addAttr(::new (S.Context) LocksExcludedAttr(Attr.getRange(), S.Context, in handleLocksExcludedAttr()
915 static void handleExtVectorTypeAttr(Sema &S, Scope *scope, Decl *D, in handleExtVectorTypeAttr() argument
917 TypedefNameDecl *tDecl = dyn_cast<TypedefNameDecl>(D); in handleExtVectorTypeAttr()
960 static void handlePackedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handlePackedAttr() argument
965 if (TagDecl *TD = dyn_cast<TagDecl>(D)) in handlePackedAttr()
967 else if (FieldDecl *FD = dyn_cast<FieldDecl>(D)) { in handlePackedAttr()
980 static void handleMsStructAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleMsStructAttr() argument
981 if (TagDecl *TD = dyn_cast<TagDecl>(D)) in handleMsStructAttr()
987 static void handleIBAction(Sema &S, Decl *D, const AttributeList &Attr) { in handleIBAction() argument
993 if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) in handleIBAction()
995 D->addAttr(::new (S.Context) IBActionAttr(Attr.getRange(), S.Context)); in handleIBAction()
1002 static bool checkIBOutletCommon(Sema &S, Decl *D, const AttributeList &Attr) { in checkIBOutletCommon() argument
1006 if (const ObjCIvarDecl *VD = dyn_cast<ObjCIvarDecl>(D)) { in checkIBOutletCommon()
1013 else if (const ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) { in checkIBOutletCommon()
1028 static void handleIBOutlet(Sema &S, Decl *D, const AttributeList &Attr) { in handleIBOutlet() argument
1033 if (!checkIBOutletCommon(S, D, Attr)) in handleIBOutlet()
1036 D->addAttr(::new (S.Context) IBOutletAttr(Attr.getRange(), S.Context)); in handleIBOutlet()
1039 static void handleIBOutletCollection(Sema &S, Decl *D, in handleIBOutletCollection() argument
1048 if (!checkIBOutletCommon(S, D, Attr)) in handleIBOutletCollection()
1056 S.getScopeForContext(D->getDeclContext()->getParent())); in handleIBOutletCollection()
1070 D->addAttr(::new (S.Context) IBOutletCollectionAttr(Attr.getRange(),S.Context, in handleIBOutletCollection()
1089 static void handleAllocSizeAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleAllocSizeAttr() argument
1090 if (!isFunctionOrMethod(D)) { in handleAllocSizeAttr()
1101 bool HasImplicitThisParam = isInstanceMethod(D); in handleAllocSizeAttr()
1102 unsigned NumArgs = getFunctionOrMethodNumArgs(D) + HasImplicitThisParam; in handleAllocSizeAttr()
1138 QualType T = getFunctionOrMethodArgType(D, x).getNonReferenceType(); in handleAllocSizeAttr()
1149 if (!getFunctionType(D)->getResultType()->isAnyPointerType()) { in handleAllocSizeAttr()
1151 << "alloc_size" << 0 /*function*/<< 1 /*pointer*/ << D->getSourceRange(); in handleAllocSizeAttr()
1154 D->addAttr(::new (S.Context) AllocSizeAttr(Attr.getRange(), S.Context, in handleAllocSizeAttr()
1158 static void handleNonNullAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNonNullAttr() argument
1161 if (!isFunctionOrMethod(D) || !hasFunctionProto(D)) { in handleNonNullAttr()
1169 bool HasImplicitThisParam = isInstanceMethod(D); in handleNonNullAttr()
1170 unsigned NumArgs = getFunctionOrMethodNumArgs(D) + HasImplicitThisParam; in handleNonNullAttr()
1209 QualType T = getFunctionOrMethodArgType(D, x).getNonReferenceType(); in handleNonNullAttr()
1225 for (unsigned I = 0, E = getFunctionOrMethodNumArgs(D); I != E; ++I) { in handleNonNullAttr()
1226 QualType T = getFunctionOrMethodArgType(D, I).getNonReferenceType(); in handleNonNullAttr()
1245 D->addAttr(::new (S.Context) NonNullAttr(Attr.getRange(), S.Context, start, in handleNonNullAttr()
1249 static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) { in handleOwnershipAttr() argument
1294 if (!isFunction(D) || !hasFunctionProto(D)) { in handleOwnershipAttr()
1302 bool HasImplicitThisParam = isInstanceMethod(D); in handleOwnershipAttr()
1303 unsigned NumArgs = getFunctionOrMethodNumArgs(D) + HasImplicitThisParam; in handleOwnershipAttr()
1346 QualType T = getFunctionOrMethodArgType(D, x); in handleOwnershipAttr()
1376 i = D->specific_attr_begin<OwnershipAttr>(), in handleOwnershipAttr()
1377 e = D->specific_attr_end<OwnershipAttr>(); in handleOwnershipAttr()
1401 D->addAttr(::new (S.Context) OwnershipAttr(AL.getLoc(), S.Context, K, Module, in handleOwnershipAttr()
1407 static bool hasEffectivelyInternalLinkage(NamedDecl *D) { in hasEffectivelyInternalLinkage() argument
1408 switch (D->getLinkage()) { in hasEffectivelyInternalLinkage()
1424 static void handleWeakRefAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleWeakRefAttr() argument
1431 if (!isa<VarDecl>(D) && !isa<FunctionDecl>(D)) { in handleWeakRefAttr()
1437 NamedDecl *nd = cast<NamedDecl>(D); in handleWeakRefAttr()
1449 const DeclContext *Ctx = D->getDeclContext()->getRedeclContext(); in handleWeakRefAttr()
1495 D->addAttr(::new (S.Context) AliasAttr(Attr.getRange(), S.Context, in handleWeakRefAttr()
1499 D->addAttr(::new (S.Context) WeakRefAttr(Attr.getRange(), S.Context)); in handleWeakRefAttr()
1502 static void handleAliasAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleAliasAttr() argument
1526 D->addAttr(::new (S.Context) AliasAttr(Attr.getRange(), S.Context, in handleAliasAttr()
1530 static void handleColdAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleColdAttr() argument
1535 if (!isa<FunctionDecl>(D)) { in handleColdAttr()
1541 if (D->hasAttr<HotAttr>()) { in handleColdAttr()
1547 D->addAttr(::new (S.Context) ColdAttr(Attr.getRange(), S.Context)); in handleColdAttr()
1550 static void handleHotAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleHotAttr() argument
1555 if (!isa<FunctionDecl>(D)) { in handleHotAttr()
1561 if (D->hasAttr<ColdAttr>()) { in handleHotAttr()
1567 D->addAttr(::new (S.Context) HotAttr(Attr.getRange(), S.Context)); in handleHotAttr()
1570 static void handleNakedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNakedAttr() argument
1575 if (!isa<FunctionDecl>(D)) { in handleNakedAttr()
1581 D->addAttr(::new (S.Context) NakedAttr(Attr.getRange(), S.Context)); in handleNakedAttr()
1584 static void handleAlwaysInlineAttr(Sema &S, Decl *D, in handleAlwaysInlineAttr() argument
1592 if (!isa<FunctionDecl>(D)) { in handleAlwaysInlineAttr()
1598 D->addAttr(::new (S.Context) AlwaysInlineAttr(Attr.getRange(), S.Context)); in handleAlwaysInlineAttr()
1601 static void handleTLSModelAttr(Sema &S, Decl *D, in handleTLSModelAttr() argument
1619 if (!isa<VarDecl>(D) || !cast<VarDecl>(D)->isThreadSpecified()) { in handleTLSModelAttr()
1633 D->addAttr(::new (S.Context) TLSModelAttr(Attr.getRange(), S.Context, in handleTLSModelAttr()
1637 static void handleMallocAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleMallocAttr() argument
1644 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { in handleMallocAttr()
1647 D->addAttr(::new (S.Context) MallocAttr(Attr.getRange(), S.Context)); in handleMallocAttr()
1655 static void handleMayAliasAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleMayAliasAttr() argument
1660 D->addAttr(::new (S.Context) MayAliasAttr(Attr.getRange(), S.Context)); in handleMayAliasAttr()
1663 static void handleNoCommonAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNoCommonAttr() argument
1665 if (isa<VarDecl>(D)) in handleNoCommonAttr()
1666 D->addAttr(::new (S.Context) NoCommonAttr(Attr.getRange(), S.Context)); in handleNoCommonAttr()
1672 static void handleCommonAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleCommonAttr() argument
1674 if (isa<VarDecl>(D)) in handleCommonAttr()
1675 D->addAttr(::new (S.Context) CommonAttr(Attr.getRange(), S.Context)); in handleCommonAttr()
1681 static void handleNoReturnAttr(Sema &S, Decl *D, const AttributeList &attr) { in handleNoReturnAttr() argument
1682 if (hasDeclarator(D)) return; in handleNoReturnAttr()
1686 if (!isa<ObjCMethodDecl>(D)) { in handleNoReturnAttr()
1692 D->addAttr(::new (S.Context) NoReturnAttr(attr.getRange(), S.Context)); in handleNoReturnAttr()
1705 static void handleAnalyzerNoReturnAttr(Sema &S, Decl *D, in handleAnalyzerNoReturnAttr() argument
1714 if (!isFunctionOrMethod(D) && !isa<BlockDecl>(D)) { in handleAnalyzerNoReturnAttr()
1715 ValueDecl *VD = dyn_cast<ValueDecl>(D); in handleAnalyzerNoReturnAttr()
1726 D->addAttr(::new (S.Context) AnalyzerNoReturnAttr(Attr.getRange(), S.Context)); in handleAnalyzerNoReturnAttr()
1730 static void handleVecReturnAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleVecReturnAttr() argument
1754 if (!isa<RecordDecl>(D)) { in handleVecReturnAttr()
1760 if (D->getAttr<VecReturnAttr>()) { in handleVecReturnAttr()
1765 RecordDecl *record = cast<RecordDecl>(D); in handleVecReturnAttr()
1787 D->addAttr(::new (S.Context) VecReturnAttr(Attr.getRange(), S.Context)); in handleVecReturnAttr()
1790 static void handleDependencyAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleDependencyAttr() argument
1791 if (!isFunctionOrMethod(D) && !isa<ParmVarDecl>(D)) { in handleDependencyAttr()
1799 static void handleUnusedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleUnusedAttr() argument
1806 if (!isa<VarDecl>(D) && !isa<ObjCIvarDecl>(D) && !isFunctionOrMethod(D) && in handleUnusedAttr()
1807 !isa<TypeDecl>(D) && !isa<LabelDecl>(D) && !isa<FieldDecl>(D)) { in handleUnusedAttr()
1813 D->addAttr(::new (S.Context) UnusedAttr(Attr.getRange(), S.Context)); in handleUnusedAttr()
1816 static void handleReturnsTwiceAttr(Sema &S, Decl *D, in handleReturnsTwiceAttr() argument
1824 if (!isa<FunctionDecl>(D)) { in handleReturnsTwiceAttr()
1830 D->addAttr(::new (S.Context) ReturnsTwiceAttr(Attr.getRange(), S.Context)); in handleReturnsTwiceAttr()
1833 static void handleUsedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleUsedAttr() argument
1840 if (const VarDecl *VD = dyn_cast<VarDecl>(D)) { in handleUsedAttr()
1845 } else if (!isFunctionOrMethod(D)) { in handleUsedAttr()
1851 D->addAttr(::new (S.Context) UsedAttr(Attr.getRange(), S.Context)); in handleUsedAttr()
1854 static void handleConstructorAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleConstructorAttr() argument
1874 if (!isa<FunctionDecl>(D)) { in handleConstructorAttr()
1880 D->addAttr(::new (S.Context) ConstructorAttr(Attr.getRange(), S.Context, in handleConstructorAttr()
1884 static void handleDestructorAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleDestructorAttr() argument
1904 if (!isa<FunctionDecl>(D)) { in handleDestructorAttr()
1910 D->addAttr(::new (S.Context) DestructorAttr(Attr.getRange(), S.Context, in handleDestructorAttr()
1915 static void handleAttrWithMessage(Sema &S, Decl *D, const AttributeList &Attr, in handleAttrWithMessage() argument
1935 D->addAttr(::new (S.Context) AttrTy(Attr.getRange(), S.Context, Str)); in handleAttrWithMessage()
1938 static void handleArcWeakrefUnavailableAttr(Sema &S, Decl *D, in handleArcWeakrefUnavailableAttr() argument
1946 D->addAttr(::new (S.Context) ArcWeakrefUnavailableAttr( in handleArcWeakrefUnavailableAttr()
1950 static void handleObjCRootClassAttr(Sema &S, Decl *D, in handleObjCRootClassAttr() argument
1952 if (!isa<ObjCInterfaceDecl>(D)) { in handleObjCRootClassAttr()
1963 D->addAttr(::new (S.Context) ObjCRootClassAttr(Attr.getRange(), S.Context)); in handleObjCRootClassAttr()
1966 static void handleObjCRequiresPropertyDefsAttr(Sema &S, Decl *D, in handleObjCRequiresPropertyDefsAttr() argument
1968 if (!isa<ObjCInterfaceDecl>(D)) { in handleObjCRequiresPropertyDefsAttr()
1979 D->addAttr(::new (S.Context) ObjCRequiresPropertyDefsAttr( in handleObjCRequiresPropertyDefsAttr()
2022 AvailabilityAttr *Sema::mergeAvailabilityAttr(Decl *D, SourceRange Range, in mergeAvailabilityAttr() argument
2034 if (D->hasAttrs()) { in mergeAvailabilityAttr()
2035 AttrVec &Attrs = D->getAttrs(); in mergeAvailabilityAttr()
2112 static void handleAvailabilityAttr(Sema &S, Decl *D, in handleAvailabilityAttr() argument
2131 AvailabilityAttr *NewAttr = S.mergeAvailabilityAttr(D, Attr.getRange(), in handleAvailabilityAttr()
2138 D->addAttr(NewAttr); in handleAvailabilityAttr()
2141 VisibilityAttr *Sema::mergeVisibilityAttr(Decl *D, SourceRange Range, in mergeVisibilityAttr() argument
2143 if (isa<TypedefNameDecl>(D)) { in mergeVisibilityAttr()
2147 VisibilityAttr *ExistingAttr = D->getAttr<VisibilityAttr>(); in mergeVisibilityAttr()
2154 D->dropAttr<VisibilityAttr>(); in mergeVisibilityAttr()
2159 static void handleVisibilityAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleVisibilityAttr() argument
2197 VisibilityAttr *NewAttr = S.mergeVisibilityAttr(D, Attr.getRange(), type); in handleVisibilityAttr()
2199 D->addAttr(NewAttr); in handleVisibilityAttr()
2255 static void handleObjCExceptionAttr(Sema &S, Decl *D, in handleObjCExceptionAttr() argument
2260 ObjCInterfaceDecl *OCI = dyn_cast<ObjCInterfaceDecl>(D); in handleObjCExceptionAttr()
2266 D->addAttr(::new (S.Context) ObjCExceptionAttr(Attr.getRange(), S.Context)); in handleObjCExceptionAttr()
2269 static void handleObjCNSObject(Sema &S, Decl *D, const AttributeList &Attr) { in handleObjCNSObject() argument
2274 if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D)) { in handleObjCNSObject()
2281 else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) { in handleObjCNSObject()
2295 S.Diag(D->getLocation(), diag::warn_nsobject_attribute); in handleObjCNSObject()
2297 D->addAttr(::new (S.Context) ObjCNSObjectAttr(Attr.getRange(), S.Context)); in handleObjCNSObject()
2301 handleOverloadableAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleOverloadableAttr() argument
2307 if (!isa<FunctionDecl>(D)) { in handleOverloadableAttr()
2312 D->addAttr(::new (S.Context) OverloadableAttr(Attr.getRange(), S.Context)); in handleOverloadableAttr()
2315 static void handleBlocksAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleBlocksAttr() argument
2336 D->addAttr(::new (S.Context) BlocksAttr(Attr.getRange(), S.Context, type)); in handleBlocksAttr()
2339 static void handleSentinelAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleSentinelAttr() argument
2387 if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { in handleSentinelAttr()
2398 } else if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) { in handleSentinelAttr()
2403 } else if (BlockDecl *BD = dyn_cast<BlockDecl>(D)) { in handleSentinelAttr()
2408 } else if (const VarDecl *V = dyn_cast<VarDecl>(D)) { in handleSentinelAttr()
2411 const FunctionType *FT = Ty->isFunctionPointerType() ? getFunctionType(D) in handleSentinelAttr()
2428 D->addAttr(::new (S.Context) SentinelAttr(Attr.getRange(), S.Context, sentinel, in handleSentinelAttr()
2432 static void handleWarnUnusedResult(Sema &S, Decl *D, const AttributeList &Attr) { in handleWarnUnusedResult() argument
2437 if (!isFunction(D) && !isa<ObjCMethodDecl>(D)) { in handleWarnUnusedResult()
2443 if (isFunction(D) && getFunctionType(D)->getResultType()->isVoidType()) { in handleWarnUnusedResult()
2448 if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) in handleWarnUnusedResult()
2455 D->addAttr(::new (S.Context) WarnUnusedResultAttr(Attr.getRange(), S.Context)); in handleWarnUnusedResult()
2458 static void handleWeakAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleWeakAttr() argument
2465 if (!isa<VarDecl>(D) && !isa<FunctionDecl>(D)) { in handleWeakAttr()
2466 if (isa<CXXRecordDecl>(D)) { in handleWeakAttr()
2467 D->addAttr(::new (S.Context) WeakAttr(Attr.getRange(), S.Context)); in handleWeakAttr()
2475 NamedDecl *nd = cast<NamedDecl>(D); in handleWeakAttr()
2486 static void handleWeakImportAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleWeakImportAttr() argument
2494 if (!D->canBeWeakImported(isDef)) { in handleWeakImportAttr()
2499 else if (isa<ObjCPropertyDecl>(D) || isa<ObjCMethodDecl>(D) || in handleWeakImportAttr()
2501 (isa<ObjCInterfaceDecl>(D) || isa<EnumDecl>(D)))) { in handleWeakImportAttr()
2510 D->addAttr(::new (S.Context) WeakImportAttr(Attr.getRange(), S.Context)); in handleWeakImportAttr()
2514 static void handleWorkGroupSize(Sema &S, Decl *D, in handleWorkGroupSize() argument
2536 && D->hasAttr<ReqdWorkGroupSizeAttr>()) { in handleWorkGroupSize()
2537 ReqdWorkGroupSizeAttr *A = D->getAttr<ReqdWorkGroupSizeAttr>(); in handleWorkGroupSize()
2547 && D->hasAttr<WorkGroupSizeHintAttr>()) { in handleWorkGroupSize()
2548 WorkGroupSizeHintAttr *A = D->getAttr<WorkGroupSizeHintAttr>(); in handleWorkGroupSize()
2558 D->addAttr(::new (S.Context) in handleWorkGroupSize()
2562 D->addAttr(::new (S.Context) in handleWorkGroupSize()
2567 SectionAttr *Sema::mergeSectionAttr(Decl *D, SourceRange Range, in mergeSectionAttr() argument
2569 if (SectionAttr *ExistingAttr = D->getAttr<SectionAttr>()) { in mergeSectionAttr()
2579 static void handleSectionAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleSectionAttr() argument
2602 if (isa<VarDecl>(D) && cast<VarDecl>(D)->hasLocalStorage()) { in handleSectionAttr()
2606 SectionAttr *NewAttr = S.mergeSectionAttr(D, Attr.getRange(), in handleSectionAttr()
2609 D->addAttr(NewAttr); in handleSectionAttr()
2613 static void handleNothrowAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNothrowAttr() argument
2620 if (NoThrowAttr *Existing = D->getAttr<NoThrowAttr>()) { in handleNothrowAttr()
2624 D->addAttr(::new (S.Context) NoThrowAttr(Attr.getRange(), S.Context)); in handleNothrowAttr()
2628 static void handleConstAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleConstAttr() argument
2635 if (ConstAttr *Existing = D->getAttr<ConstAttr>()) { in handleConstAttr()
2639 D->addAttr(::new (S.Context) ConstAttr(Attr.getRange(), S.Context)); in handleConstAttr()
2643 static void handlePureAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handlePureAttr() argument
2648 D->addAttr(::new (S.Context) PureAttr(Attr.getRange(), S.Context)); in handlePureAttr()
2651 static void handleCleanupAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleCleanupAttr() argument
2662 VarDecl *VD = dyn_cast<VarDecl>(D); in handleCleanupAttr()
2707 D->addAttr(::new (S.Context) CleanupAttr(Attr.getRange(), S.Context, FD)); in handleCleanupAttr()
2713 static void handleFormatArgAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleFormatArgAttr() argument
2717 if (!isFunctionOrMethod(D) || !hasFunctionProto(D)) { in handleFormatArgAttr()
2725 bool HasImplicitThisParam = isInstanceMethod(D); in handleFormatArgAttr()
2726 unsigned NumArgs = getFunctionOrMethodNumArgs(D) + HasImplicitThisParam; in handleFormatArgAttr()
2757 QualType Ty = getFunctionOrMethodArgType(D, ArgIdx); in handleFormatArgAttr()
2770 Ty = getFunctionOrMethodResultType(D); in handleFormatArgAttr()
2782 D->addAttr(::new (S.Context) FormatArgAttr(Attr.getRange(), S.Context, in handleFormatArgAttr()
2815 static void handleInitPriorityAttr(Sema &S, Decl *D, in handleInitPriorityAttr() argument
2822 if (!isa<VarDecl>(D) || S.getCurFunctionOrMethodDecl()) { in handleInitPriorityAttr()
2827 QualType T = dyn_cast<VarDecl>(D)->getType(); in handleInitPriorityAttr()
2858 D->addAttr(::new (S.Context) InitPriorityAttr(Attr.getRange(), S.Context, in handleInitPriorityAttr()
2862 FormatAttr *Sema::mergeFormatAttr(Decl *D, SourceRange Range, StringRef Format, in mergeFormatAttr() argument
2866 i = D->specific_attr_begin<FormatAttr>(), in mergeFormatAttr()
2867 e = D->specific_attr_end<FormatAttr>(); in mergeFormatAttr()
2887 static void handleFormatAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleFormatAttr() argument
2900 if (!isFunctionOrMethodOrBlock(D) || !hasFunctionProto(D)) { in handleFormatAttr()
2908 bool HasImplicitThisParam = isInstanceMethod(D); in handleFormatAttr()
2909 unsigned NumArgs = getFunctionOrMethodNumArgs(D) + HasImplicitThisParam; in handleFormatAttr()
2960 QualType Ty = getFunctionOrMethodArgType(D, ArgIdx); in handleFormatAttr()
2997 if (isFunctionOrMethodVariadic(D)) { in handleFormatAttr()
3000 S.Diag(D->getLocation(), diag::err_format_attribute_requires_variadic); in handleFormatAttr()
3020 FormatAttr *NewAttr = S.mergeFormatAttr(D, Attr.getRange(), Format, in handleFormatAttr()
3024 D->addAttr(NewAttr); in handleFormatAttr()
3027 static void handleTransparentUnionAttr(Sema &S, Decl *D, in handleTransparentUnionAttr() argument
3036 TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D); in handleTransparentUnionAttr()
3040 RD = dyn_cast<RecordDecl>(D); in handleTransparentUnionAttr()
3094 static void handleAnnotateAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleAnnotateAttr() argument
3111 i = D->specific_attr_begin<AnnotateAttr>(), in handleAnnotateAttr()
3112 e = D->specific_attr_end<AnnotateAttr>(); i != e; ++i) { in handleAnnotateAttr()
3116 D->addAttr(::new (S.Context) AnnotateAttr(Attr.getRange(), S.Context, in handleAnnotateAttr()
3120 static void handleAlignedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleAlignedAttr() argument
3132 D->addAttr(::new (S.Context) AlignedAttr(Attr.getRange(), S.Context, in handleAlignedAttr()
3137 S.AddAlignedAttr(Attr.getRange(), D, Attr.getArg(0), in handleAlignedAttr()
3141 void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, in AddAlignedAttr() argument
3149 D->addAttr(::new (Context) AlignedAttr(AttrRange, Context, true, E, in AddAlignedAttr()
3178 D->addAttr(::new (Context) AlignedAttr(AttrRange, Context, true, ICE.take(), in AddAlignedAttr()
3182 void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *TS, in AddAlignedAttr() argument
3186 D->addAttr(::new (Context) AlignedAttr(AttrRange, Context, false, TS, in AddAlignedAttr()
3197 static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleModeAttr() argument
3255 if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D)) in handleModeAttr()
3257 else if (ValueDecl *VD = dyn_cast<ValueDecl>(D)) in handleModeAttr()
3260 S.Diag(D->getLocation(), diag::err_attr_wrong_decl) in handleModeAttr()
3354 if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D)) { in handleModeAttr()
3358 cast<ValueDecl>(D)->setType(NewTy); in handleModeAttr()
3361 static void handleNoDebugAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNoDebugAttr() argument
3366 if (const VarDecl *VD = dyn_cast<VarDecl>(D)) { in handleNoDebugAttr()
3371 } else if (!isFunctionOrMethod(D)) { in handleNoDebugAttr()
3378 D->addAttr(::new (S.Context) NoDebugAttr(Attr.getRange(), S.Context)); in handleNoDebugAttr()
3381 static void handleNoInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNoInlineAttr() argument
3387 if (!isa<FunctionDecl>(D)) { in handleNoInlineAttr()
3393 D->addAttr(::new (S.Context) NoInlineAttr(Attr.getRange(), S.Context)); in handleNoInlineAttr()
3396 static void handleNoInstrumentFunctionAttr(Sema &S, Decl *D, in handleNoInstrumentFunctionAttr() argument
3403 if (!isa<FunctionDecl>(D)) { in handleNoInstrumentFunctionAttr()
3409 D->addAttr(::new (S.Context) NoInstrumentFunctionAttr(Attr.getRange(), in handleNoInstrumentFunctionAttr()
3413 static void handleKernelAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleKernelAttr() argument
3415 D->addAttr(::new (S.Context) KernelAttr(Attr.getRange(), S.Context)); in handleKernelAttr()
3421 static void handleConstantAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleConstantAttr() argument
3429 if (!isa<VarDecl>(D)) { in handleConstantAttr()
3435 D->addAttr(::new (S.Context) CUDAConstantAttr(Attr.getRange(), S.Context)); in handleConstantAttr()
3441 static void handleDeviceAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleDeviceAttr() argument
3449 if (!isa<FunctionDecl>(D) && !isa<VarDecl>(D)) { in handleDeviceAttr()
3455 D->addAttr(::new (S.Context) CUDADeviceAttr(Attr.getRange(), S.Context)); in handleDeviceAttr()
3461 static void handleGlobalAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleGlobalAttr() argument
3467 if (!isa<FunctionDecl>(D)) { in handleGlobalAttr()
3473 FunctionDecl *FD = cast<FunctionDecl>(D); in handleGlobalAttr()
3488 D->addAttr(::new (S.Context) CUDAGlobalAttr(Attr.getRange(), S.Context)); in handleGlobalAttr()
3494 static void handleHostAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleHostAttr() argument
3501 if (!isa<FunctionDecl>(D)) { in handleHostAttr()
3507 D->addAttr(::new (S.Context) CUDAHostAttr(Attr.getRange(), S.Context)); in handleHostAttr()
3513 static void handleSharedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleSharedAttr() argument
3520 if (!isa<VarDecl>(D)) { in handleSharedAttr()
3526 D->addAttr(::new (S.Context) CUDASharedAttr(Attr.getRange(), S.Context)); in handleSharedAttr()
3532 static void handleGNUInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleGNUInlineAttr() argument
3537 FunctionDecl *Fn = dyn_cast<FunctionDecl>(D); in handleGNUInlineAttr()
3549 D->addAttr(::new (S.Context) GNUInlineAttr(Attr.getRange(), S.Context)); in handleGNUInlineAttr()
3552 static void handleCallConvAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleCallConvAttr() argument
3553 if (hasDeclarator(D)) return; in handleCallConvAttr()
3561 if (!isa<ObjCMethodDecl>(D)) { in handleCallConvAttr()
3569 D->addAttr(::new (S.Context) FastCallAttr(Attr.getRange(), S.Context)); in handleCallConvAttr()
3572 D->addAttr(::new (S.Context) StdCallAttr(Attr.getRange(), S.Context)); in handleCallConvAttr()
3575 D->addAttr(::new (S.Context) ThisCallAttr(Attr.getRange(), S.Context)); in handleCallConvAttr()
3578 D->addAttr(::new (S.Context) CDeclAttr(Attr.getRange(), S.Context)); in handleCallConvAttr()
3581 D->addAttr(::new (S.Context) PascalAttr(Attr.getRange(), S.Context)); in handleCallConvAttr()
3596 D->addAttr(::new (S.Context) PcsAttr(Attr.getRange(), S.Context, PCS)); in handleCallConvAttr()
3603 static void handleOpenCLKernelAttr(Sema &S, Decl *D, const AttributeList &Attr){ in handleOpenCLKernelAttr() argument
3605 D->addAttr(::new (S.Context) OpenCLKernelAttr(Attr.getRange(), S.Context)); in handleOpenCLKernelAttr()
3656 static void handleRegparmAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleRegparmAttr() argument
3657 if (hasDeclarator(D)) return; in handleRegparmAttr()
3663 if (!isa<ObjCMethodDecl>(D)) { in handleRegparmAttr()
3669 D->addAttr(::new (S.Context) RegparmAttr(Attr.getRange(), S.Context, numParams)); in handleRegparmAttr()
3712 static void handleLaunchBoundsAttr(Sema &S, Decl *D, const AttributeList &Attr){ in handleLaunchBoundsAttr() argument
3721 if (!isFunctionOrMethod(D)) { in handleLaunchBoundsAttr()
3749 D->addAttr(::new (S.Context) CUDALaunchBoundsAttr(Attr.getRange(), S.Context, in handleLaunchBoundsAttr()
3757 static void handleArgumentWithTypeTagAttr(Sema &S, Decl *D, in handleArgumentWithTypeTagAttr() argument
3774 if (!isFunctionOrMethod(D) || !hasFunctionProto(D)) { in handleArgumentWithTypeTagAttr()
3781 if (!checkFunctionOrMethodArgumentIndex(S, D, AttrName, in handleArgumentWithTypeTagAttr()
3787 if (!checkFunctionOrMethodArgumentIndex(S, D, AttrName, in handleArgumentWithTypeTagAttr()
3795 QualType BufferTy = getFunctionOrMethodArgType(D, ArgumentIdx); in handleArgumentWithTypeTagAttr()
3802 D->addAttr(::new (S.Context) ArgumentWithTypeTagAttr(Attr.getRange(), in handleArgumentWithTypeTagAttr()
3810 static void handleTypeTagForDatatypeAttr(Sema &S, Decl *D, in handleTypeTagForDatatypeAttr() argument
3821 D->addAttr(::new (S.Context) TypeTagForDatatypeAttr( in handleTypeTagForDatatypeAttr()
3845 static void handleNSConsumedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNSConsumedAttr() argument
3846 ParmVarDecl *param = dyn_cast<ParmVarDecl>(D); in handleNSConsumedAttr()
3848 S.Diag(D->getLocStart(), diag::warn_attribute_wrong_decl_type) in handleNSConsumedAttr()
3863 S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_parameter_type) in handleNSConsumedAttr()
3874 static void handleNSConsumesSelfAttr(Sema &S, Decl *D, in handleNSConsumesSelfAttr() argument
3876 if (!isa<ObjCMethodDecl>(D)) { in handleNSConsumesSelfAttr()
3877 S.Diag(D->getLocStart(), diag::warn_attribute_wrong_decl_type) in handleNSConsumesSelfAttr()
3882 D->addAttr(::new (S.Context) NSConsumesSelfAttr(Attr.getRange(), S.Context)); in handleNSConsumesSelfAttr()
3885 static void handleNSReturnsRetainedAttr(Sema &S, Decl *D, in handleNSReturnsRetainedAttr() argument
3890 if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) in handleNSReturnsRetainedAttr()
3892 else if (S.getLangOpts().ObjCAutoRefCount && hasDeclarator(D) && in handleNSReturnsRetainedAttr()
3895 else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) in handleNSReturnsRetainedAttr()
3897 else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) in handleNSReturnsRetainedAttr()
3900 S.Diag(D->getLocStart(), diag::warn_attribute_wrong_decl_type) in handleNSReturnsRetainedAttr()
3925 S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_return_type) in handleNSReturnsRetainedAttr()
3926 << Attr.getRange() << Attr.getName() << isa<ObjCMethodDecl>(D) << cf; in handleNSReturnsRetainedAttr()
3934 D->addAttr(::new (S.Context) NSReturnsAutoreleasedAttr(Attr.getRange(), in handleNSReturnsRetainedAttr()
3938 D->addAttr(::new (S.Context) CFReturnsNotRetainedAttr(Attr.getRange(), in handleNSReturnsRetainedAttr()
3942 D->addAttr(::new (S.Context) NSReturnsNotRetainedAttr(Attr.getRange(), in handleNSReturnsRetainedAttr()
3946 D->addAttr(::new (S.Context) CFReturnsRetainedAttr(Attr.getRange(), in handleNSReturnsRetainedAttr()
3950 D->addAttr(::new (S.Context) NSReturnsRetainedAttr(Attr.getRange(), in handleNSReturnsRetainedAttr()
3956 static void handleObjCReturnsInnerPointerAttr(Sema &S, Decl *D, in handleObjCReturnsInnerPointerAttr() argument
3960 ObjCMethodDecl *method = dyn_cast<ObjCMethodDecl>(D); in handleObjCReturnsInnerPointerAttr()
3963 S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) in handleObjCReturnsInnerPointerAttr()
3985 static void handleObjCRequiresSuperAttr(Sema &S, Decl *D, in handleObjCRequiresSuperAttr() argument
3988 ObjCMethodDecl *method = dyn_cast<ObjCMethodDecl>(D); in handleObjCRequiresSuperAttr()
3991 S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) in handleObjCRequiresSuperAttr()
3997 S.Diag(D->getLocStart(), diag::warn_objc_requires_super_protocol) in handleObjCRequiresSuperAttr()
4003 S.Diag(D->getLocStart(), diag::warn_objc_requires_super_protocol) in handleObjCRequiresSuperAttr()
4013 static void handleCFTransferAttr(Sema &S, Decl *D, const AttributeList &A) { in handleCFTransferAttr() argument
4014 if (!isa<FunctionDecl>(D)) { in handleCFTransferAttr()
4015 S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) in handleCFTransferAttr()
4025 Existing = D->getAttr<CFUnknownTransferAttr>(); in handleCFTransferAttr()
4027 Existing = D->getAttr<CFAuditedTransferAttr>(); in handleCFTransferAttr()
4030 S.Diag(D->getLocStart(), diag::err_attributes_are_not_compatible) in handleCFTransferAttr()
4039 D->addAttr( in handleCFTransferAttr()
4042 D->addAttr( in handleCFTransferAttr()
4047 static void handleNSBridgedAttr(Sema &S, Scope *Sc, Decl *D, in handleNSBridgedAttr() argument
4049 RecordDecl *RD = dyn_cast<RecordDecl>(D); in handleNSBridgedAttr()
4051 S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) in handleNSBridgedAttr()
4067 S.Diag(D->getLocStart(), diag::err_ns_bridged_not_interface); in handleNSBridgedAttr()
4073 D->addAttr(::new (S.Context) NSBridgedAttr(Attr.getRange(), S.Context, in handleNSBridgedAttr()
4077 static void handleObjCOwnershipAttr(Sema &S, Decl *D, in handleObjCOwnershipAttr() argument
4079 if (hasDeclarator(D)) return; in handleObjCOwnershipAttr()
4081 S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) in handleObjCOwnershipAttr()
4085 static void handleObjCPreciseLifetimeAttr(Sema &S, Decl *D, in handleObjCPreciseLifetimeAttr() argument
4087 if (!isa<VarDecl>(D) && !isa<FieldDecl>(D)) { in handleObjCPreciseLifetimeAttr()
4088 S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) in handleObjCPreciseLifetimeAttr()
4093 ValueDecl *vd = cast<ValueDecl>(D); in handleObjCPreciseLifetimeAttr()
4127 D->addAttr(::new (S.Context) in handleObjCPreciseLifetimeAttr()
4135 static void handleUuidAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleUuidAttr() argument
4183 D->addAttr(::new (S.Context) UuidAttr(Attr.getRange(), S.Context, in handleUuidAttr()
4189 static void handleInheritanceAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleInheritanceAttr() argument
4193 D->addAttr( in handleInheritanceAttr()
4196 D->addAttr( in handleInheritanceAttr()
4199 D->addAttr( in handleInheritanceAttr()
4205 static void handlePortabilityAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handlePortabilityAttr() argument
4209 D->addAttr( in handlePortabilityAttr()
4212 D->addAttr( in handlePortabilityAttr()
4215 D->addAttr( in handlePortabilityAttr()
4221 static void handleForceInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleForceInlineAttr() argument
4223 D->addAttr(::new (S.Context) ForceInlineAttr(Attr.getRange(), S.Context)); in handleForceInlineAttr()
4232 static void ProcessNonInheritableDeclAttr(Sema &S, Scope *scope, Decl *D, in ProcessNonInheritableDeclAttr() argument
4235 case AttributeList::AT_CUDADevice: handleDeviceAttr (S, D, Attr); break; in ProcessNonInheritableDeclAttr()
4236 case AttributeList::AT_CUDAHost: handleHostAttr (S, D, Attr); break; in ProcessNonInheritableDeclAttr()
4237 case AttributeList::AT_Overloadable:handleOverloadableAttr(S, D, Attr); break; in ProcessNonInheritableDeclAttr()
4238 case AttributeList::AT_Kernel: handleKernelAttr (S, D, Attr); break; in ProcessNonInheritableDeclAttr()
4244 static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D, in ProcessInheritableDeclAttr() argument
4247 case AttributeList::AT_IBAction: handleIBAction(S, D, Attr); break; in ProcessInheritableDeclAttr()
4248 case AttributeList::AT_IBOutlet: handleIBOutlet(S, D, Attr); break; in ProcessInheritableDeclAttr()
4250 handleIBOutletCollection(S, D, Attr); break; in ProcessInheritableDeclAttr()
4267 case AttributeList::AT_Alias: handleAliasAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4268 case AttributeList::AT_Aligned: handleAlignedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4269 case AttributeList::AT_AllocSize: handleAllocSizeAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4271 handleAlwaysInlineAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4273 handleAnalyzerNoReturnAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4274 case AttributeList::AT_TLSModel: handleTLSModelAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4275 case AttributeList::AT_Annotate: handleAnnotateAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4276 case AttributeList::AT_Availability:handleAvailabilityAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
4278 handleDependencyAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4279 case AttributeList::AT_Common: handleCommonAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4280 case AttributeList::AT_CUDAConstant:handleConstantAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4281 case AttributeList::AT_Constructor: handleConstructorAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4283 handleAttrWithMessage<DeprecatedAttr>(S, D, Attr, "deprecated"); in ProcessInheritableDeclAttr()
4285 case AttributeList::AT_Destructor: handleDestructorAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4287 handleExtVectorTypeAttr(S, scope, D, Attr); in ProcessInheritableDeclAttr()
4289 case AttributeList::AT_Format: handleFormatAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4290 case AttributeList::AT_FormatArg: handleFormatArgAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4291 case AttributeList::AT_CUDAGlobal: handleGlobalAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4292 case AttributeList::AT_GNUInline: handleGNUInlineAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4294 handleLaunchBoundsAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4296 case AttributeList::AT_Mode: handleModeAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4297 case AttributeList::AT_Malloc: handleMallocAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4298 case AttributeList::AT_MayAlias: handleMayAliasAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4299 case AttributeList::AT_NoCommon: handleNoCommonAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4300 case AttributeList::AT_NonNull: handleNonNullAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4304 handleOwnershipAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4305 case AttributeList::AT_Cold: handleColdAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4306 case AttributeList::AT_Hot: handleHotAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4307 case AttributeList::AT_Naked: handleNakedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4308 case AttributeList::AT_NoReturn: handleNoReturnAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4309 case AttributeList::AT_NoThrow: handleNothrowAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4310 case AttributeList::AT_CUDAShared: handleSharedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4311 case AttributeList::AT_VecReturn: handleVecReturnAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4314 handleObjCOwnershipAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
4316 handleObjCPreciseLifetimeAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
4319 handleObjCReturnsInnerPointerAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
4322 handleObjCRequiresSuperAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
4325 handleNSBridgedAttr(S, scope, D, Attr); break; in ProcessInheritableDeclAttr()
4329 handleCFTransferAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
4333 case AttributeList::AT_NSConsumed: handleNSConsumedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4335 handleNSConsumesSelfAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
4342 handleNSReturnsRetainedAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
4346 handleWorkGroupSize(S, D, Attr); break; in ProcessInheritableDeclAttr()
4349 handleInitPriorityAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
4351 case AttributeList::AT_Packed: handlePackedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4352 case AttributeList::AT_Section: handleSectionAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4354 handleAttrWithMessage<UnavailableAttr>(S, D, Attr, "unavailable"); in ProcessInheritableDeclAttr()
4357 handleArcWeakrefUnavailableAttr (S, D, Attr); in ProcessInheritableDeclAttr()
4360 handleObjCRootClassAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4363 handleObjCRequiresPropertyDefsAttr (S, D, Attr); in ProcessInheritableDeclAttr()
4365 case AttributeList::AT_Unused: handleUnusedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4367 handleReturnsTwiceAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4369 case AttributeList::AT_Used: handleUsedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4370 case AttributeList::AT_Visibility: handleVisibilityAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4371 case AttributeList::AT_WarnUnusedResult: handleWarnUnusedResult(S, D, Attr); in ProcessInheritableDeclAttr()
4373 case AttributeList::AT_Weak: handleWeakAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4374 case AttributeList::AT_WeakRef: handleWeakRefAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4375 case AttributeList::AT_WeakImport: handleWeakImportAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4377 handleTransparentUnionAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4380 handleObjCExceptionAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4383 handleObjCMethodFamilyAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4385 case AttributeList::AT_ObjCNSObject:handleObjCNSObject (S, D, Attr); break; in ProcessInheritableDeclAttr()
4386 case AttributeList::AT_Blocks: handleBlocksAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4387 case AttributeList::AT_Sentinel: handleSentinelAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4388 case AttributeList::AT_Const: handleConstAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4389 case AttributeList::AT_Pure: handlePureAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4390 case AttributeList::AT_Cleanup: handleCleanupAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4391 case AttributeList::AT_NoDebug: handleNoDebugAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4392 case AttributeList::AT_NoInline: handleNoInlineAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4393 case AttributeList::AT_Regparm: handleRegparmAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
4398 handleNoInstrumentFunctionAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4406 handleCallConvAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4409 handleOpenCLKernelAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4414 handleMsStructAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4417 handleUuidAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4422 handleInheritanceAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4427 handlePortabilityAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4430 handleForceInlineAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4435 handleGuardedVarAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4438 handlePtGuardedVarAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4441 handleScopedLockableAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4444 handleNoAddressSafetyAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4447 handleNoThreadSafetyAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4450 handleLockableAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4453 handleGuardedByAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4456 handlePtGuardedByAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4459 handleExclusiveLockFunctionAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4462 handleExclusiveLocksRequiredAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4465 handleExclusiveTrylockFunctionAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4468 handleLockReturnedAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4471 handleLocksExcludedAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4474 handleSharedLockFunctionAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4477 handleSharedLocksRequiredAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4480 handleSharedTrylockFunctionAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4483 handleUnlockFunAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4486 handleAcquiredBeforeAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4489 handleAcquiredAfterAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4494 handleArgumentWithTypeTagAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4497 handleTypeTagForDatatypeAttr(S, D, Attr); in ProcessInheritableDeclAttr()
4503 if (!TargetAttrs.ProcessDeclAttribute(scope, D, Attr, S)) in ProcessInheritableDeclAttr()
4515 static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, in ProcessDeclAttribute() argument
4529 ProcessNonInheritableDeclAttr(S, scope, D, Attr); in ProcessDeclAttribute()
4532 ProcessInheritableDeclAttr(S, scope, D, Attr); in ProcessDeclAttribute()
4537 void Sema::ProcessDeclAttributeList(Scope *S, Decl *D, in ProcessDeclAttributeList() argument
4541 ProcessDeclAttribute(*this, S, D, *l, NonInheritable, Inheritable); in ProcessDeclAttributeList()
4547 if (Inheritable && D->hasAttr<WeakRefAttr>() && !D->hasAttr<AliasAttr>()) { in ProcessDeclAttributeList()
4549 dyn_cast<NamedDecl>(D)->getNameAsString(); in ProcessDeclAttributeList()
4591 void Sema::checkUnusedDeclAttributes(Declarator &D) { in checkUnusedDeclAttributes() argument
4592 ::checkUnusedDeclAttributes(*this, D.getDeclSpec().getAttributes().getList()); in checkUnusedDeclAttributes()
4593 ::checkUnusedDeclAttributes(*this, D.getAttributes()); in checkUnusedDeclAttributes()
4594 for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) in checkUnusedDeclAttributes()
4595 ::checkUnusedDeclAttributes(*this, D.getTypeObject(i).getAttrs()); in checkUnusedDeclAttributes()
4675 void Sema::ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD, in ProcessDeclAttributes() argument
4682 if (NamedDecl *ND = dyn_cast<NamedDecl>(D)) { in ProcessDeclAttributes()
4698 ProcessDeclAttributeList(S, D, Attrs, NonInheritable, Inheritable); in ProcessDeclAttributes()
4706 ProcessDeclAttributeList(S, D, Attrs, NonInheritable, Inheritable); in ProcessDeclAttributes()
4710 ProcessDeclAttributeList(S, D, Attrs, NonInheritable, Inheritable); in ProcessDeclAttributes()
4806 static bool isDeclDeprecated(Decl *D) { in isDeclDeprecated() argument
4808 if (D->isDeprecated()) in isDeclDeprecated()
4811 if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(D)) in isDeclDeprecated()
4813 } while ((D = cast_or_null<Decl>(D->getDeclContext()))); in isDeclDeprecated()
4818 DoEmitDeprecationWarning(Sema &S, const NamedDecl *D, StringRef Message, in DoEmitDeprecationWarning() argument
4821 DeclarationName Name = D->getDeclName(); in DoEmitDeprecationWarning()
4824 S.Diag(D->getLocation(), in DoEmitDeprecationWarning()
4825 isa<ObjCMethodDecl>(D) ? diag::note_method_declared_at in DoEmitDeprecationWarning()
4828 S.Diag(Loc, diag::warn_deprecated) << D->getDeclName(); in DoEmitDeprecationWarning()
4829 S.Diag(D->getLocation(), in DoEmitDeprecationWarning()
4830 isa<ObjCMethodDecl>(D) ? diag::note_method_declared_at in DoEmitDeprecationWarning()
4849 void Sema::EmitDeprecationWarning(NamedDecl *D, StringRef Message, in EmitDeprecationWarning() argument
4854 DelayedDiagnostics.add(DelayedDiagnostic::makeDeprecation(Loc, D, in EmitDeprecationWarning()
4863 DoEmitDeprecationWarning(*this, D, Message, Loc, UnknownObjCClass); in EmitDeprecationWarning()