Clang Project

clang_source_code/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/p1.cpp
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
16export module aggregate.internal;
17export import a;
18export {
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
28export module aggregate;
29export 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
36import aggregate;
37A a;
38B b;
39C c;
40#endif
41