aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-05-08 23:02:36 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-05-08 23:02:36 +0000
commit89bc314c6ddf3b851ccf68bc34d3f1b5927a10f6 (patch)
treee4c2d532a55e26306ba731d632e078f4ba63a9f3 /lib/Sema/SemaExprObjC.cpp
parentb80ce0142d97905305c7d33473c1c87e8dc4665c (diff)
Warn if forward class is used as a receiver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r--lib/Sema/SemaExprObjC.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index e8ff18ba0c..3dbc2cf015 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -422,7 +422,15 @@ Sema::ExprResult Sema::ActOnClassMessage(
assert(ClassDecl && "missing interface declaration");
ObjCMethodDecl *Method = 0;
QualType returnType;
- Method = ClassDecl->lookupClassMethod(Context, Sel);
+ if (ClassDecl->isForwardDecl()) {
+ // A forward class used in messaging is tread as a 'Class'
+ Method = LookupFactoryMethodInGlobalPool(Sel, SourceRange(lbrac,rbrac));
+ if (Method)
+ Diag(lbrac, diag::warn_receiver_forward_class)
+ << ClassDecl->getDeclName();
+ }
+ if (!Method)
+ Method = ClassDecl->lookupClassMethod(Context, Sel);
// If we have an implementation in scope, check "private" methods.
if (!Method)