1 // Test that, in C++20 modules reduced BMI, the implementation detail changes
2 // in non-inline function may not propagate while the inline function changes
6 // RUN: split-file %s %t
9 // RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm
10 // RUN: %clang_cc1 -std=c++20 %t/a.v1.cppm -emit-reduced-module-interface -o %t/a.v1.pcm
12 // The BMI of A should differ since the different implementation.
13 // RUN: not diff %t/a.pcm %t/a.v1.pcm &> /dev/null
15 // The BMI of B should change since the dependent inline function changes
16 // RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -fmodule-file=a=%t/a.pcm \
18 // RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -fmodule-file=a=%t/a.v1.pcm \
19 // RUN: -o %t/b.v1.pcm
20 // RUN: not diff %t/b.v1.pcm %t/b.pcm &> /dev/null
22 // Test the case with unused partitions.
23 // RUN: %clang_cc1 -std=c++20 %t/M-A.cppm -emit-reduced-module-interface -o %t/M-A.pcm
24 // RUN: %clang_cc1 -std=c++20 %t/M-B.cppm -emit-reduced-module-interface -o %t/M-B.pcm
25 // RUN: %clang_cc1 -std=c++20 %t/M.cppm -emit-reduced-module-interface -o %t/M.pcm \
26 // RUN: -fmodule-file=M:partA=%t/M-A.pcm \
27 // RUN: -fmodule-file=M:partB=%t/M-B.pcm
28 // RUN: %clang_cc1 -std=c++20 %t/N.cppm -emit-reduced-module-interface -o %t/N.pcm \
29 // RUN: -fmodule-file=M:partA=%t/M-A.pcm \
30 // RUN: -fmodule-file=M:partB=%t/M-B.pcm \
31 // RUN: -fmodule-file=M=%t/M.pcm
33 // Now we change `M-A.cppm` to `M-A.v1.cppm`.
34 // RUN: %clang_cc1 -std=c++20 %t/M-A.v1.cppm -emit-reduced-module-interface -o %t/M-A.v1.pcm
35 // RUN: %clang_cc1 -std=c++20 %t/M.cppm -emit-reduced-module-interface -o %t/M.v1.pcm \
36 // RUN: -fmodule-file=M:partA=%t/M-A.v1.pcm \
37 // RUN: -fmodule-file=M:partB=%t/M-B.pcm
38 // RUN: %clang_cc1 -std=c++20 %t/N.cppm -emit-reduced-module-interface -o %t/N.v1.pcm \
39 // RUN: -fmodule-file=M:partA=%t/M-A.v1.pcm \
40 // RUN: -fmodule-file=M:partB=%t/M-B.pcm \
41 // RUN: -fmodule-file=M=%t/M.v1.pcm
43 // The BMI of N can keep unchanged since the N didn't use the changed partition unit 'M:A'.
44 // RUN: diff %t/N.v1.pcm %t/N.pcm &> /dev/null
48 export inline int a() {
54 export inline int a() {
61 export inline int b() {
66 export module M:partA;
67 export inline int a() {
72 export module M:partA;
73 export inline int a() {
78 export module M:partB;
79 export inline int b() {
92 export inline int n() {