Douglas Gregor | 0d266d6 | 2012-01-25 00:59:09 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Douglas Gregor | 953a61f | 2013-02-07 19:01:24 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -I %S/Inputs %s -verify |
Douglas Gregor | 0d266d6 | 2012-01-25 00:59:09 +0000 | [diff] [blame] | 3 | |
Douglas Gregor | 2cbd427 | 2013-02-12 23:36:21 +0000 | [diff] [blame] | 4 | |
Douglas Gregor | 1b257af | 2012-12-11 22:11:52 +0000 | [diff] [blame] | 5 | @import MethodPoolA; |
Douglas Gregor | 0d266d6 | 2012-01-25 00:59:09 +0000 | [diff] [blame] | 6 | |
Douglas Gregor | 2cbd427 | 2013-02-12 23:36:21 +0000 | [diff] [blame] | 7 | @interface D |
| 8 | - (void)method5:(D*)obj; |
| 9 | @end |
Douglas Gregor | 0d266d6 | 2012-01-25 00:59:09 +0000 | [diff] [blame] | 10 | |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 11 | // expected-note@Inputs/MethodPoolA.h:7{{using}} |
| 12 | // expected-note@Inputs/MethodPoolB.h:12{{also found}} |
Douglas Gregor | 0d266d6 | 2012-01-25 00:59:09 +0000 | [diff] [blame] | 13 | |
| 14 | void testMethod1(id object) { |
| 15 | [object method1]; |
| 16 | } |
| 17 | |
| 18 | void testMethod2(id object) { |
| 19 | [object method2:1]; |
| 20 | } |
| 21 | |
Douglas Gregor | 7666b03 | 2013-02-07 19:13:24 +0000 | [diff] [blame] | 22 | void testMethod4(id object) { |
| 23 | [object method4]; // expected-warning{{instance method '-method4' not found (return type defaults to 'id')}} |
| 24 | } |
| 25 | |
Douglas Gregor | 2cbd427 | 2013-02-12 23:36:21 +0000 | [diff] [blame] | 26 | void testMethod5(id object, D* d) { |
| 27 | [object method5:d]; |
| 28 | } |
| 29 | |
Douglas Gregor | 1b257af | 2012-12-11 22:11:52 +0000 | [diff] [blame] | 30 | @import MethodPoolB; |
Douglas Gregor | 0d266d6 | 2012-01-25 00:59:09 +0000 | [diff] [blame] | 31 | |
| 32 | void testMethod1Again(id object) { |
| 33 | [object method1]; |
| 34 | } |
| 35 | |
| 36 | void testMethod2Again(id object) { |
| 37 | [object method2:1]; // expected-warning{{multiple methods named 'method2:' found}} |
| 38 | } |
Douglas Gregor | f0e0004 | 2013-01-16 18:47:38 +0000 | [diff] [blame] | 39 | |
| 40 | void 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 | |
| 46 | void testMethod3Again(id object) { |
| 47 | char *str = [object method3]; // okay: only found in MethodPoolB.Sub |
| 48 | } |
| 49 | |
| 50 | @import MethodPoolA.Sub; |
| 51 | |
| 52 | void testMethod3AgainAgain(id object) { |
| 53 | [object method3]; // expected-warning{{multiple methods named 'method3' found}} |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 54 | // expected-note@Inputs/MethodPoolBSub.h:2{{using}} |
| 55 | // expected-note@Inputs/MethodPoolASub.h:2{{also found}} |
Douglas Gregor | f0e0004 | 2013-01-16 18:47:38 +0000 | [diff] [blame] | 56 | } |
Douglas Gregor | 7666b03 | 2013-02-07 19:13:24 +0000 | [diff] [blame] | 57 | |
| 58 | void testMethod4Again(id object) { |
| 59 | [object method4]; |
| 60 | } |
Douglas Gregor | 2cbd427 | 2013-02-12 23:36:21 +0000 | [diff] [blame] | 61 | |
| 62 | void testMethod5Again(id object, D* d) { |
| 63 | [object method5:d]; |
| 64 | } |