diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGenCXX/module-initializer-header.cppm | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/module-initializer-header.cppm b/clang/test/CodeGenCXX/module-initializer-header.cppm new file mode 100644 index 0000000..253f096 --- /dev/null +++ b/clang/test/CodeGenCXX/module-initializer-header.cppm @@ -0,0 +1,31 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: rm -rf %t +// RUN: split-file %s %t +// +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -xc++-user-header -emit-header-unit %t/header.h -o %t/header.pcm +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -fmodule-file=%t/header.pcm %t/M.cppm -S -emit-llvm -o - | FileCheck %t/M.cppm +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -fmodule-file=%t/header.pcm %t/Use.cpp -S -emit-llvm -o - | FileCheck %t/Use.cpp +// +//--- header.h +int foo(); +int i = foo(); + +//--- M.cppm +module; +import "header.h"; +export module M; + +// CHECK: @i = {{.*}}global i32 0 +// CHECK: void @__cxx_global_var_init() +// CHECK-NEXT: entry: +// CHECK-NEXT: %call = call noundef{{.*}} i32 @_Z3foov() +// CHECK-NEXT: store i32 %call, ptr @i + +//--- Use.cpp +import "header.h"; + +// CHECK: @i = {{.*}}global i32 0 +// CHECK: void @__cxx_global_var_init() +// CHECK-NEXT: entry: +// CHECK-NEXT: %call = call noundef{{.*}} i32 @_Z3foov() +// CHECK-NEXT: store i32 %call, ptr @i |