|
27 | 27 | // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 S.pcm -S -emit-llvm \
|
28 | 28 | // RUN: -o - | FileCheck %s --check-prefix=CHECK-S
|
29 | 29 |
|
| 30 | +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 T.cpp \ |
| 31 | +// RUN: -emit-module-interface -fmodule-file=S=S.pcm -fmodule-file=R=R.pcm -o T.pcm |
| 32 | +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 T.pcm -S -emit-llvm \ |
| 33 | +// RUN: -o - | FileCheck %s --check-prefix=CHECK-T |
| 34 | + |
| 35 | +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 U.cpp \ |
| 36 | +// RUN: -emit-module-interface -fmodule-file=T=T.pcm -fmodule-file=R=R.pcm -o U.pcm |
| 37 | +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 U.pcm -S -emit-llvm \ |
| 38 | +// RUN: -o - | FileCheck %s --check-prefix=CHECK-U |
| 39 | + |
30 | 40 | // Testing cases where we can elide the module initializer guard variable.
|
31 | 41 |
|
32 | 42 | // This module has no global inits and does not import any other module
|
@@ -96,3 +106,25 @@ export import R;
|
96 | 106 | // CHECK-S: define void @_ZGIW1S
|
97 | 107 | // CHECK-S: store i8 1, ptr @_ZGIW1S__in_chrg
|
98 | 108 | // CHECK-S: call{{.*}}@_ZGIW1R
|
| 109 | + |
| 110 | +// The module itself doesn't have a global init and it doesn't import any module. |
| 111 | +// But the global module fragment imports a module that needs an init. So needs a guard. |
| 112 | +//--- T.cpp |
| 113 | +module; |
| 114 | +import S; |
| 115 | +export module T; |
| 116 | + |
| 117 | +// CHECK-T: define void @_ZGIW1T |
| 118 | +// CHECK-T: store i8 1, ptr @_ZGIW1T__in_chrg |
| 119 | +// CHECK-T: call{{.*}}@_ZGIW1S |
| 120 | + |
| 121 | +// The module itself doesn't have a global init and it doesn't import any module. |
| 122 | +// But the private module fragment imports a module that needs an init. So needs a guard. |
| 123 | +//--- U.cpp |
| 124 | +export module U; |
| 125 | +module :private; |
| 126 | +import T; |
| 127 | + |
| 128 | +// CHECK-U: define void @_ZGIW1U |
| 129 | +// CHECK-U: store i8 1, ptr @_ZGIW1U__in_chrg |
| 130 | +// CHECK-U: call{{.*}}@_ZGIW1T |
0 commit comments