[clang] [DebugInfo] Init DwarfVersion of MCOptions like the other. (PR #146666)

Liu Ke via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 2 03:31:34 PDT 2025


https://github.com/Sockke created https://github.com/llvm/llvm-project/pull/146666

Should the backend's DwarfVersion be initialized like other options? Previously, -gdwarf-xxx did not take effect in the backend—was there a specific reason for this?

>From 1a402b04e60ef3c74c8a3a7ecb3ef0439415d6ec Mon Sep 17 00:00:00 2001
From: Sockke <liuke.gehry at bytedance.com>
Date: Wed, 2 Jul 2025 16:54:29 +0800
Subject: [PATCH] Init DwarfVersion of MCOptions like the other.

---
 clang/lib/CodeGen/BackendUtil.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 1c92ea45c7458..9cee6281a43f6 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -486,6 +486,7 @@ static bool initTargetOptions(const CompilerInstance &CI,
     break;
   }
 
+  Options.MCOptions.DwarfVersion = CodeGenOpts.DwarfVersion;
   Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
   Options.MCOptions.EmitDwarfUnwind = CodeGenOpts.getEmitDwarfUnwind();
   Options.MCOptions.EmitCompactUnwindNonCanonical =



More information about the cfe-commits mailing list