diff options
| author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2024-04-18 16:54:22 +0800 |
|---|---|---|
| committer | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2024-04-30 16:33:34 +0800 |
| commit | b2b463bd8f6b21f040b80c4493682cf74f8dced5 (patch) | |
| tree | 8b6bb68dec423f270281fca8c4c2ef4f73d12599 /clang/test/Modules/force-transitive-changes.cppm | |
| parent | 7ac1fb01e9b70d09e6c4f39414bcd7c93787ef91 (diff) | |
[C++20] [Modules] Add signature to the BMI recording export imported
modules
After https://github.com/llvm/llvm-project/pull/86912,
for the following example,
```
export module A;
export import B;
```
The generated BMI of `A` won't change if the source location in `A`
changes. Further, we plan avoid more such changes.
However, it is slightly problematic since `export import` should
propagate all the changes.
So this patch adds a signature to the BMI of C++20 modules so that we
can propagate the changes correctly.
Diffstat (limited to 'clang/test/Modules/force-transitive-changes.cppm')
| -rw-r--r-- | clang/test/Modules/force-transitive-changes.cppm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/Modules/force-transitive-changes.cppm b/clang/test/Modules/force-transitive-changes.cppm new file mode 100644 index 000000000000..5732d264d1d5 --- /dev/null +++ b/clang/test/Modules/force-transitive-changes.cppm @@ -0,0 +1,38 @@ +// Test that the changes from export imported modules and touched +// modules can be popullated as expected. +// +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: cd %t +// +// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm +// RUN: %clang_cc1 -std=c++20 %t/A.v1.cppm -emit-reduced-module-interface -o %t/A.v1.pcm + +// The BMI of B should change it export imports A, so all the change to A should be popullated +// to B. +// RUN: %clang_cc1 -std=c++20 %t/B.cppm -emit-reduced-module-interface -fmodule-file=A=%t/A.pcm \ +// RUN: -o %t/B.pcm +// RUN: %clang_cc1 -std=c++20 %t/B.cppm -emit-reduced-module-interface -fmodule-file=A=%t/A.v1.pcm \ +// RUN: -o %t/B.v1.pcm +// RUN: not diff %t/B.v1.pcm %t/B.pcm &> /dev/null + +//--- A.cppm +export module A; +export int funcA() { + return 43; +} + +//--- A.v1.cppm +export module A; + +export int funcA() { + return 43; +} + +//--- B.cppm +export module B; +export import A; + +export int funcB() { + return funcA(); +} |
