brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 2a84ef6 Raw
67 lines · plain
1// Testing that adding a new line in a module interface unit won't cause the BMI2// of consuming module unit changes.3//4// RUN: rm -rf %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm8// RUN: %clang_cc1 -std=c++20 %t/A.v1.cppm -emit-reduced-module-interface -o %t/A.v1.pcm9//10// The BMI may not be the same since the source location differs.11// RUN: not diff %t/A.pcm %t/A.v1.pcm &> /dev/null12//13// The BMI of B shouldn't change since all the locations remain the same.14// RUN: %clang_cc1 -std=c++20 %t/B.cppm -emit-reduced-module-interface -fmodule-file=A=%t/A.pcm \15// RUN:     -o %t/B.pcm16// RUN: %clang_cc1 -std=c++20 %t/B.cppm -emit-reduced-module-interface -fmodule-file=A=%t/A.v1.pcm \17// RUN:     -o %t/B.v1.pcm18// RUN: diff %t/B.v1.pcm %t/B.pcm  &> /dev/null19//20// The BMI of C may change since the locations for instantiations changes.21// RUN: %clang_cc1 -std=c++20 %t/C.cppm -emit-reduced-module-interface -fmodule-file=A=%t/A.pcm \22// RUN:     -o %t/C.pcm23// RUN: %clang_cc1 -std=c++20 %t/C.cppm -emit-reduced-module-interface -fmodule-file=A=%t/A.v1.pcm \24// RUN:     -o %t/C.v1.pcm25// RUN: not diff %t/C.v1.pcm %t/C.pcm  &> /dev/null26 27//--- A.cppm28export module A;29export template <class T>30struct C {31    T func() {32        return T(43);33    }34};35export int funcA() {36    return 43;37}38 39//--- A.v1.cppm40export module A;41 42export template <class T>43struct C {44    T func() {45        return T(43);46    }47};48export int funcA() {49    return 43;50}51 52//--- B.cppm53export module B;54import A;55 56export int funcB() {57    return funcA();58}59 60//--- C.cppm61export module C;62import A;63export inline void testD() {64    C<int> c;65    c.func();66}67