xref: /llvm-project/clang/test/Modules/reduced-bmi-generating-codes.cppm (revision 7c1d9b15eee3a34678addab2bab66f3020ac0753)
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
15export module a;
16
17export template <class T>
18class A {
19public:
20    int member() {
21        return 43;
22    }
23};
24
25// Instantiate `A<int>::member()`.
26export int a_member = A<int>().member();
27
28export const int a = 43;
29
30//--- b.cpp
31import a;
32
33static_assert(a == 43);
34
35int b() {
36    A<int> a;
37    return a.member();
38}
39
40// CHECK: define{{.*}}@_ZNW1a1AIiE6memberEv
41