r204852 - Objective-C. Fixes a bogus warning on unimplemented

Fariborz Jahanian fjahanian at apple.com
Wed Mar 26 13:59:26 PDT 2014


Author: fjahanian
Date: Wed Mar 26 15:59:26 2014
New Revision: 204852

URL: http://llvm.org/viewvc/llvm-project?rev=204852&view=rev
Log:
Objective-C. Fixes a bogus warning on unimplemented
selectors because we were not going through entire
elements in list of all implemented selectors. 
// rdar://16428638

Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/test/SemaObjC/selector-3.m

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=204852&r1=204851&r2=204852&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Mar 26 15:59:26 2014
@@ -2402,11 +2402,15 @@ ObjCMethodDecl *Sema::LookupImplementedM
     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;
 }
 

Modified: cfe/trunk/test/SemaObjC/selector-3.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/selector-3.m?rev=204852&r1=204851&r2=204852&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/selector-3.m (original)
+++ cfe/trunk/test/SemaObjC/selector-3.m Wed Mar 26 15:59:26 2014
@@ -110,3 +110,27 @@ extern SEL MySelector(SEL s);
 @interface USETextSub : USEText
 - (int) invalidate : (id)arg;
 @end
+
+// rdar://16428638
+ at interface I16428638
+- (int) compare: (I16428638 *) arg1; // commenting out this line avoids the warning
+ at end
+
+ at interface J16428638
+- (int) compare: (J16428638 *) arg1;
+ at end
+
+ at implementation J16428638
+- (void)method {
+    SEL s = @selector(compare:); // spurious warning
+    (void)s;
+}
+- (int) compare: (J16428638 *) arg1 {
+    return 0;
+}
+ at end
+
+void test16428638() {
+    SEL s = @selector(compare:);
+    (void)s;
+}





More information about the cfe-commits mailing list