52 lines · plain
1// Tests that the declaration won't get emitted after being merged.2//3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/A.cppm -emit-module-interface -o %t/A.pcm8// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/B.cppm -emit-module-interface -o %t/B.pcm \9// RUN: -fprebuilt-module-path=%t10// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/B.pcm -emit-llvm -o - \11// RUN: -fprebuilt-module-path=%t | FileCheck %t/B.cppm12 13// Test again with reduced BMI. Note that we need to generate full BMI for B.cppm14// since it is required to generate backend codes.15// RUN: rm %t/A.pcm %t/B.pcm16// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm17// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/B.cppm -emit-module-interface -o %t/B.pcm \18// RUN: -fprebuilt-module-path=%t19// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/B.pcm -emit-llvm -o - \20// RUN: -fprebuilt-module-path=%t | FileCheck %t/B.cppm21 22 23//--- foo.h24 25template <class T>26class foo {27public:28 T value;29 T GetValue() { return value; }30};31 32template class foo<int>;33 34//--- A.cppm35module;36#include "foo.h"37export module A;38export using ::foo;39 40//--- B.cppm41module;42#include "foo.h"43export module B;44import A;45export using ::foo;46export int B() {47 foo<int> f;48 return f.GetValue();49}50 51// CHECK-NOT: define{{.*}}@_ZN3fooIiE8GetValueEv52