1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 2// RUN: rm -rf %t 3// RUN: split-file %s %t 4// 5// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -xc++-user-header -emit-header-unit %t/header.h -o %t/header.pcm 6// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -fmodule-file=%t/header.pcm %t/M.cppm -emit-llvm -o - | FileCheck %t/M.cppm 7// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -fmodule-file=%t/header.pcm %t/Use.cpp -emit-llvm -o - | FileCheck %t/Use.cpp 8// 9//--- header.h 10int foo(); 11static int i = foo(); 12 13//--- M.cppm 14module; 15import "header.h"; 16export module M; 17 18// CHECK: @_ZL1i = {{.*}}global i32 0 19// CHECK: void @__cxx_global_var_init() 20// CHECK-NEXT: entry: 21// CHECK-NEXT: %call = call noundef{{.*}} i32 @_Z3foov() 22// CHECK-NEXT: store i32 %call, ptr @_ZL1i 23 24//--- Use.cpp 25import "header.h"; 26 27// CHECK: @_ZL1i = {{.*}}global i32 0 28// CHECK: void @__cxx_global_var_init() 29// CHECK-NEXT: entry: 30// CHECK-NEXT: %call = call noundef{{.*}} i32 @_Z3foov() 31// CHECK-NEXT: store i32 %call, ptr @_ZL1i 32