Teach global selector lookup to ignore hidden methods, which occur
when the methods are declared in a submodule that has not yet been
imported. Part of <rdar://problem/10634711>. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172635 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Modules/Inputs/MethodPoolASub.h b/test/Modules/Inputs/MethodPoolASub.h
new file mode 100644
index 0000000..e0bd238
--- /dev/null
+++ b/test/Modules/Inputs/MethodPoolASub.h
@@ -0,0 +1,3 @@
+@interface A (Sub)
+- (char)method3;
+@end
diff --git a/test/Modules/Inputs/MethodPoolBSub.h b/test/Modules/Inputs/MethodPoolBSub.h
new file mode 100644
index 0000000..3404ce9
--- /dev/null
+++ b/test/Modules/Inputs/MethodPoolBSub.h
@@ -0,0 +1,3 @@
+@interface B (Sub)
+- (char *)method3;
+@end
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index 702f5c1..42c6c2b 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -107,9 +107,17 @@
 }
 module MethodPoolA {
   header "MethodPoolA.h"
+
+  explicit module Sub {
+    header "MethodPoolASub.h"
+  }
 }
 module MethodPoolB {
   header "MethodPoolB.h"
+
+  explicit module Sub {
+    header "MethodPoolBSub.h"
+  }
 }
 module import_decl {
   header "import-decl.h"
diff --git a/test/Modules/method_pool.m b/test/Modules/method_pool.m
index 9574caa..1ba5abd 100644
--- a/test/Modules/method_pool.m
+++ b/test/Modules/method_pool.m
@@ -28,3 +28,21 @@
 void testMethod2Again(id object) {
   [object method2:1]; // expected-warning{{multiple methods named 'method2:' found}}
 }
+
+void testMethod3(id object) {
+  [object method3]; // expected-warning{{instance method '-method3' not found (return type defaults to 'id')}}
+}
+
+@import MethodPoolB.Sub;
+
+void testMethod3Again(id object) {
+  char *str = [object method3]; // okay: only found in MethodPoolB.Sub
+}
+
+@import MethodPoolA.Sub;
+
+void testMethod3AgainAgain(id object) {
+  [object method3]; // expected-warning{{multiple methods named 'method3' found}}
+  // expected-note@2{{using}}
+  // expected-note@2{{also found}}
+}