[clang] [llvm] [CodeGen][COFF] Always emit CodeView compiler info on Windows targets (PR #142970)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 6 10:39:13 PDT 2025
================
@@ -613,19 +613,30 @@ 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.
- if (!Asm->hasDebugInfo() ||
- !Asm->getObjFileLowering().getCOFFDebugSymbolsSection()) {
+ if (!Asm->getObjFileLowering().getCOFFDebugSymbolsSection()) {
Asm = nullptr;
return;
}
TheCPU = mapArchToCVCPUType(M->getTargetTriple().getArch());
// Get the current source language.
- const MDNode *Node = *M->debug_compile_units_begin();
+ const MDNode *Node;
+ if (Asm->hasDebugInfo()) {
+ Node = *M->debug_compile_units_begin();
+ } else {
+ // When emitting only compiler information, we may have only NoDebug CUs,
+ // which would be skipped by debug_compile_units_begin.
+ NamedMDNode *CUs = MMI->getModule()->getNamedMetadata("llvm.dbg.cu");
+ Node = *CUs->operands().begin();
+ }
const auto *CU = cast<DICompileUnit>(Node);
CurrentSourceLanguage = MapDWLangToCVLang(CU->getSourceLanguage());
+ NoDebug =
----------------
cjacek wrote:
When using the DWARF debug format, we may have debug info (and therefore not take the else branch above), but we still want to set this to false and return early here.
https://github.com/llvm/llvm-project/pull/142970
More information about the llvm-commits
mailing list