From f8dadefd4afc8e1b7b9a1e69a0ba8df051e03328 Mon Sep 17 00:00:00 2001 From: Jonas Hahnfeld Date: Fri, 28 Jul 2023 15:43:11 +0200 Subject: [CodeGen] Keep track of eagerly emitted globals An inline virtual function must be emitted, but we need to remember it and emit the same definition again in the future in case later LLVM optimizations stripped it from the Module. The added test case shows the problem; before this patch, it would fail with: Symbols not found: [ _ZN1AD0Ev, _ZN1AD1Ev ] Differential Revision: https://reviews.llvm.org/D156537 --- clang/lib/CodeGen/CodeGenModule.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 517af514d9c9..440fb040a43c 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3658,6 +3658,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { if (MustBeEmitted(Global) && MayBeEmittedEagerly(Global)) { // Emit the definition if it can't be deferred. EmitGlobalDefinition(GD); + addEmittedDeferredDecl(GD); return; } -- cgit v1.2.3