]> granicus.if.org Git - clang/commitdiff
Objective-C. Fixes a bogus warning on unimplemented
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 26 Mar 2014 20:59:26 +0000 (20:59 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 26 Mar 2014 20:59:26 +0000 (20:59 +0000)
selectors because we were not going through entire
elements in list of all implemented selectors.
// rdar://16428638

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204852 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/selector-3.m

index 5be26a91a249a1e3331f7507927250599fa49be2..d59dd8b9950addbabe24a0139590b84d0469c0f4 100644 (file)
@@ -2402,11 +2402,15 @@ ObjCMethodDecl *Sema::LookupImplementedMethodInGlobalPool(Selector Sel) {
     return 0;
 
   GlobalMethods &Methods = Pos->second;
-
-  if (Methods.first.Method && Methods.first.Method->isDefined())
-    return Methods.first.Method;
-  if (Methods.second.Method && Methods.second.Method->isDefined())
-    return Methods.second.Method;
+  for (const ObjCMethodList *Method = &Methods.first; Method;
+       Method = Method->getNext())
+    if (Method->Method && Method->Method->isDefined())
+      return Method->Method;
+  
+  for (const ObjCMethodList *Method = &Methods.second; Method;
+       Method = Method->getNext())
+    if (Method->Method && Method->Method->isDefined())
+      return Method->Method;
   return 0;
 }
 
index 37c4ec19dfdf30f4baf53cdcb68a29dd45506622..c934dbcd8df5d8418f08447d8865d2d8d26d453a 100644 (file)
@@ -110,3 +110,27 @@ extern SEL MySelector(SEL s);
 @interface USETextSub : USEText
 - (int) invalidate : (id)arg;
 @end
+
+// rdar://16428638
+@interface I16428638
+- (int) compare: (I16428638 *) arg1; // commenting out this line avoids the warning
+@end
+
+@interface J16428638
+- (int) compare: (J16428638 *) arg1;
+@end
+
+@implementation J16428638
+- (void)method {
+    SEL s = @selector(compare:); // spurious warning
+    (void)s;
+}
+- (int) compare: (J16428638 *) arg1 {
+    return 0;
+}
+@end
+
+void test16428638() {
+    SEL s = @selector(compare:);
+    (void)s;
+}