[cfe-commits] r51938 - in /cfe/trunk: lib/Sema/SemaExprObjC.cpp test/Sema/method-lookup.m
Steve Naroff
snaroff at apple.com
Wed Jun 4 07:43:54 PDT 2008
Author: snaroff
Date: Wed Jun 4 09:43:54 2008
New Revision: 51938
URL: http://llvm.org/viewvc/llvm-project?rev=51938&view=rev
Log:
Sema::ActOnClassMessage() needs to look through it's local implementation for private class methods.
Added:
cfe/trunk/test/Sema/method-lookup.m
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=51938&r1=51937&r2=51938&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Wed Jun 4 09:43:54 2008
@@ -170,6 +170,12 @@
ObjCMethodDecl *Method = ClassDecl->lookupClassMethod(Sel);
QualType returnType;
+ // If we have an implementation in scope, check "private" methods.
+ if (!Method) {
+ if (ObjCImplementationDecl *ImpDecl =
+ ObjCImplementations[ClassDecl->getIdentifier()])
+ Method = ImpDecl->getClassMethod(Sel);
+ }
// Before we give up, check if the selector is an instance method.
if (!Method)
Method = ClassDecl->lookupInstanceMethod(Sel);
Added: cfe/trunk/test/Sema/method-lookup.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/method-lookup.m?rev=51938&view=auto
==============================================================================
--- cfe/trunk/test/Sema/method-lookup.m (added)
+++ cfe/trunk/test/Sema/method-lookup.m Wed Jun 4 09:43:54 2008
@@ -0,0 +1,34 @@
+// RUN: clang -fsyntax-only -verify %s
+typedef signed char BOOL;
+typedef int NSInteger;
+
+ at protocol NSObject
+- (BOOL)isEqual:(id)object;
+- (BOOL)respondsToSelector:(SEL)s;
+ at end
+
+ at interface NSObject <NSObject> {}
+ at end
+
+ at class NSString, NSData, NSMutableData, NSMutableDictionary, NSMutableArray;
+
+ at protocol PBXCompletionItem
+- (NSString *) name;
+- (NSInteger)priority;
+- setPriority:(NSInteger)p;
+ at end
+
+ at implementation PBXCodeAssistant // expected-warning{{cannot find interface declaration for 'PBXCodeAssistant'}}
+static NSMutableArray * recentCompletions = ((void *)0);
++ (float) factorForRecentCompletion:(NSString *) completion
+{
+ for (NSObject<PBXCompletionItem> * item in [self completionItems]) // expected-warning{{method '-completionItems' not found (return type defaults to 'id')}}
+ {
+ if ([item respondsToSelector:@selector(setPriority:)])
+ {
+ [(id)item setPriority:[item priority] / [PBXCodeAssistant factorForRecentCompletion:[item name]]];
+ }
+ }
+}
+ at end
+
More information about the cfe-commits
mailing list