blob: 06f426371901b71e7fcca8ca92f32f745370c6b2 [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
3// RUN: %clang_cc1 -I %t -emit-module -o %t/diamond_left.pcm %s -D MODULE_LEFT
4// RUN: %clang_cc1 -I %t -emit-module -o %t/diamond_right.pcm %s -D MODULE_RIGHT
5// RUN: %clang_cc1 -I %t -emit-module -o %t/diamond_bottom.pcm %s -D MODULE_BOTTOM
6// RUN: %clang_cc1 -I %t %s -verify
7
8/*============================================================================*/
9#ifdef MODULE_TOP
10
11@interface Foo
12-(void)top;
13@end
14
15/*============================================================================*/
16#elif defined(MODULE_LEFT)
17
18__import_module__ diamond_top;
19
20@interface Foo(Left)
21-(void)left;
22@end
23
24@interface LeftFoo
25-(void)left;
26@end
27
28@interface Foo(Duplicate) // expected-note {{previous definition}}
29@end
30
31@interface Foo(Duplicate)
32@end
33
34/*============================================================================*/
35#elif defined(MODULE_RIGHT)
36
37__import_module__ diamond_top;
38
39@interface Foo(Right1)
40-(void)right1;
41@end
42
43@interface Foo(Right2)
44-(void)right2;
45@end
46
47@interface Foo(Duplicate) // expected-warning {{duplicate definition of category}}
48@end
49
50/*============================================================================*/
51#elif defined(MODULE_BOTTOM)
52
53__import_module__ diamond_left;
54__import_module__ diamond_right;
55
56@interface Foo(Bottom)
57-(void)bottom;
58@end
59
60@interface LeftFoo(Bottom)
61-(void)bottom;
62@end
63
64/*============================================================================*/
65#else
66
67__import_module__ diamond_bottom;
68
69@interface Foo(Source)
70-(void)source;
71@end
72
73void test(Foo *foo, LeftFoo *leftFoo) {
74 [foo source];
75 [foo bottom];
76 [foo left];
77 [foo right1];
78 [foo right2];
79 [foo top];
80
81 [leftFoo left];
82 [leftFoo bottom];
83}
84
85#endif