blob: b26759239ddab02d3ab71c4b0f819c297f56251e [file] [log] [blame]
Douglas Gregorf8b42d12011-11-16 15:22:03 +00001// RUN: rm -rf %t
Douglas Gregor94ad28b2012-01-03 18:24:14 +00002// 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 Gregorcff9f262012-01-27 01:47:08 +00006// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_other -emit-module %S/Inputs/module.map
Douglas Gregor94ad28b2012-01-03 18:24:14 +00007// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t %s -verify
Argyrios Kyrtzidise6b8d682011-09-01 00:58:55 +00008
Ted Kremenek32ad2ee2012-03-01 22:07:04 +00009@__experimental_modules_import category_bottom;
Argyrios Kyrtzidise6b8d682011-09-01 00:58:55 +000010
Douglas Gregor556ecc72011-09-01 19:02:18 +000011
Douglas Gregorcff9f262012-01-27 01:47:08 +000012
13
Douglas Gregorf8b42d12011-11-16 15:22:03 +000014// in category_left.h: expected-note {{previous definition}}
Jordan Rose7c304f52012-08-10 01:06:16 +000015// in category_right.h: expected-warning@11 {{duplicate definition of category}}
Argyrios Kyrtzidise6b8d682011-09-01 00:58:55 +000016
17@interface Foo(Source)
Douglas Gregorf8b42d12011-11-16 15:22:03 +000018-(void)source;
Argyrios Kyrtzidise6b8d682011-09-01 00:58:55 +000019@end
20
21void test(Foo *foo, LeftFoo *leftFoo) {
22 [foo source];
23 [foo bottom];
24 [foo left];
25 [foo right1];
26 [foo right2];
27 [foo top];
Douglas Gregorcff9f262012-01-27 01:47:08 +000028 [foo top2];
29 [foo top3];
Argyrios Kyrtzidise6b8d682011-09-01 00:58:55 +000030
31 [leftFoo left];
32 [leftFoo bottom];
33}
Douglas Gregorcff9f262012-01-27 01:47:08 +000034
35// Load another module that also adds categories to Foo, verify that
36// we see those categories.
Ted Kremenek32ad2ee2012-03-01 22:07:04 +000037@__experimental_modules_import category_other;
Douglas Gregorcff9f262012-01-27 01:47:08 +000038
39void test_other(Foo *foo) {
40 [foo other];
41}