llvm-project/clang/test/Modules/force-transitive-changes.cppm
Chuanqi Xu b2b463bd8f [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.
2024-04-30 16:33:34 +08:00

39 lines
984 B
C++

// 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();
}