xref: /llvm-project/clang/test/Modules/no-import-func-body.cppm (revision 7e59223ac4b045178c287a56154113d5989572f4)
1// RUN: rm -rf %t
2// RUN: split-file %s %t
3// RUN: cd %t
4//
5// RUN: %clang_cc1 -std=c++20 -O1 -triple %itanium_abi_triple %t/a.cppm \
6// RUN:     -emit-module-interface -o %t/a.pcm
7// RUN: %clang_cc1 -std=c++20 -O1 -triple %itanium_abi_triple %t/b.cppm \
8// RUN:     -emit-module-interface -fprebuilt-module-path=%t -o %t/b.pcm
9// RUN: %clang_cc1 -std=c++20 -O1 -triple %itanium_abi_triple %t/c.cppm \
10// RUN:     -emit-module-interface -fprebuilt-module-path=%t -o %t/c.pcm
11// RUN: %clang_cc1 -std=c++20 -O1 -triple %itanium_abi_triple %t/c.pcm \
12// RUN:     -fprebuilt-module-path=%t -emit-llvm -disable-llvm-passes -o - \
13// RUN:     | FileCheck %t/c.cppm
14
15//--- a.cppm
16export module a;
17export int a() {
18    return 43;
19}
20export __attribute__((noinline)) int a_noinline() {
21    return 44;
22}
23
24//--- b.cppm
25export module b;
26export import a;
27export int b() {
28    return 43 + a();
29}
30
31export __attribute__((noinline)) int b_noinline() {
32    return 43 + a();
33}
34
35//--- c.cppm
36export module c;
37export import b;
38export int c() {
39    return 43 + b() + a() + b_noinline() + a_noinline();
40}
41
42// CHECK: declare{{.*}}@_ZW1b1bv(
43// CHECK: declare{{.*}}@_ZW1a1av(
44
45// CHECK: declare{{.*}}@_ZW1b10b_noinlinev()
46// CHECK: declare{{.*}}@_ZW1a10a_noinlinev()
47