diff options
Diffstat (limited to 'test/Modules/objc-categories.m')
-rw-r--r-- | test/Modules/objc-categories.m | 87 |
1 files changed, 19 insertions, 68 deletions
diff --git a/test/Modules/objc-categories.m b/test/Modules/objc-categories.m index 87aaa5c..340f279 100644 --- a/test/Modules/objc-categories.m +++ b/test/Modules/objc-categories.m @@ -1,77 +1,20 @@ -// RUN: mkdir -p %t -// RUN: %clang_cc1 -emit-module -o %t/diamond_top.pcm %s -D MODULE_TOP -// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_left.pcm %s -D MODULE_LEFT -// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_right.pcm %s -D MODULE_RIGHT -// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_bottom.pcm %s -D MODULE_BOTTOM -// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -verify +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_top -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_left -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_right -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_bottom -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_other -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t %s -verify -/*============================================================================*/ -#ifdef MODULE_TOP +@__experimental_modules_import category_bottom; -@interface Foo -@end - -@interface Foo(Top) --(void)top; -@end - -/*============================================================================*/ -#elif defined(MODULE_LEFT) -__import_module__ diamond_top; -@interface Foo(Left) --(void)left; -@end - -@interface LeftFoo --(void)left; -@end -@interface Foo(Duplicate) // expected-note {{previous definition}} -@end - -@interface Foo(Duplicate) -@end - -/*============================================================================*/ -#elif defined(MODULE_RIGHT) - -__import_module__ diamond_top; - -@interface Foo(Right1) --(void)right1; -@end - -@interface Foo(Right2) --(void)right2; -@end - -@interface Foo(Duplicate) // expected-warning {{duplicate definition of category}} -@end - -/*============================================================================*/ -#elif defined(MODULE_BOTTOM) - -__import_module__ diamond_left; - -@interface Foo(Bottom) --(void)bottom; -@end - -__import_module__ diamond_right; - -@interface LeftFoo(Bottom) --(void)bottom; -@end - -/*============================================================================*/ -#else - -__import_module__ diamond_bottom; +// in category_left.h: expected-note {{previous definition}} @interface Foo(Source) --(void)source; +-(void)source; @end void test(Foo *foo, LeftFoo *leftFoo) { @@ -81,9 +24,17 @@ void test(Foo *foo, LeftFoo *leftFoo) { [foo right1]; [foo right2]; [foo top]; + [foo top2]; + [foo top3]; [leftFoo left]; [leftFoo bottom]; } -#endif +// Load another module that also adds categories to Foo, verify that +// we see those categories. +@__experimental_modules_import category_other; + +void test_other(Foo *foo) { + [foo other]; +} |