forked from OSchip/llvm-project
implement support for attribute(unavailable) on objc methods.
This implements gcc/testsuite/objc.dg/method-attribute-1.m llvm-svn: 64581
This commit is contained in:
parent
8de90f0a92
commit
37959570af
|
@ -268,8 +268,12 @@ Sema::ExprResult Sema::ActOnClassMessage(
|
|||
if (!Method)
|
||||
Method = ClassDecl->lookupInstanceMethod(Sel);
|
||||
|
||||
if (Method && Method->getAttr<DeprecatedAttr>())
|
||||
Diag(receiverLoc, diag::warn_deprecated) << Method->getDeclName();
|
||||
if (Method) {
|
||||
if (Method->getAttr<DeprecatedAttr>())
|
||||
Diag(receiverLoc, diag::warn_deprecated) << Method->getDeclName();
|
||||
if (Method->getAttr<UnavailableAttr>())
|
||||
Diag(receiverLoc, diag::warn_unavailable) << Method->getDeclName();
|
||||
}
|
||||
|
||||
if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, true,
|
||||
lbrac, rbrac, returnType))
|
||||
|
@ -316,8 +320,12 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
|
|||
Method = SuperDecl->lookupInstanceMethod(Sel);
|
||||
}
|
||||
|
||||
if (Method && Method->getAttr<DeprecatedAttr>())
|
||||
Diag(receiverLoc, diag::warn_deprecated) << Method->getDeclName();
|
||||
if (Method) {
|
||||
if (Method->getAttr<DeprecatedAttr>())
|
||||
Diag(receiverLoc, diag::warn_deprecated) << Method->getDeclName();
|
||||
if (Method->getAttr<UnavailableAttr>())
|
||||
Diag(receiverLoc, diag::warn_unavailable) << Method->getDeclName();
|
||||
}
|
||||
|
||||
if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false,
|
||||
lbrac, rbrac, returnType))
|
||||
|
@ -350,8 +358,12 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
|
|||
ObjCImplementations[ClassDecl->getIdentifier()])
|
||||
Method = ImpDecl->getClassMethod(Sel);
|
||||
|
||||
if (Method && Method->getAttr<DeprecatedAttr>())
|
||||
Diag(receiverLoc, diag::warn_deprecated) << Method->getDeclName();
|
||||
if (Method) {
|
||||
if (Method->getAttr<DeprecatedAttr>())
|
||||
Diag(receiverLoc, diag::warn_deprecated) << Method->getDeclName();
|
||||
if (Method->getAttr<UnavailableAttr>())
|
||||
Diag(receiverLoc, diag::warn_unavailable) << Method->getDeclName();
|
||||
}
|
||||
}
|
||||
if (!Method)
|
||||
Method = FactoryMethodPool[Sel].Method;
|
||||
|
@ -403,8 +415,12 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
|
|||
Diag(lbrac, diag::warn_method_not_found_in_protocol)
|
||||
<< Sel << SourceRange(lbrac, rbrac);
|
||||
|
||||
if (Method && Method->getAttr<DeprecatedAttr>())
|
||||
Diag(receiverLoc, diag::warn_deprecated) << Method->getDeclName();
|
||||
if (Method) {
|
||||
if (Method->getAttr<DeprecatedAttr>())
|
||||
Diag(receiverLoc, diag::warn_deprecated) << Method->getDeclName();
|
||||
if (Method->getAttr<UnavailableAttr>())
|
||||
Diag(receiverLoc, diag::warn_unavailable) << Method->getDeclName();
|
||||
}
|
||||
} else {
|
||||
Diag(lbrac, diag::error_bad_receiver_type)
|
||||
<< RExpr->getType() << RExpr->getSourceRange();
|
||||
|
|
Loading…
Reference in New Issue