Skip to content

Commit 54c32be

Browse files
authored
[HLSL] Set default DwarfVersion to 4 for HLSL. (#97854)
Set default DwarfVersion to 4 for HLSL to match DXIL which does not support DwarfVersion 5. Based on https://registry.khronos.org/SPIR-V/specs/unified1/DebugInfo.html SPIRV is currently using Dwarf4 as well. This is for the Dwarf Version 5 part of #96912.
1 parent b1e03d3 commit 54c32be

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

clang/lib/Driver/ToolChains/HLSL.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class LLVM_LIBRARY_VISIBILITY HLSLToolChain : public ToolChain {
5252
static std::optional<std::string> parseTargetProfile(StringRef TargetProfile);
5353
bool requiresValidation(llvm::opt::DerivedArgList &Args) const;
5454

55+
// Set default DWARF version to 4 for DXIL uses version 4.
56+
unsigned GetDefaultDwarfVersion() const override { return 4; }
57+
5558
private:
5659
mutable std::unique_ptr<tools::hlsl::Validator> Validator;
5760
};

clang/test/Driver/dxc_debug.hlsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
// CHECK: "-cc1"
1212
// CHECK-CV-SAME: -gcodeview
1313
// CHECK-SAME: "-debug-info-kind=constructor"
14-
// CHECK-DWARF-SAME: -dwarf-version
14+
// Make sure dwarf-version is 4.
15+
// CHECK-DWARF-SAME: -dwarf-version=4

0 commit comments

Comments
 (0)