Work around a memory leak caught by the LSAN bot.

Fundamentally the problem here is that SILPassManager is creating an IRGenModule
without calling finalize() on it under some circumstances. It would be better to
fix that instead.

rdar://123923517
This commit is contained in:
Adrian Prantl
2024-03-20 13:02:46 -07:00
parent 0f5dc13339
commit 0742c01806
2 changed files with 10 additions and 2 deletions

View File

@@ -1947,6 +1947,9 @@ bool IRGenModule::finalize() {
// Finalize clang IR-generation.
finalizeClangCodeGen();
if (DebugInfo)
DebugInfo->finalize();
// If that failed, report failure up and skip the final clean-up.
if (!ClangCodeGen->GetModule())
return false;
@@ -1955,8 +1958,6 @@ bool IRGenModule::finalize() {
emitAutolinkInfo();
emitGlobalLists();
emitUsedConditionals();
if (DebugInfo)
DebugInfo->finalize();
cleanupClangCodeGenMetadata();
// Clean up DSOLocal & DLLImport attributes, they cannot be applied together.