[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:32:48 PDT 2025


================
@@ -560,11 +560,12 @@ bool AsmPrinter::doInitialization(Module &M) {
   }
 
   if (MAI->doesSupportDebugInformation()) {
-    bool EmitCodeView = M.getCodeViewFlag();
-    if (EmitCodeView &&
-        (TM.getTargetTriple().isOSWindows() || TM.getTargetTriple().isUEFI()))
+    // On Windows targets, emit minimal CodeView compiler info even when debug
+    // info is disabled.
+    if ((TM.getTargetTriple().isOSWindows() || TM.getTargetTriple().isUEFI()) &&
+        M.getNamedMetadata("llvm.dbg.cu"))
       Handlers.push_back(std::make_unique<CodeViewDebug>(this));
-    if (!EmitCodeView || M.getDwarfVersion()) {
+    if (M.getDwarfVersion() || !M.getCodeViewFlag()) {
----------------
cjacek wrote:

Done. I initially reordered the other check as well but reverted it to keep the more expensive check later. Thanks!

https://github.com/llvm/llvm-project/pull/142970


More information about the llvm-commits mailing list