From e08b4f2e23bbc829103852ab1867683f14702daa Mon Sep 17 00:00:00 2001 From: Shubham Sandeep Rastogi Date: Thu, 1 May 2025 13:44:09 -0700 Subject: [PATCH] Print source filename when invalid debug info is found in LTO. When invalid debug info is found in a module during LTO, the debug info from that module is stripped. However, we do not print the source filename, which makes it impossible to figure out where the invalid debug info is coming from. This patch prints the source file name. --- llvm/lib/LTO/LTOCodeGenerator.cpp | 1 + llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 70b7135fcbef0..bd0dfed76e3d4 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -548,6 +548,7 @@ void LTOCodeGenerator::verifyMergedModuleOnce() { report_fatal_error("Broken module found, compilation aborted!"); if (BrokenDebugInfo) { emitWarning("Invalid debug info found, debug info will be stripped"); + emitWarning("Source FileName: " + MergedModule->getSourceFileName()); StripDebugInfo(*MergedModule); } } diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 42dba0abe245f..5c4883c8ddae9 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -182,6 +182,8 @@ static void verifyLoadedModule(Module &TheModule) { if (BrokenDebugInfo) { TheModule.getContext().diagnose(ThinLTODiagnosticInfo( "Invalid debug info found, debug info will be stripped", DS_Warning)); + TheModule.getContext().diagnose(ThinLTODiagnosticInfo( + "Source File Name: " + TheModule.getSourceFileName(), DS_Warning)); StripDebugInfo(TheModule); } }