[clang] 54c32be - [HLSL] Set default DwarfVersion to 4 for HLSL. (#97854)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 10 17:17:49 PDT 2024
Author: Xiang Li
Date: 2024-07-10T20:17:45-04:00
New Revision: 54c32becf0991e60261bf8e80caee43cc6c0d65f
URL: https://github.com/llvm/llvm-project/commit/54c32becf0991e60261bf8e80caee43cc6c0d65f
DIFF: https://github.com/llvm/llvm-project/commit/54c32becf0991e60261bf8e80caee43cc6c0d65f.diff
LOG: [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.
Added:
Modified:
clang/lib/Driver/ToolChains/HLSL.h
clang/test/Driver/dxc_debug.hlsl
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/HLSL.h b/clang/lib/Driver/ToolChains/HLSL.h
index 7b775b8974318..b2a31aabab7dc 100644
--- a/clang/lib/Driver/ToolChains/HLSL.h
+++ b/clang/lib/Driver/ToolChains/HLSL.h
@@ -52,6 +52,9 @@ class LLVM_LIBRARY_VISIBILITY HLSLToolChain : public ToolChain {
static std::optional<std::string> parseTargetProfile(StringRef TargetProfile);
bool requiresValidation(llvm::opt::DerivedArgList &Args) const;
+ // Set default DWARF version to 4 for DXIL uses version 4.
+ unsigned GetDefaultDwarfVersion() const override { return 4; }
+
private:
mutable std::unique_ptr<tools::hlsl::Validator> Validator;
};
diff --git a/clang/test/Driver/dxc_debug.hlsl b/clang/test/Driver/dxc_debug.hlsl
index 9e207da85d5de..0eab32168982b 100644
--- a/clang/test/Driver/dxc_debug.hlsl
+++ b/clang/test/Driver/dxc_debug.hlsl
@@ -11,4 +11,5 @@
// CHECK: "-cc1"
// CHECK-CV-SAME: -gcodeview
// CHECK-SAME: "-debug-info-kind=constructor"
-// CHECK-DWARF-SAME: -dwarf-version
+// Make sure dwarf-version is 4.
+// CHECK-DWARF-SAME: -dwarf-version=4
More information about the cfe-commits
mailing list