[cfe-commits] r64581 - /cfe/trunk/lib/Sema/SemaExprObjC.cpp
Chris Lattner
sabre at nondot.org
Sat Feb 14 23:50:53 PST 2009
Author: lattner
Date: Sun Feb 15 01:50:52 2009
New Revision: 64581
URL: http://llvm.org/viewvc/llvm-project?rev=64581&view=rev
Log:
implement support for attribute(unavailable) on objc methods.
This implements gcc/testsuite/objc.dg/method-attribute-1.m
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=64581&r1=64580&r2=64581&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Sun Feb 15 01:50:52 2009
@@ -268,8 +268,12 @@
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 @@
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 @@
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 @@
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();
More information about the cfe-commits
mailing list