From: Steve Naroff Date: Mon, 5 Nov 2007 15:27:52 +0000 (+0000) Subject: Sema::ActOnClassMessage()...if a class method isn't found, lookup an instance method... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=945c0a8afc379e7b2474f3e0aff6c2314170c840;p=clang Sema::ActOnClassMessage()...if a class method isn't found, lookup an instance method. Since all classes are also instances, this is appropriate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43708 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index bc371c77d0..111ddbaaad 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -2063,6 +2063,10 @@ Sema::ExprResult Sema::ActOnClassMessage( ObjcInterfaceDecl* ClassDecl = getObjCInterfaceDecl(receiverName); ObjcMethodDecl *Method = ClassDecl->lookupClassMethod(Sel); QualType returnType; + + // Before we give up, check if the selector is an instance method. + if (!Method) + Method = ClassDecl->lookupInstanceMethod(Sel); if (!Method) { Diag(lbrac, diag::warn_method_not_found, std::string("+"), Sel.getName(), SourceRange(lbrac, rbrac));