File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -840,6 +840,10 @@ CodeGenModule::EmitCXXGlobalInitFunc() {
840
840
// No Itanium initializer in header like modules.
841
841
if (M->isHeaderLikeModule ())
842
842
continue ;
843
+ // We're allowed to skip the initialization if we are sure it doesn't
844
+ // do any thing.
845
+ if (!M->isNamedModuleInterfaceHasInit ())
846
+ continue ;
843
847
llvm::FunctionType *FTy = llvm::FunctionType::get (VoidTy, false );
844
848
SmallString<256 > FnName;
845
849
{
Original file line number Diff line number Diff line change
1
+ // REQUIRES: !system-windows
2
+ //
3
+ // RUN: rm -rf %t
4
+ // RUN: mkdir -p %t
5
+ // RUN: split-file %s %t
6
+ //
7
+ // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Empty.cppm \
8
+ // RUN: -emit-module-interface -o %t/Empty.pcm
9
+ // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Empty2.cppm \
10
+ // RUN: -fprebuilt-module-path=%t -emit-module-interface -o %t/Empty2.pcm
11
+ // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/main.cpp \
12
+ // RUN: -fprebuilt-module-path=%t -emit-llvm -o - | FileCheck %t/main.cpp
13
+ // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Empty2.pcm \
14
+ // RUN: -fprebuilt-module-path=%t -emit-llvm -o - | FileCheck %t/Empty2.cppm
15
+
16
+ // --- Empty.cppm
17
+ export module Empty;
18
+
19
+ // --- Empty2.cppm
20
+ export module Empty2;
21
+ import Empty;
22
+
23
+ // CHECK-NOT: _ZGIW5Empty
24
+
25
+ // --- main.cpp
26
+ import Empty;
27
+ import Empty2;
28
+
29
+ // CHECK-NOT: _ZGIW5Empty
30
+ // CHECK-NOT: _ZGIW6Empty2
You can’t perform that action at this time.
0 commit comments