Douglas Gregor | a1be278 | 2011-12-17 23:38:30 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
| 2 | // RUN: %clang_cc1 -fmodule-cache-path %t -I %S/Inputs %s -verify |
Douglas Gregor | 68d7bb9 | 2011-12-19 14:42:41 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -I %S/Inputs %s -verify |
Douglas Gregor | a1be278 | 2011-12-17 23:38:30 +0000 | [diff] [blame] | 4 | __import_module__ redecl_merge_left; |
| 5 | __import_module__ redecl_merge_right; |
| 6 | |
| 7 | @implementation A |
| 8 | - (Super*)init { return self; } |
| 9 | @end |
| 10 | |
| 11 | void f(A *a) { |
| 12 | [a init]; |
| 13 | } |
| 14 | |
| 15 | @class A; |
| 16 | |
Douglas Gregor | adafc2e | 2011-12-19 16:14:14 +0000 | [diff] [blame] | 17 | B *f1() { |
| 18 | return [B create_a_B]; |
| 19 | } |
| 20 | |
Douglas Gregor | ecb1938 | 2011-12-19 15:27:36 +0000 | [diff] [blame] | 21 | @class B; |
| 22 | |
Douglas Gregor | 2ccd89c | 2011-12-20 18:11:52 +0000 | [diff] [blame] | 23 | // Test redeclarations of entities in explicit submodules, to make |
| 24 | // sure we're maintaining the declaration chains even when normal name |
| 25 | // lookup can't see what we're looking for. |
| 26 | void testExplicit() { |
| 27 | Explicit *e; |
| 28 | int *(*fp)(void) = &explicit_func; |
| 29 | int *ip = explicit_func(); |
| 30 | |
| 31 | // FIXME: Should complain about definition not having been imported. |
| 32 | struct explicit_struct es = { 0 }; |
| 33 | } |
| 34 | |
Douglas Gregor | a1be278 | 2011-12-17 23:38:30 +0000 | [diff] [blame] | 35 | __import_module__ redecl_merge_bottom; |
| 36 | |
Douglas Gregor | ecb1938 | 2011-12-19 15:27:36 +0000 | [diff] [blame] | 37 | @implementation B |
Douglas Gregor | adafc2e | 2011-12-19 16:14:14 +0000 | [diff] [blame] | 38 | + (B*)create_a_B { return 0; } |
Douglas Gregor | ecb1938 | 2011-12-19 15:27:36 +0000 | [diff] [blame] | 39 | @end |
| 40 | |
Douglas Gregor | a1be278 | 2011-12-17 23:38:30 +0000 | [diff] [blame] | 41 | void g(A *a) { |
| 42 | [a init]; |
| 43 | } |
Douglas Gregor | f63b0a5 | 2011-12-19 18:19:24 +0000 | [diff] [blame] | 44 | |
| 45 | #ifdef __cplusplus |
| 46 | void testVector() { |
Douglas Gregor | fc529f7 | 2011-12-19 19:00:47 +0000 | [diff] [blame] | 47 | Vector<int> vec_int; |
| 48 | vec_int.push_back(0); |
Douglas Gregor | f63b0a5 | 2011-12-19 18:19:24 +0000 | [diff] [blame] | 49 | } |
| 50 | #endif |