[llvm] [DirectX] Fix `--dx-embed-debug` flag dependency (PR #210513)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 18 08:16:32 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-directx

Author: Ilia Kuklin (kuilpd)

<details>
<summary>Changes</summary>

This patch moves the definition of `cl::opt<std::string> PdbDebugPath` from `DXContainerGlobals.cpp` to `DXILWriter/DXILWriterPass.cpp`, reversing the dependency.
Fixes the layering violation in #<!-- -->204166.

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


2 Files Affected:

- (modified) llvm/lib/Target/DirectX/DXContainerGlobals.cpp (+1-5) 
- (modified) llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp (+5-1) 


``````````diff
diff --git a/llvm/lib/Target/DirectX/DXContainerGlobals.cpp b/llvm/lib/Target/DirectX/DXContainerGlobals.cpp
index 7b033c3249008..f9cf43e67f1fb 100644
--- a/llvm/lib/Target/DirectX/DXContainerGlobals.cpp
+++ b/llvm/lib/Target/DirectX/DXContainerGlobals.cpp
@@ -41,11 +41,7 @@ using namespace llvm::mcdxbc;
 
 static cl::opt<bool> ShaderHashDependsOnSource(
     "dx-Zss", cl::desc("Compute Shader Hash considering source information"));
-cl::opt<std::string> PdbDebugPath(
-    "dx-pdb-path",
-    cl::desc("Write debug information to the given file, or automatically "
-             "named file in directory when ending in '/'"),
-    cl::value_desc("filename"));
+extern cl::opt<std::string> PdbDebugPath;
 extern cl::opt<bool> SourceInDebugModule;
 
 namespace {
diff --git a/llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp b/llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp
index 9c61e4c1acb93..442ea1131beb9 100644
--- a/llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp
+++ b/llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp
@@ -38,7 +38,11 @@ using namespace llvm::dxil;
 
 extern cl::opt<bool> EmbedDebug;
 extern cl::opt<bool> StripDebug;
-extern cl::opt<std::string> PdbDebugPath;
+cl::opt<std::string> PdbDebugPath(
+    "dx-pdb-path",
+    cl::desc("Write debug information to the given file, or automatically "
+             "named file in directory when ending in '/'"),
+    cl::value_desc("filename"));
 cl::opt<bool> SourceInDebugModule(
     "dx-source-in-debug-module",
     cl::desc("Embed source code into debug module on DirectX target"),

``````````

</details>


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


More information about the llvm-commits mailing list