diff options
author | Steve Naroff <snaroff@apple.com> | 2008-06-05 14:49:39 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-06-05 14:49:39 +0000 |
commit | 25449a52219ac1eeeeaa159c7d2033106e047be3 (patch) | |
tree | eb39b66e4bd443c8150bac7b9fa8dcce91ad43a1 /clang/lib/Sema/SemaExprObjC.cpp | |
parent | c775e462a81d9e1affd7e8b3de9688e5e62db1e6 (diff) | |
download | bcm5719-llvm-25449a52219ac1eeeeaa159c7d2033106e047be3.tar.gz bcm5719-llvm-25449a52219ac1eeeeaa159c7d2033106e047be3.zip |
Fix <rdar://problem/5986833> clang on xcode: incompatible type returning 'void', expected 'int'.
- Changed Sema::ObjCActOnStartOfMethodDef() to more accurately type "self" in factory methods.
- Changed Sema::ActOnInstanceMessage() to use the new type to restrict the lookup.
llvm-svn: 52005
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index e2e23ce0637..1f21ee0ec57 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -223,8 +223,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage( receiverType = RExpr->getType().getCanonicalType().getUnqualifiedType(); - if (receiverType == Context.getObjCIdType().getCanonicalType() || - receiverType == Context.getObjCClassType().getCanonicalType()) { + if (receiverType == Context.getObjCIdType().getCanonicalType()) { Method = InstanceMethodPool[Sel].Method; if (!Method) Method = FactoryMethodPool[Sel].Method; @@ -238,6 +237,29 @@ Sema::ExprResult Sema::ActOnInstanceMessage( if (CheckMessageArgumentTypes(ArgExprs, Sel.getNumArgs(), Method)) return true; } + } else if (receiverType == Context.getObjCClassType().getCanonicalType()) { + if (CurMethodDecl) { + ObjCInterfaceDecl* ClassDecl = CurMethodDecl->getClassInterface(); + // If we have an implementation in scope, check "private" methods. + if (ClassDecl) + if (ObjCImplementationDecl *ImpDecl = + ObjCImplementations[ClassDecl->getIdentifier()]) + Method = ImpDecl->getClassMethod(Sel); + } + if (!Method) + Method = FactoryMethodPool[Sel].Method; + if (!Method) + Method = InstanceMethodPool[Sel].Method; + if (!Method) { + Diag(lbrac, diag::warn_method_not_found, std::string("-"), Sel.getName(), + SourceRange(lbrac, rbrac)); + returnType = Context.getObjCIdType(); + } else { + returnType = Method->getResultType(); + if (Sel.getNumArgs()) + if (CheckMessageArgumentTypes(ArgExprs, Sel.getNumArgs(), Method)) + return true; + } } else { bool receiverIsQualId = isa<ObjCQualifiedIdType>(receiverType); // FIXME (snaroff): checking in this code from Patrick. Needs to be |