diff options
author | Hamza Sood <hamza_sood@me.com> | 2017-11-21 09:42:42 +0000 |
---|---|---|
committer | Hamza Sood <hamza_sood@me.com> | 2017-11-21 09:42:42 +0000 |
commit | adcd5e304127e6e9b8c90d6b45cdac63077633da (patch) | |
tree | a52c110c2e3ddeb17a0742d5a973ce2119227cad /test/CXX | |
parent | 08e4943d2e28243ec44f9b92882272aa3d69a53b (diff) |
[Modules TS] Added module re-export support.
This implements [dcl.modules.export] from the C++ Modules TS, which lets a module re-export another module with the "export import" syntax.
Differential Revision: https://reviews.llvm.org/D40270
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r-- | test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/p1.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/p1.cpp b/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/p1.cpp new file mode 100644 index 0000000000..ab8c690441 --- /dev/null +++ b/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/p1.cpp @@ -0,0 +1,40 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// +// RUN: echo 'export module a; export class A{};' | %clang_cc1 -x c++ -fmodules-ts -emit-module-interface - -o %t/a.pcm +// RUN: echo 'export module b; export class B{};' | %clang_cc1 -x c++ -fmodules-ts -emit-module-interface - -o %t/b.pcm +// RUN: echo 'export module c; export class C{};' | %clang_cc1 -x c++ -fmodules-ts -emit-module-interface - -o %t/c.pcm +// +// RUN: %clang_cc1 -fmodules-ts -fprebuilt-module-path=%t -emit-module-interface %s -o %t/aggregate.internal.pcm -DAGGREGATE_INTERNAL +// RUN: %clang_cc1 -fmodules-ts -fprebuilt-module-path=%t -emit-module-interface %s -o %t/aggregate.pcm -DAGGREGATE +// +// RUN: %clang_cc1 -fmodules-ts -fprebuilt-module-path=%t %s -verify -DTEST +// expected-no-diagnostics + + +#ifdef AGGREGATE_INTERNAL +export module aggregate.internal; +export import a; +export { + import b; + import c; +} +#endif + + +// Export the above aggregate module. +// This is done to ensure that re-exports are transitive. +#ifdef AGGREGATE +export module aggregate; +export import aggregate.internal; +#endif + + +// For the actual test, just try using the classes from the exported modules +// and hope that they're accessible. +#ifdef TEST +import aggregate; +A a; +B b; +C c; +#endif |