Implement an important missing warning when a selector
is searched for in the global pool. It already uncovered
a clang bug in message selection.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65974 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/conditional-expr.m b/test/SemaObjC/conditional-expr.m
index c607178..7665671 100644
--- a/test/SemaObjC/conditional-expr.m
+++ b/test/SemaObjC/conditional-expr.m
@@ -36,7 +36,7 @@
// No @interface declaration for DTFilterOutputStream3
@implementation DTFilterOutputStream3 // expected-warning {{cannot find interface declaration for 'DTFilterOutputStream3'}}
- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
- id <DTOutputStreams> nextOutputStream = [self nextOutputStream];
+ id <DTOutputStreams> nextOutputStream = [self nextOutputStream]; // expected-warning {{DTFilterOutputStream3 may not respond to 'nextOutputStream'}}
// GCC warns about both of these as well (no errors).
self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream3 *'}}
return nextOutputStream ? nextOutputStream : self;
diff --git a/test/SemaObjC/warn-selector-selection.m b/test/SemaObjC/warn-selector-selection.m
new file mode 100644
index 0000000..777666d
--- /dev/null
+++ b/test/SemaObjC/warn-selector-selection.m
@@ -0,0 +1,14 @@
+// RUN: clang -fsyntax-only -verify %s
+
+@interface Object
+- (void)foo;
+@end
+
+@interface Class1
+- (void)setWindow:(Object *)wdw;
+@end
+
+void foo(void) {
+ Object *obj;
+ [obj setWindow:0]; // expected-warning{{Object may not respond to 'setWindow:'}}
+}