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

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


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

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.

>From 7a677572ccdcac13d2a88f72bad33dfb5c2ff0a6 Mon Sep 17 00:00:00 2001
From: Ilia Kuklin <ikuklin at accesssoftek.com>
Date: Sat, 18 Jul 2026 20:10:42 +0500
Subject: [PATCH] [DirectX] Fix `--dx-embed-debug` flag dependency

---
 llvm/lib/Target/DirectX/DXContainerGlobals.cpp        | 6 +-----
 llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp | 6 +++++-
 2 files changed, 6 insertions(+), 6 deletions(-)

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"),



More information about the llvm-commits mailing list