blob: 87aaa5c12cae3f0aadb3f60a2a5c3db3526079fb [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;
Argyrios Kyrtzidis7d847c92011-09-01 00:58:55 +000057
58@interface Foo(Bottom)
59-(void)bottom;
60@end
61
Douglas Gregor2fd3d402011-09-17 00:05:03 +000062__import_module__ diamond_right;
63
Argyrios Kyrtzidis7d847c92011-09-01 00:58:55 +000064@interface LeftFoo(Bottom)
65-(void)bottom;
66@end
67
68/*============================================================================*/
69#else
70
71__import_module__ diamond_bottom;
72
73@interface Foo(Source)
74-(void)source;
75@end
76
77void test(Foo *foo, LeftFoo *leftFoo) {
78 [foo source];
79 [foo bottom];
80 [foo left];
81 [foo right1];
82 [foo right2];
83 [foo top];
84
85 [leftFoo left];
86 [leftFoo bottom];
87}
88
89#endif