2 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 O.cpp \
6 // RUN: -emit-module-interface -o O.pcm
7 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 O.pcm -S -emit-llvm \
8 // RUN: -o - | FileCheck %s --check-prefix=CHECK-O
10 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 P.cpp \
11 // RUN: -emit-module-interface -fmodule-file=O.pcm -o P.pcm
12 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 P.pcm -S -emit-llvm \
13 // RUN: -o - | FileCheck %s --check-prefix=CHECK-P
15 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 Q.cpp \
16 // RUN: -emit-module-interface -fmodule-file=O.pcm -o Q.pcm
17 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 Q.pcm -S -emit-llvm \
18 // RUN: -o - | FileCheck %s --check-prefix=CHECK-Q
20 // Testing cases where we can elide the module initializer guard variable.
22 // This module has no global inits and does not import any other module
29 // CHECK-O: define void @_ZGIW1O
30 // CHECK-O-LABEL: entry
31 // CHECK-O-NEXT: ret void
32 // CHECK-O-NOT: @_ZGIW1O__in_chrg
34 // This has no global inits but imports a module, and therefore needs a guard
43 // CHECK-P: define void @_ZGIW1P
44 // CHECK-P-LABEL: init
45 // CHECK-P: store i8 1, ptr @_ZGIW1P__in_chrg
46 // CHECK-P: call void @_ZGIW1O()
47 // CHECK-P-NOT: call void @__cxx_global_var_init
49 // This imports a module and has global inits, so needs a guard.
63 // CHECK-Q: define internal void @__cxx_global_var_init
64 // CHECK-Q: call {{.*}} @_ZNW1Q5QuackC1Ev
65 // CHECK-Q: define void @_ZGIW1Q
66 // CHECK-Q: store i8 1, ptr @_ZGIW1Q__in_chrg
67 // CHECK-Q: call void @_ZGIW1O()
68 // CHECK-Q: call void @__cxx_global_var_init