| 1 | // RUN: rm -rf %t |
| 2 | // RUN: mkdir -p %t |
| 3 | // |
| 4 | // RUN: echo 'export module a; export class A{};' | %clang_cc1 -x c++ -fmodules-ts -emit-module-interface - -o %t/a.pcm |
| 5 | // RUN: echo 'export module b; export class B{};' | %clang_cc1 -x c++ -fmodules-ts -emit-module-interface - -o %t/b.pcm |
| 6 | // RUN: echo 'export module c; export class C{};' | %clang_cc1 -x c++ -fmodules-ts -emit-module-interface - -o %t/c.pcm |
| 7 | // |
| 8 | // RUN: %clang_cc1 -fmodules-ts -fprebuilt-module-path=%t -emit-module-interface %s -o %t/aggregate.internal.pcm -DAGGREGATE_INTERNAL |
| 9 | // RUN: %clang_cc1 -fmodules-ts -fprebuilt-module-path=%t -emit-module-interface %s -o %t/aggregate.pcm -DAGGREGATE |
| 10 | // |
| 11 | // RUN: %clang_cc1 -fmodules-ts -fprebuilt-module-path=%t %s -verify -DTEST |
| 12 | // expected-no-diagnostics |
| 13 | |
| 14 | |
| 15 | #ifdef AGGREGATE_INTERNAL |
| 16 | export module aggregate.internal; |
| 17 | export import a; |
| 18 | export { |
| 19 | import b; |
| 20 | import c; |
| 21 | } |
| 22 | #endif |
| 23 | |
| 24 | |
| 25 | // Export the above aggregate module. |
| 26 | // This is done to ensure that re-exports are transitive. |
| 27 | #ifdef AGGREGATE |
| 28 | export module aggregate; |
| 29 | export import aggregate.internal; |
| 30 | #endif |
| 31 | |
| 32 | |
| 33 | // For the actual test, just try using the classes from the exported modules |
| 34 | // and hope that they're accessible. |
| 35 | #ifdef TEST |
| 36 | import aggregate; |
| 37 | A a; |
| 38 | B b; |
| 39 | C c; |
| 40 | #endif |
| 41 | |