brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · cfce669 Raw
95 lines · plain
1// Test that, in C++20 modules reduced BMI, the implementation detail changes2// in non-inline function may not propagate while the inline function changes3// can get propagate.4//5// RUN: rm -rf %t6// RUN: split-file %s %t7// RUN: cd %t8//9// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm10// RUN: %clang_cc1 -std=c++20 %t/a.v1.cppm -emit-reduced-module-interface -o %t/a.v1.pcm11//12// The BMI of A should differ since the different implementation.13// RUN: not diff %t/a.pcm %t/a.v1.pcm &> /dev/null14//15// The BMI of B should change since the dependent inline function changes16// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -fmodule-file=a=%t/a.pcm \17// RUN:     -o %t/b.pcm18// 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.pcm20// RUN: not diff %t/b.v1.pcm %t/b.pcm  &> /dev/null21//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.pcm24// RUN: %clang_cc1 -std=c++20 %t/M-B.cppm -emit-reduced-module-interface -o %t/M-B.pcm25// 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.pcm28// 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.pcm32//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.pcm35// 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.pcm38// 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.pcm42//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/null45 46//--- a.cppm47export module a;48export inline int a() {49    return 48;50}51 52//--- a.v1.cppm53export module a;54export inline int a() {55    return 50;56}57 58//--- b.cppm59export module b;60import a;61export inline int b() {62    return a();63}64 65//--- M-A.cppm66export module M:partA;67export inline int a() {68    return 43;69}70 71//--- M-A.v1.cppm72export module M:partA;73export inline int a() {74    return 50;75}76 77//--- M-B.cppm78export module M:partB;79export inline int b() {80    return 44;81}82 83//--- M.cppm84export module M;85export import :partA;86export import :partB;87 88//--- N.cppm89export module N;90import M;91 92export inline int n() {93    return b();94}95