Skip to content

Commit be5c8de

Browse files
committed
[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
1 parent 2afcda6 commit be5c8de

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7869,7 +7869,7 @@ def _SLASH_ZH_SHA1 : CLFlag<"ZH:SHA1">,
78697869
def _SLASH_ZH_SHA_256 : CLFlag<"ZH:SHA_256">,
78707870
HelpText<"Use SHA256 for file checksums in debug info">,
78717871
Alias<gsrc_hash_EQ>, AliasArgs<["sha256"]>;
7872-
def _SLASH_Zi : CLFlag<"Zi">, Alias<g_Flag>,
7872+
def _SLASH_Zi : CLFlag<"Zi", [CLOption, DXCOption]>, Alias<g_Flag>,
78737873
HelpText<"Like /Z7">;
78747874
def _SLASH_Zp : CLJoined<"Zp">,
78757875
HelpText<"Set default maximum struct packing alignment">,
@@ -8202,3 +8202,6 @@ def dxc_validator_path_EQ : Joined<["--"], "dxv-path=">, Group<dxc_Group>,
82028202
HelpText<"DXIL validator installation path">;
82038203
def dxc_disable_validation : DXCFlag<"Vd">,
82048204
HelpText<"Disable validation">;
8205+
def : Option<["/", "-"], "Qembed_debug", KIND_FLAG>, Group<dxc_Group>,
8206+
Flags<[Ignored, NoXarchOption]>, Visibility<[DXCOption]>,
8207+
HelpText<"Embed PDB in shader container (ignored)">;

clang/test/Driver/dxc_debug.hlsl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %clang_dxc -Tlib_6_7 -### -g %s 2>&1 | FileCheck %s
2+
// RUN: %clang_dxc -Tlib_6_7 -### /Zi %s 2>&1 | FileCheck %s
3+
// RUN: %clang_dxc -Tlib_6_7 -### /Zi /Qembed_debug %s 2>&1 | FileCheck %s
4+
// RUN: %clang_dxc -Tlib_6_7 -### -Zi %s 2>&1 | FileCheck %s
5+
// RUN: %clang_dxc -Tlib_6_7 -### -Zi -Qembed_debug %s 2>&1 | FileCheck %s
6+
// RUN: %clang_dxc -Tlib_6_7 -### -Zi -gcodeview %s 2>&1 | FileCheck %s -check-prefixes=CHECK,CHECK-CV
7+
// RUN: %clang_dxc -Tlib_6_7 -### -Zi -gdwarf %s 2>&1 | FileCheck %s -check-prefixes=CHECK,CHECK-DWARF
8+
// RUN: %clang_dxc -Tlib_6_7 -### -gcodeview -Zi %s 2>&1 | FileCheck %s -check-prefixes=CHECK,CHECK-CV
9+
// RUN: %clang_dxc -Tlib_6_7 -### -gdwarf -Zi %s 2>&1 | FileCheck %s -check-prefixes=CHECK,CHECK-DWARF
10+
11+
// CHECK: "-cc1"
12+
// CHECK-CV-SAME: -gcodeview
13+
// CHECK-SAME: "-debug-info-kind=constructor"
14+
// CHECK-DWARF-SAME: -dwarf-version

0 commit comments

Comments
 (0)