[cfe-commits] r44041 - /cfe/trunk/Sema/SemaExpr.cpp
Steve Naroff
snaroff at apple.com
Mon Nov 12 20:10:20 PST 2007
Author: snaroff
Date: Mon Nov 12 22:10:18 2007
New Revision: 44041
URL: http://llvm.org/viewvc/llvm-project?rev=44041&view=rev
Log:
Tune the lookup logic in Sema::ActOnInstanceMessage() to handle private methods (declared within the implementation).
Modified:
cfe/trunk/Sema/SemaExpr.cpp
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=44041&r1=44040&r2=44041&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Mon Nov 12 22:10:18 2007
@@ -2139,6 +2139,23 @@
if (receiverType == Context.getObjcIdType() ||
receiverType == Context.getObjcClassType()) {
Method = InstanceMethodPool[Sel].Method;
+ // If we didn't find an public method, look for a private one.
+ if (!Method && CurMethodDecl) {
+ NamedDecl *impCxt = CurMethodDecl->getMethodContext();
+ if (ObjcImplementationDecl *IMD =
+ dyn_cast<ObjcImplementationDecl>(impCxt)) {
+ if (receiverType == Context.getObjcIdType())
+ Method = IMD->lookupInstanceMethod(Sel);
+ else
+ Method = IMD->lookupClassMethod(Sel);
+ } else if (ObjcCategoryImplDecl *CID =
+ dyn_cast<ObjcCategoryImplDecl>(impCxt)) {
+ if (receiverType == Context.getObjcIdType())
+ Method = CID->lookupInstanceMethod(Sel);
+ else
+ Method = CID->lookupClassMethod(Sel);
+ }
+ }
if (!Method) {
Diag(lbrac, diag::warn_method_not_found, std::string("-"), Sel.getName(),
SourceRange(lbrac, rbrac));
More information about the cfe-commits
mailing list