diff options
| author | Jonas Hahnfeld <jonas.hahnfeld@cern.ch> | 2023-07-28 15:43:11 +0200 |
|---|---|---|
| committer | Jonas Hahnfeld <jonas.hahnfeld@cern.ch> | 2023-08-17 13:26:22 +0200 |
| commit | f8dadefd4afc8e1b7b9a1e69a0ba8df051e03328 (patch) | |
| tree | 96acd0eb35173b9bc3299395427c9d36960bf480 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | 3c2432690ad2bcc7a4d186f94dad2efcdee55cef (diff) | |
[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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
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; } |
