[cfe-commits] r65547 - in /cfe/trunk: lib/Sema/SemaExprObjC.cpp test/SemaObjC/method-lookup-2.m

Steve Naroff snaroff at apple.com
Thu Feb 26 10:16:20 PST 2009


Author: snaroff
Date: Thu Feb 26 12:16:19 2009
New Revision: 65547

URL: http://llvm.org/viewvc/llvm-project?rev=65547&view=rev
Log:
Fix <rdar://problem/6614945> method not found. 

This was a fairly recent regression.

Modified:
    cfe/trunk/lib/Sema/SemaExprObjC.cpp
    cfe/trunk/test/SemaObjC/method-lookup-2.m

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=65547&r1=65546&r2=65547&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Thu Feb 26 12:16:19 2009
@@ -395,10 +395,10 @@
       }
       if (Method && DiagnoseUseOfDecl(Method, receiverLoc))
         return true;
-    } else {
-      // We're not in a method context, look for any factory method named 'Sel'.
-      Method = FactoryMethodPool[Sel].Method;
     }
+    // Look for any factory method named 'Sel'.
+    if (!Method)
+      Method = FactoryMethodPool[Sel].Method;
     if (!Method)
       Method = LookupInstanceMethodInGlobalPool(
                                Sel, SourceRange(lbrac,rbrac));

Modified: cfe/trunk/test/SemaObjC/method-lookup-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/method-lookup-2.m?rev=65547&r1=65546&r2=65547&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/method-lookup-2.m (original)
+++ cfe/trunk/test/SemaObjC/method-lookup-2.m Thu Feb 26 12:16:19 2009
@@ -2,7 +2,10 @@
 typedef signed char BOOL;
 
 @protocol NSObject
++ alloc;
+- init;
 - (BOOL) isEqual:(id) object;
+- (Class)class;
 @end
 
 @interface NSObject < NSObject > {} @end
@@ -38,3 +41,22 @@
   return[[self sharedInstance] run];
 }
 @end
+
+ at interface XX : NSObject
+
++ classMethod;
+
+ at end
+
+ at interface YY : NSObject
+- whatever;
+ at end
+
+ at implementation YY 
+
+- whatever {
+  id obj = [[XX alloc] init];
+  [[obj class] classMethod];
+}
+
+ at end





More information about the cfe-commits mailing list