[clang] be5c8de - [Driver][DXC] Accept debug flags (/Zi and /Qembed_debug)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 16:19:31 PDT 2023


Author: Justin Bogner
Date: 2023-08-17T16:19:09-07:00
New Revision: be5c8dea1e1de5df98df656c6e4c92a3f6682661

URL: https://github.com/llvm/llvm-project/commit/be5c8dea1e1de5df98df656c6e4c92a3f6682661
DIFF: https://github.com/llvm/llvm-project/commit/be5c8dea1e1de5df98df656c6e4c92a3f6682661.diff

LOG: [Driver][DXC] Accept debug flags (/Zi and /Qembed_debug)

This adds /Zi handling and explicitly ignores /Qembed_debug, which
should make our command line handling compatible enough with dxc that
we can share logic on compiler explorer.

Differential Revision: https://reviews.llvm.org/D158113

Added: 
    clang/test/Driver/dxc_debug.hlsl

Modified: 
    clang/include/clang/Driver/Options.td

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 0ef80dafd0586b..0e02b6c754d9d8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -7869,7 +7869,7 @@ def _SLASH_ZH_SHA1 : CLFlag<"ZH:SHA1">,
 def _SLASH_ZH_SHA_256 : CLFlag<"ZH:SHA_256">,
   HelpText<"Use SHA256 for file checksums in debug info">,
   Alias<gsrc_hash_EQ>, AliasArgs<["sha256"]>;
-def _SLASH_Zi : CLFlag<"Zi">, Alias<g_Flag>,
+def _SLASH_Zi : CLFlag<"Zi", [CLOption, DXCOption]>, Alias<g_Flag>,
   HelpText<"Like /Z7">;
 def _SLASH_Zp : CLJoined<"Zp">,
   HelpText<"Set default maximum struct packing alignment">,
@@ -8202,3 +8202,6 @@ def dxc_validator_path_EQ : Joined<["--"], "dxv-path=">, Group<dxc_Group>,
   HelpText<"DXIL validator installation path">;
 def dxc_disable_validation : DXCFlag<"Vd">,
   HelpText<"Disable validation">;
+def : Option<["/", "-"], "Qembed_debug", KIND_FLAG>, Group<dxc_Group>,
+  Flags<[Ignored, NoXarchOption]>, Visibility<[DXCOption]>,
+  HelpText<"Embed PDB in shader container (ignored)">;

diff  --git a/clang/test/Driver/dxc_debug.hlsl b/clang/test/Driver/dxc_debug.hlsl
new file mode 100644
index 00000000000000..9e207da85d5de8
--- /dev/null
+++ b/clang/test/Driver/dxc_debug.hlsl
@@ -0,0 +1,14 @@
+// RUN: %clang_dxc -Tlib_6_7 -### -g %s 2>&1 | FileCheck %s
+// RUN: %clang_dxc -Tlib_6_7 -### /Zi %s 2>&1 | FileCheck %s
+// RUN: %clang_dxc -Tlib_6_7 -### /Zi /Qembed_debug %s 2>&1 | FileCheck %s
+// RUN: %clang_dxc -Tlib_6_7 -### -Zi %s 2>&1 | FileCheck %s
+// RUN: %clang_dxc -Tlib_6_7 -### -Zi -Qembed_debug %s 2>&1 | FileCheck %s
+// RUN: %clang_dxc -Tlib_6_7 -### -Zi -gcodeview %s 2>&1 | FileCheck %s -check-prefixes=CHECK,CHECK-CV
+// RUN: %clang_dxc -Tlib_6_7 -### -Zi -gdwarf %s 2>&1 | FileCheck %s -check-prefixes=CHECK,CHECK-DWARF
+// RUN: %clang_dxc -Tlib_6_7 -### -gcodeview -Zi %s 2>&1 | FileCheck %s -check-prefixes=CHECK,CHECK-CV
+// RUN: %clang_dxc -Tlib_6_7 -### -gdwarf -Zi %s 2>&1 | FileCheck %s -check-prefixes=CHECK,CHECK-DWARF
+
+// CHECK: "-cc1"
+// CHECK-CV-SAME: -gcodeview
+// CHECK-SAME: "-debug-info-kind=constructor"
+// CHECK-DWARF-SAME: -dwarf-version


        


More information about the cfe-commits mailing list