| 1 |
// Tests that the declaration won't get emitted after being merged. |
| 2 |
// |
| 3 |
// RUN: rm -rf %t |
| 4 |
// RUN: mkdir -p %t |
| 5 |
// RUN: split-file %s %t |
| 6 |
// |
| 7 |
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/A.cppm -emit-module-interface -o %t/A.pcm |
| 8 |
// 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=%t |
| 10 |
// 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.cppm |
| 12 |
|
| 13 |
// Test again with reduced BMI. Note that we need to generate full BMI for B.cppm |
| 14 |
// since it is required to generate backend codes. |
| 15 |
// RUN: rm %t/A.pcm %t/B.pcm |
| 16 |
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm |
| 17 |
// 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=%t |
| 19 |
// 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.cppm |
| 21 |
|
| 22 |
|
| 23 |
//--- foo.h |
| 24 |
|
| 25 |
template <class T> |
| 26 |
class foo { |
| 27 |
public: |
| 28 |
T value; |
| 29 |
T GetValue() { return value; } |
| 30 |
}; |
| 31 |
|
| 32 |
template class foo<int>; |
| 33 |
|
| 34 |
//--- A.cppm |
| 35 |
module; |
| 36 |
#include "foo.h" |
| 37 |
export module A; |
| 38 |
export using ::foo; |
| 39 |
|
| 40 |
//--- B.cppm |
| 41 |
module; |
| 42 |
#include "foo.h" |
| 43 |
export module B; |
| 44 |
import A; |
| 45 |
export using ::foo; |
| 46 |
export int B() { |
| 47 |
foo<int> f; |
| 48 |
return f.GetValue(); |
| 49 |
} |
| 50 |
|
| 51 |
// CHECK-NOT: define{{.*}}@_ZN3fooIiE8GetValueEv |