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

via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 2 03:32:04 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Liu Ke (Sockke)

<details>
<summary>Changes</summary>

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?

---
Full diff: https://github.com/llvm/llvm-project/pull/146666.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/BackendUtil.cpp (+1) 


``````````diff
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 =

``````````

</details>


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


More information about the cfe-commits mailing list