summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-02-26 18:16:19 +0000
committerSteve Naroff <snaroff@apple.com>2009-02-26 18:16:19 +0000
commit42ab0dd1eef7cce0f85d12fcada12cf8c1b6afc4 (patch)
tree3b00b5a5becf896d658376ed0dafb31c4b2af34c
parent58ac0b4bac3a11b0363b899e51578f6c22cf75b9 (diff)
downloadbcm5719-llvm-42ab0dd1eef7cce0f85d12fcada12cf8c1b6afc4.tar.gz
bcm5719-llvm-42ab0dd1eef7cce0f85d12fcada12cf8c1b6afc4.zip
Fix <rdar://problem/6614945> method not found.
This was a fairly recent regression. llvm-svn: 65547
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp6
-rw-r--r--clang/test/SemaObjC/method-lookup-2.m22
2 files changed, 25 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index e3d2074c0e2..5be84607b2a 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -395,10 +395,10 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
}
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));
diff --git a/clang/test/SemaObjC/method-lookup-2.m b/clang/test/SemaObjC/method-lookup-2.m
index 4ebdb8e4524..9939e349547 100644
--- a/clang/test/SemaObjC/method-lookup-2.m
+++ b/clang/test/SemaObjC/method-lookup-2.m
@@ -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 @@ extern NSString *const NSWillBecomeMultiThreadedNotification;
return[[self sharedInstance] run];
}
@end
+
+@interface XX : NSObject
+
++ classMethod;
+
+@end
+
+@interface YY : NSObject
+- whatever;
+@end
+
+@implementation YY
+
+- whatever {
+ id obj = [[XX alloc] init];
+ [[obj class] classMethod];
+}
+
+@end
OpenPOWER on IntegriCloud