Douglas Gregor | f8b42d1 | 2011-11-16 15:22:03 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Douglas Gregor | 94ad28b | 2012-01-03 18:24:14 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_top -emit-module %S/Inputs/module.map |
| 3 | // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_left -emit-module %S/Inputs/module.map |
| 4 | // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_right -emit-module %S/Inputs/module.map |
| 5 | // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_bottom -emit-module %S/Inputs/module.map |
Douglas Gregor | cff9f26 | 2012-01-27 01:47:08 +0000 | [diff] [blame] | 6 | // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_other -emit-module %S/Inputs/module.map |
Douglas Gregor | 94ad28b | 2012-01-03 18:24:14 +0000 | [diff] [blame] | 7 | // RUN: %clang_cc1 -fmodules -fmodule-cache-path %t %s -verify |
Argyrios Kyrtzidis | e6b8d68 | 2011-09-01 00:58:55 +0000 | [diff] [blame] | 8 | |
Ted Kremenek | 32ad2ee | 2012-03-01 22:07:04 +0000 | [diff] [blame] | 9 | @__experimental_modules_import category_bottom; |
Argyrios Kyrtzidis | e6b8d68 | 2011-09-01 00:58:55 +0000 | [diff] [blame] | 10 | |
Douglas Gregor | 556ecc7 | 2011-09-01 19:02:18 +0000 | [diff] [blame] | 11 | |
Douglas Gregor | cff9f26 | 2012-01-27 01:47:08 +0000 | [diff] [blame] | 12 | |
| 13 | |
Douglas Gregor | f8b42d1 | 2011-11-16 15:22:03 +0000 | [diff] [blame] | 14 | // in category_left.h: expected-note {{previous definition}} |
Jordan Rose | 7c304f5 | 2012-08-10 01:06:16 +0000 | [diff] [blame^] | 15 | // in category_right.h: expected-warning@11 {{duplicate definition of category}} |
Argyrios Kyrtzidis | e6b8d68 | 2011-09-01 00:58:55 +0000 | [diff] [blame] | 16 | |
| 17 | @interface Foo(Source) |
Douglas Gregor | f8b42d1 | 2011-11-16 15:22:03 +0000 | [diff] [blame] | 18 | -(void)source; |
Argyrios Kyrtzidis | e6b8d68 | 2011-09-01 00:58:55 +0000 | [diff] [blame] | 19 | @end |
| 20 | |
| 21 | void test(Foo *foo, LeftFoo *leftFoo) { |
| 22 | [foo source]; |
| 23 | [foo bottom]; |
| 24 | [foo left]; |
| 25 | [foo right1]; |
| 26 | [foo right2]; |
| 27 | [foo top]; |
Douglas Gregor | cff9f26 | 2012-01-27 01:47:08 +0000 | [diff] [blame] | 28 | [foo top2]; |
| 29 | [foo top3]; |
Argyrios Kyrtzidis | e6b8d68 | 2011-09-01 00:58:55 +0000 | [diff] [blame] | 30 | |
| 31 | [leftFoo left]; |
| 32 | [leftFoo bottom]; |
| 33 | } |
Douglas Gregor | cff9f26 | 2012-01-27 01:47:08 +0000 | [diff] [blame] | 34 | |
| 35 | // Load another module that also adds categories to Foo, verify that |
| 36 | // we see those categories. |
Ted Kremenek | 32ad2ee | 2012-03-01 22:07:04 +0000 | [diff] [blame] | 37 | @__experimental_modules_import category_other; |
Douglas Gregor | cff9f26 | 2012-01-27 01:47:08 +0000 | [diff] [blame] | 38 | |
| 39 | void test_other(Foo *foo) { |
| 40 | [foo other]; |
| 41 | } |