From 9592e88f59cfd399e9285cfec50a23675f43a43a Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sun, 17 Apr 2022 12:55:24 -0400 Subject: MachineModuleInfo: Don't allow dynamically setting DbgInfoAvailable This can be set up front, and used only as a cache. This avoids a field that looks like it requires MIR serialization. I believe this fixes 2 bugs for CodeView. First, this addresses a FIXME that the flag -diable-debug-info-print only works with DWARF. Second, it fixes emitting debug info with emissionKind NoDebug. --- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index c0b7883..83d77cb 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -608,18 +608,16 @@ static SourceLanguage MapDWLangToCVLang(unsigned DWLang) { void CodeViewDebug::beginModule(Module *M) { // If module doesn't have named metadata anchors or COFF debug section // is not available, skip any debug info related stuff. - NamedMDNode *CUs = M->getNamedMetadata("llvm.dbg.cu"); - if (!CUs || !Asm->getObjFileLowering().getCOFFDebugSymbolsSection()) { + if (!MMI->hasDebugInfo() || + !Asm->getObjFileLowering().getCOFFDebugSymbolsSection()) { Asm = nullptr; return; } - // Tell MMI that we have and need debug info. - MMI->setDebugInfoAvailability(true); TheCPU = mapArchToCVCPUType(Triple(M->getTargetTriple()).getArch()); // Get the current source language. - const MDNode *Node = *CUs->operands().begin(); + const MDNode *Node = *M->debug_compile_units_begin(); const auto *CU = cast(Node); CurrentSourceLanguage = MapDWLangToCVLang(CU->getSourceLanguage()); -- cgit v1.1