blob: 6022187f6a5d75a8268c3054521ee3bec65c0cb3 [file] [log] [blame]
Argyrios Kyrtzidis7d847c92011-09-01 00:58:55 +00001// RUN: mkdir -p %t
2// RUN: %clang_cc1 -emit-module -o %t/diamond_top.pcm %s -D MODULE_TOP
Douglas Gregor1735f4e2011-09-13 23:15:45 +00003// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_left.pcm %s -D MODULE_LEFT
4// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_right.pcm %s -D MODULE_RIGHT
5// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_bottom.pcm %s -D MODULE_BOTTOM
6// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -verify
Argyrios Kyrtzidis7d847c92011-09-01 00:58:55 +00007
8/*============================================================================*/
9#ifdef MODULE_TOP
10
11@interface Foo
Douglas Gregor6ac0b712011-09-01 19:02:18 +000012@end
13
14@interface Foo(Top)
Argyrios Kyrtzidis7d847c92011-09-01 00:58:55 +000015-(void)top;
16@end
17
18/*============================================================================*/
19#elif defined(MODULE_LEFT)
20
21__import_module__ diamond_top;
22
23@interface Foo(Left)
24-(void)left;
25@end
26
27@interface LeftFoo
28-(void)left;
29@end
30
31@interface Foo(Duplicate) // expected-note {{previous definition}}
32@end
33
34@interface Foo(Duplicate)
35@end
36
37/*============================================================================*/
38#elif defined(MODULE_RIGHT)
39
40__import_module__ diamond_top;
41
42@interface Foo(Right1)
43-(void)right1;
44@end
45
46@interface Foo(Right2)
47-(void)right2;
48@end
49
50@interface Foo(Duplicate) // expected-warning {{duplicate definition of category}}
51@end
52
53/*============================================================================*/
54#elif defined(MODULE_BOTTOM)
55
56__import_module__ diamond_left;
57__import_module__ diamond_right;
58
59@interface Foo(Bottom)
60-(void)bottom;
61@end
62
63@interface LeftFoo(Bottom)
64-(void)bottom;
65@end
66
67/*============================================================================*/
68#else
69
70__import_module__ diamond_bottom;
71
72@interface Foo(Source)
73-(void)source;
74@end
75
76void test(Foo *foo, LeftFoo *leftFoo) {
77 [foo source];
78 [foo bottom];
79 [foo left];
80 [foo right1];
81 [foo right2];
82 [foo top];
83
84 [leftFoo left];
85 [leftFoo bottom];
86}
87
88#endif