From d748d6b999f0e941452e210fd4adb2634ed560cf Mon Sep 17 00:00:00 2001 From: "Borzyszkowski, Mateusz" Date: Tue, 17 Dec 2024 13:30:40 +0100 Subject: [PATCH] [Backport to 14][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 3f141f315f..53c62b545e 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 7cf4721420..bbca25f33d 100644 --- a/lib/SPIRV/SPIRVToLLVMDbgTran.cpp +++ b/lib/SPIRV/SPIRVToLLVMDbgTran.cpp @@ -805,7 +805,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, "", Flags & SPIRVDebug::FlagIsEnumClass); } }