diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-05-05 18:34:37 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-05-05 18:34:37 +0000 |
commit | 041f2fd6237c7ce72864e42c66c6b12b52f35f9c (patch) | |
tree | 099afdf370bfdfa7cf238579158650761fd01905 /lib/Sema/SemaExprObjC.cpp | |
parent | b0ed3029d96e31dfa71a61ac5aa8d04710e0fb12 (diff) |
Issue a warning in odd case of instance method used
in a 'Class' receiver which is not a root instance
method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index a463ab8f83..e8ff18ba0c 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -529,8 +529,17 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, if (!isSelfExpr(RExpr)) { Method = LookupFactoryMethodInGlobalPool(Sel, SourceRange(lbrac,rbrac)); if (!Method) { + // If no class (factory) method was found, check if an _instance_ + // method of the same name exists in the root class only. Method = LookupInstanceMethodInGlobalPool( Sel, SourceRange(lbrac,rbrac)); + if (Method) + if (const ObjCInterfaceDecl *ID = + dyn_cast<ObjCInterfaceDecl>(Method->getDeclContext())) { + if (ID->getSuperClass()) + Diag(lbrac, diag::warn_root_inst_method_not_found) + << Sel << SourceRange(lbrac, rbrac); + } } } } |