Skip to content

Commit

Permalink
[Driver][DXC] Accept debug flags (/Zi and /Qembed_debug)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bogner committed Aug 17, 2023
1 parent 2afcda6 commit be5c8de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -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">,
Expand Down Expand Up @@ -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)">;
14 changes: 14 additions & 0 deletions clang/test/Driver/dxc_debug.hlsl
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit be5c8de

Please sign in to comment.