Skip to content

Commit ee64896

Browse files
author
git apple-llvm automerger
committed
Merge commit '863b2e599016' from llvm.org/release/19.x into stable/20240723
2 parents fb110a0 + 863b2e5 commit ee64896

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7089,8 +7089,8 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
70897089
// For C++ standard modules we are done - we will call the module
70907090
// initializer for imported modules, and that will likewise call those for
70917091
// any imports it has.
7092-
if (CXX20ModuleInits && Import->getImportedOwningModule() &&
7093-
!Import->getImportedOwningModule()->isModuleMapModule())
7092+
if (CXX20ModuleInits && Import->getImportedModule() &&
7093+
Import->getImportedModule()->isNamedModule())
70947094
break;
70957095

70967096
// For clang C++ module map modules the initializers for sub-modules are
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: rm -rf %t
2+
// RUN: mkdir -p %t
3+
// RUN: split-file %s %t
4+
//
5+
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
6+
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/a.cpp -fmodule-file=a=%t/a.pcm -emit-llvm -o - | FileCheck %t/a.cpp
7+
8+
//--- a.cppm
9+
export module a;
10+
int func();
11+
static int a = func();
12+
13+
//--- a.cpp
14+
import a;
15+
16+
// CHECK-NOT: internal global
17+
// CHECK-NOT: __cxx_global_var_init
18+

0 commit comments

Comments
 (0)