From 49788deb6573e88c8271dfcdd49a18e66d61b5d1 Mon Sep 17 00:00:00 2001 From: "Borzyszkowski, Mateusz" Date: Tue, 17 Dec 2024 11:44:17 +0100 Subject: [PATCH] [Backport to 17][DebugInfo] Fix EnumClass support (#2876) This commit addresses issues with EnumClass handling in DebugEnumType. In reverse translation, a bug caused the EnumClass flag to be incorrectly applied to every DebugEnumType with an UnderlyingType. Additionally, in forward translation, the support for EnumClassFlag was missing entirely. --- lib/SPIRV/LLVMToSPIRVDbgTran.cpp | 2 ++ lib/SPIRV/SPIRVToLLVMDbgTran.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/SPIRV/LLVMToSPIRVDbgTran.cpp b/lib/SPIRV/LLVMToSPIRVDbgTran.cpp index 5fb56e2f27..5f0f1e535c 100644 --- a/lib/SPIRV/LLVMToSPIRVDbgTran.cpp +++ b/lib/SPIRV/LLVMToSPIRVDbgTran.cpp @@ -495,6 +495,8 @@ SPIRVWord LLVMToSPIRVDbgTran::mapDebugFlags(DINode::DIFlags DFlags) { if (BM->getDebugInfoEIS() == SPIRVEIS_NonSemantic_Shader_DebugInfo_200) if (DFlags & DINode::FlagBitField) Flags |= SPIRVDebug::FlagBitField; + if (DFlags & DINode::FlagEnumClass) + Flags |= SPIRVDebug::FlagIsEnumClass; return Flags; } diff --git a/lib/SPIRV/SPIRVToLLVMDbgTran.cpp b/lib/SPIRV/SPIRVToLLVMDbgTran.cpp index aa5f9140b7..5b3996306e 100644 --- a/lib/SPIRV/SPIRVToLLVMDbgTran.cpp +++ b/lib/SPIRV/SPIRVToLLVMDbgTran.cpp @@ -799,7 +799,7 @@ DINode *SPIRVToLLVMDbgTran::transTypeEnum(const SPIRVExtInst *DebugInst) { UnderlyingType = transDebugInst(static_cast(E)); return getDIBuilder(DebugInst).createEnumerationType( Scope, Name, File, LineNo, SizeInBits, AlignInBits, Enumerators, - UnderlyingType, "", UnderlyingType); + UnderlyingType, 0, "", Flags & SPIRVDebug::FlagIsEnumClass); } }