blob: 6fd74b0885fd3cbb20c264f0a67bf94803fa01c9 [file] [log] [blame]
Douglas Gregor0d266d62012-01-25 00:59:09 +00001// RUN: rm -rf %t
Douglas Gregor953a61f2013-02-07 19:01:24 +00002// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -I %S/Inputs %s -verify
Douglas Gregor0d266d62012-01-25 00:59:09 +00003
Douglas Gregor2cbd4272013-02-12 23:36:21 +00004
Douglas Gregor1b257af2012-12-11 22:11:52 +00005@import MethodPoolA;
Douglas Gregor0d266d62012-01-25 00:59:09 +00006
Douglas Gregor2cbd4272013-02-12 23:36:21 +00007@interface D
8- (void)method5:(D*)obj;
9@end
Douglas Gregor0d266d62012-01-25 00:59:09 +000010
Andy Gibbsb42f2002013-04-17 08:06:46 +000011// expected-note@Inputs/MethodPoolA.h:7{{using}}
12// expected-note@Inputs/MethodPoolB.h:12{{also found}}
Douglas Gregor0d266d62012-01-25 00:59:09 +000013
14void testMethod1(id object) {
15 [object method1];
16}
17
18void testMethod2(id object) {
19 [object method2:1];
20}
21
Douglas Gregor7666b032013-02-07 19:13:24 +000022void testMethod4(id object) {
23 [object method4]; // expected-warning{{instance method '-method4' not found (return type defaults to 'id')}}
24}
25
Douglas Gregor2cbd4272013-02-12 23:36:21 +000026void testMethod5(id object, D* d) {
27 [object method5:d];
28}
29
Douglas Gregor1b257af2012-12-11 22:11:52 +000030@import MethodPoolB;
Douglas Gregor0d266d62012-01-25 00:59:09 +000031
32void testMethod1Again(id object) {
33 [object method1];
34}
35
36void testMethod2Again(id object) {
37 [object method2:1]; // expected-warning{{multiple methods named 'method2:' found}}
38}
Douglas Gregorf0e00042013-01-16 18:47:38 +000039
40void testMethod3(id object) {
41 [object method3]; // expected-warning{{instance method '-method3' not found (return type defaults to 'id')}}
42}
43
44@import MethodPoolB.Sub;
45
46void testMethod3Again(id object) {
47 char *str = [object method3]; // okay: only found in MethodPoolB.Sub
48}
49
50@import MethodPoolA.Sub;
51
52void testMethod3AgainAgain(id object) {
53 [object method3]; // expected-warning{{multiple methods named 'method3' found}}
Andy Gibbsb42f2002013-04-17 08:06:46 +000054 // expected-note@Inputs/MethodPoolBSub.h:2{{using}}
55 // expected-note@Inputs/MethodPoolASub.h:2{{also found}}
Douglas Gregorf0e00042013-01-16 18:47:38 +000056}
Douglas Gregor7666b032013-02-07 19:13:24 +000057
58void testMethod4Again(id object) {
59 [object method4];
60}
Douglas Gregor2cbd4272013-02-12 23:36:21 +000061
62void testMethod5Again(id object, D* d) {
63 [object method5:d];
64}