Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Richard Smith | 0279375 | 2015-03-27 21:16:39 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -DTEXTUAL |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery |
Richard Smith | 4241314 | 2015-05-15 20:05:43 +0000 | [diff] [blame^] | 4 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL |
| 5 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 6 | |
| 7 | // Trigger import of definitions, but don't make them visible. |
| 8 | #include "empty.h" |
| 9 | |
| 10 | A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}} |
Richard Smith | 9a71c99 | 2015-03-27 20:16:58 +0000 | [diff] [blame] | 11 | // expected-note@defs.h:1 +{{here}} |
| 12 | // FIXME: We should warn that use_a is being used without being imported. |
| 13 | int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 14 | |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 15 | B::Inner2 pre_bi; // expected-error +{{must be imported}} |
| 16 | // expected-note@defs.h:4 +{{here}} |
Richard Smith | d6aab59 | 2015-03-27 21:57:41 +0000 | [diff] [blame] | 17 | // expected-note@defs.h:11 +{{here}} |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 18 | |
| 19 | C_Base<1> pre_cb1; // expected-error +{{must be imported}} |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 20 | // expected-note@defs.h:15 +{{here}} |
Richard Smith | d6aab59 | 2015-03-27 21:57:41 +0000 | [diff] [blame] | 21 | C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} |
| 22 | // expected-note@defs.h:17 +{{here}} |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 23 | C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} |
Richard Smith | d6aab59 | 2015-03-27 21:57:41 +0000 | [diff] [blame] | 24 | // expected-note@defs.h:18 +{{here}} |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 25 | |
Richard Smith | a523022 | 2015-03-27 01:37:43 +0000 | [diff] [blame] | 26 | D::X pre_dx; // expected-error +{{must be imported}} |
Richard Smith | d6aab59 | 2015-03-27 21:57:41 +0000 | [diff] [blame] | 27 | // expected-note@defs.h:20 +{{here}} |
| 28 | // expected-note@defs.h:21 +{{here}} |
Richard Smith | 9a71c99 | 2015-03-27 20:16:58 +0000 | [diff] [blame] | 29 | // FIXME: We should warn that use_dx is being used without being imported. |
| 30 | int pre_use_dx = use_dx(pre_dx); |
Richard Smith | a523022 | 2015-03-27 01:37:43 +0000 | [diff] [blame] | 31 | |
Richard Smith | d6aab59 | 2015-03-27 21:57:41 +0000 | [diff] [blame] | 32 | int pre_e = E(0); // expected-error {{must be imported}} |
| 33 | // expected-note@defs.h:24 +{{here}} |
| 34 | |
| 35 | int pre_ff = F<int>().f(); // expected-error +{{must be imported}} |
| 36 | int pre_fg = F<int>().g<int>(); // expected-error +{{must be imported}} |
| 37 | // expected-note@defs.h:26 +{{here}} |
| 38 | |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 39 | // Make definitions from second module visible. |
Richard Smith | 0279375 | 2015-03-27 21:16:39 +0000 | [diff] [blame] | 40 | #ifdef TEXTUAL |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 41 | #include "import-and-redefine.h" |
Richard Smith | 0279375 | 2015-03-27 21:16:39 +0000 | [diff] [blame] | 42 | #else |
| 43 | #include "merged-defs.h" |
| 44 | #endif |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 45 | |
| 46 | A post_a; |
Richard Smith | 9a71c99 | 2015-03-27 20:16:58 +0000 | [diff] [blame] | 47 | int post_use_a = use_a(post_a); |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 48 | B::Inner2 post_bi; |
| 49 | C_Base<1> post_cb1; |
| 50 | C1 c1; |
| 51 | C2 c2; |
Richard Smith | a523022 | 2015-03-27 01:37:43 +0000 | [diff] [blame] | 52 | D::X post_dx; |
Richard Smith | 9a71c99 | 2015-03-27 20:16:58 +0000 | [diff] [blame] | 53 | int post_use_dx = use_dx(post_dx); |
Richard Smith | d6aab59 | 2015-03-27 21:57:41 +0000 | [diff] [blame] | 54 | int post_e = E(0); |
| 55 | int post_ff = F<char>().f(); |
| 56 | int post_fg = F<char>().g<int>(); |