blob: 930e8df6b87fe13078a413b159293c775d4fb8df [file] [log] [blame]
Douglas Gregora1be2782011-12-17 23:38:30 +00001// RUN: rm -rf %t
2// RUN: %clang_cc1 -fmodule-cache-path %t -I %S/Inputs %s -verify
Douglas Gregor68d7bb92011-12-19 14:42:41 +00003// RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -I %S/Inputs %s -verify
Douglas Gregor0f753232011-12-22 01:48:48 +00004@class C2;
5@class C3;
6@class C3;
Douglas Gregora1be2782011-12-17 23:38:30 +00007__import_module__ redecl_merge_left;
Douglas Gregor0f753232011-12-22 01:48:48 +00008
9@class C3;
10@class C3;
Douglas Gregora1be2782011-12-17 23:38:30 +000011__import_module__ redecl_merge_right;
12
13@implementation A
14- (Super*)init { return self; }
15@end
16
17void f(A *a) {
18 [a init];
19}
20
21@class A;
22
Douglas Gregoradafc2e2011-12-19 16:14:14 +000023B *f1() {
24 return [B create_a_B];
25}
26
Douglas Gregorecb19382011-12-19 15:27:36 +000027@class B;
28
Douglas Gregor2ccd89c2011-12-20 18:11:52 +000029// Test redeclarations of entities in explicit submodules, to make
30// sure we're maintaining the declaration chains even when normal name
31// lookup can't see what we're looking for.
32void testExplicit() {
33 Explicit *e;
34 int *(*fp)(void) = &explicit_func;
35 int *ip = explicit_func();
36
37 // FIXME: Should complain about definition not having been imported.
38 struct explicit_struct es = { 0 };
39}
40
Douglas Gregor0f753232011-12-22 01:48:48 +000041// Test resolution of declarations from multiple modules with no
42// common original declaration.
43void test_C(C *c) {
44 c = get_a_C();
45 accept_a_C(c);
46}
47
48void test_C2(C2 *c2) {
49 c2 = get_a_C2();
50 accept_a_C2(c2);
51}
52
53void test_C3(C3 *c3) {
54 c3 = get_a_C3();
55 accept_a_C3(c3);
56}
57
Douglas Gregorcce54aa2011-12-22 19:44:59 +000058C4 *global_C4;
59__import_module__ redecl_merge_left_left;
60
61void test_C4(C4 *c4) {
62 global_C4 = c4 = get_a_C4();
63 accept_a_C4(c4);
64}
65
Douglas Gregora1be2782011-12-17 23:38:30 +000066__import_module__ redecl_merge_bottom;
67
Douglas Gregorecb19382011-12-19 15:27:36 +000068@implementation B
Douglas Gregoradafc2e2011-12-19 16:14:14 +000069+ (B*)create_a_B { return 0; }
Douglas Gregorecb19382011-12-19 15:27:36 +000070@end
71
Douglas Gregora1be2782011-12-17 23:38:30 +000072void g(A *a) {
73 [a init];
74}
Douglas Gregorf63b0a52011-12-19 18:19:24 +000075
76#ifdef __cplusplus
77void testVector() {
Douglas Gregorfc529f72011-12-19 19:00:47 +000078 Vector<int> vec_int;
79 vec_int.push_back(0);
Douglas Gregorf63b0a52011-12-19 18:19:24 +000080}
81#endif
Douglas Gregor0f753232011-12-22 01:48:48 +000082