|
| 1 | +// RUN: rm -rf %t |
| 2 | +// RUN: split-file %s %t |
| 3 | +// RUN: cd %t |
| 4 | +// |
| 5 | +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/a.cppm \ |
| 6 | +// RUN: -emit-module-interface -o %t/a.pcm |
| 7 | +// RUN: %clang_cc1 -std=c++20 -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 -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 -triple %itanium_abi_triple %t/c.pcm -S \ |
| 12 | +// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %t/c.cppm |
| 13 | +// |
| 14 | +// Be sure that we keep the same behavior as if optization not enabled. |
| 15 | +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -O3 %t/a.cppm \ |
| 16 | +// RUN: -emit-module-interface -o %t/a.pcm |
| 17 | +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -O3 %t/b.cppm \ |
| 18 | +// RUN: -emit-module-interface -fprebuilt-module-path=%t -o %t/b.pcm |
| 19 | +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -O3 %t/c.cppm \ |
| 20 | +// RUN: -emit-module-interface -fprebuilt-module-path=%t -o %t/c.pcm |
| 21 | +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -O3 %t/c.pcm \ |
| 22 | +// RUN: -S -emit-llvm -disable-llvm-passes -o - | FileCheck %t/c.cppm |
| 23 | + |
| 24 | +//--- a.cppm |
| 25 | +export module a; |
| 26 | +export int a() { |
| 27 | + return 43; |
| 28 | +} |
| 29 | + |
| 30 | +template <int C> |
| 31 | +int implicitly_inlined_template_function() { |
| 32 | + return C; |
| 33 | +} |
| 34 | + |
| 35 | +inline int reachable_inlined_a() { |
| 36 | + return 45; |
| 37 | +} |
| 38 | + |
| 39 | +int reachable_notinlined_a() { |
| 40 | + return 46; |
| 41 | +} |
| 42 | + |
| 43 | +export inline int inlined_a() { |
| 44 | + return 44 + reachable_inlined_a() + |
| 45 | + reachable_notinlined_a() + |
| 46 | + implicitly_inlined_template_function<47>(); |
| 47 | +} |
| 48 | + |
| 49 | +//--- b.cppm |
| 50 | +export module b; |
| 51 | +export import a; |
| 52 | +export int b() { |
| 53 | + return 43 + a(); |
| 54 | +} |
| 55 | +export inline int inlined_b() { |
| 56 | + return 44 + inlined_a() + a();; |
| 57 | +} |
| 58 | + |
| 59 | +//--- c.cppm |
| 60 | +export module c; |
| 61 | +export import b; |
| 62 | +export int c() { |
| 63 | + return 43 + b() + a() + inlined_b() + inlined_a(); |
| 64 | +} |
| 65 | + |
| 66 | +// CHECK: declare{{.*}}@_ZW1b1bv |
| 67 | +// CHECK: declare{{.*}}@_ZW1a1av |
| 68 | +// CHECK: define{{.*}}@_ZW1b9inlined_bv |
| 69 | +// CHECK: define{{.*}}@_ZW1a9inlined_av |
| 70 | +// CHECK: define{{.*}}@_ZW1a19reachable_inlined_av |
| 71 | +// CHECK: declare{{.*}}@_ZW1a22reachable_notinlined_av |
| 72 | +// CHECK: define{{.*}}@_ZW1a36implicitly_inlined_template_functionILi47EEiv |
0 commit comments