| 1 |
// Although the reduced BMI are not designed to be generated, |
| 2 |
// it is helpful for testing whether we've reduced the definitions. |
| 3 |
// |
| 4 |
// RUN: rm -rf %t |
| 5 |
// RUN: mkdir -p %t |
| 6 |
// RUN: split-file %s %t |
| 7 |
// |
| 8 |
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/a.cppm \ |
| 9 |
// RUN: -emit-reduced-module-interface -o %t/a.pcm |
| 10 |
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/b.cpp \ |
| 11 |
// RUN: -fmodule-file=a=%t/a.pcm -emit-llvm -o - \ |
| 12 |
// RUN: | FileCheck %t/b.cpp |
| 13 |
|
| 14 |
//--- a.cppm |
| 15 |
export module a; |
| 16 |
|
| 17 |
export template <class T> |
| 18 |
class A { |
| 19 |
public: |
| 20 |
int member() { |
| 21 |
return 43; |
| 22 |
} |
| 23 |
}; |
| 24 |
|
| 25 |
// Instantiate `A<int>::member()`. |
| 26 |
export int a_member = A<int>().member(); |
| 27 |
|
| 28 |
export const int a = 43; |
| 29 |
|
| 30 |
//--- b.cpp |
| 31 |
import a; |
| 32 |
|
| 33 |
static_assert(a == 43); |
| 34 |
|
| 35 |
int b() { |
| 36 |
A<int> a; |
| 37 |
return a.member(); |
| 38 |
} |
| 39 |
|
| 40 |
// CHECK: define{{.*}}@_ZNW1a1AIiE6memberEv |