blob: 7b06adcce43cf5a970971cdfd2843eba9bb9a5c2 [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 Gregora1be2782011-12-17 23:38:30 +000058__import_module__ redecl_merge_bottom;
59
Douglas Gregorecb19382011-12-19 15:27:36 +000060@implementation B
Douglas Gregoradafc2e2011-12-19 16:14:14 +000061+ (B*)create_a_B { return 0; }
Douglas Gregorecb19382011-12-19 15:27:36 +000062@end
63
Douglas Gregora1be2782011-12-17 23:38:30 +000064void g(A *a) {
65 [a init];
66}
Douglas Gregorf63b0a52011-12-19 18:19:24 +000067
68#ifdef __cplusplus
69void testVector() {
Douglas Gregorfc529f72011-12-19 19:00:47 +000070 Vector<int> vec_int;
71 vec_int.push_back(0);
Douglas Gregorf63b0a52011-12-19 18:19:24 +000072}
73#endif
Douglas Gregor0f753232011-12-22 01:48:48 +000074