brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 83594b0 Raw
103 lines · plain
1// Testing that changing a declaration in an unused module file won't change 2// the BMI of the current module file.3//4// RUN: rm -rf %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 %t/m-partA.cppm -emit-reduced-module-interface -o %t/m-partA.pcm8// RUN: %clang_cc1 -std=c++20 %t/m-partA.v1.cppm -emit-reduced-module-interface -o \9// RUN:     %t/m-partA.v1.pcm10// RUN: %clang_cc1 -std=c++20 %t/m-partB.cppm -emit-reduced-module-interface -o %t/m-partB.pcm11// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-reduced-module-interface -o %t/m.pcm \12// RUN:     -fmodule-file=m:partA=%t/m-partA.pcm -fmodule-file=m:partB=%t/m-partB.pcm13// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-reduced-module-interface -o %t/m.v1.pcm \14// RUN:     -fmodule-file=m:partA=%t/m-partA.v1.pcm -fmodule-file=m:partB=%t/m-partB.pcm15//16// RUN: %clang_cc1 -std=c++20 %t/useBOnly.cppm -emit-reduced-module-interface -o %t/useBOnly.pcm \17// RUN:     -fmodule-file=m=%t/m.pcm -fmodule-file=m:partA=%t/m-partA.pcm \18// RUN:     -fmodule-file=m:partB=%t/m-partB.pcm19// RUN: %clang_cc1 -std=c++20 %t/useBOnly.cppm -emit-reduced-module-interface -o %t/useBOnly.v1.pcm \20// RUN:     -fmodule-file=m=%t/m.v1.pcm -fmodule-file=m:partA=%t/m-partA.v1.pcm \21// RUN:     -fmodule-file=m:partB=%t/m-partB.pcm22// Since useBOnly only uses partB from module M, the change in partA shouldn't affect23// useBOnly.24// RUN: diff %t/useBOnly.pcm %t/useBOnly.v1.pcm &> /dev/null25 26//--- m-partA.cppm27export module m:partA;28 29namespace A_Impl {30    inline int getAImpl() {31        return 43;32    }33 34    inline int getA2Impl() {35        return 43;36    }37}38 39namespace A {40    using A_Impl::getAImpl;41}42 43export inline int getA() {44    return 43;45}46 47//--- m-partA.v1.cppm48export module m:partA;49 50namespace A_Impl {51    inline int getAImpl() {52        return 43;53    }54 55    inline int getA2Impl() {56        return 43;57    }58}59 60namespace A {61    using A_Impl::getAImpl;62    using A_Impl::getA2Impl;63}64 65inline int getA() {66    return 43;67}68 69// The consuming module which didn't use m:partA completely is expected to be70// not changed.71inline int getB(int) {72    return 88;73}74 75//--- m-partB.cppm76export module m:partB;77 78export inline int getB() {79    return 430;80}81 82//--- m.cppm83export module m;84export import :partA;85export import :partB;86 87//--- useBOnly.cppm88export module useBOnly;89import m;90 91export inline int get() {92    return getB();93}94 95//--- useAOnly.cppm96export module useAOnly;97import m;98 99export inline int get() {100    A<int> a;101    return a.getValue();102}103