57 lines · plain
1// https://github.com/llvm/llvm-project/issues/597802//3// RUN: rm -rf %t4// RUN: mkdir %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 %t/a.cppm -triple %itanium_abi_triple -emit-module-interface -o %t/a.pcm8// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fprebuilt-module-path=%t \9// RUN: -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %t/use.cpp10// RUN: %clang_cc1 -std=c++20 %t/a.pcm -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %t/a.cppm11 12// Test again with reduced BMI.13// RUN: %clang_cc1 -std=c++20 %t/a.cppm -triple %itanium_abi_triple -emit-module-interface \14// RUN: -o %t/a.full.pcm15// RUN: %clang_cc1 -std=c++20 %t/a.cppm -triple %itanium_abi_triple -emit-reduced-module-interface \16// RUN: -o %t/a.pcm17// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fprebuilt-module-path=%t \18// RUN: -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %t/use.cpp19// RUN: %clang_cc1 -std=c++20 %t/a.full.pcm -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %t/a.cppm20 21 22//--- a.cppm23export module a;24 25export template<typename T>26int x = 0;27 28export template<>29int x<int> = 0;30 31export template<typename T>32struct Y {33 static int value;34};35 36template <typename T>37int Y<T>::value = 0;38 39export template<>40struct Y<int> {41 static int value;42};43 44int Y<int>::value = 0;45 46// CHECK-NOT: @_ZW1a1xIiE = {{.*}}external{{.*}}global47// CHECK-NOT: @_ZNW1a1YIiE5valueE = {{.*}}external{{.*}}global48 49//--- use.cpp50import a;51int foo() {52 return x<int> + Y<int>::value;53}54 55// CHECK: @_ZW1a1xIiE = {{.*}}external{{.*}}global56// CHECK: @_ZNW1a1YIiE5valueE = {{.*}}external{{.*}}global57