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
llvm-svn: 204852
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 5be26a9..d59dd8b 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -2402,11 +2402,15 @@
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;
}
diff --git a/clang/test/SemaObjC/selector-3.m b/clang/test/SemaObjC/selector-3.m
index 37c4ec1..c934dbc 100644
--- a/clang/test/SemaObjC/selector-3.m
+++ b/clang/test/SemaObjC/selector-3.m
@@ -110,3 +110,27 @@
@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;
+}