Skip to content

Commit 0fec1b8

Browse files
[Backport to 16][DebugInfo] Fix EnumClass support (KhronosGroup#2876) (KhronosGroup#2940)
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.
1 parent 709e9c1 commit 0fec1b8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/SPIRV/LLVMToSPIRVDbgTran.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,8 @@ SPIRVWord mapDebugFlags(DINode::DIFlags DFlags) {
471471
Flags |= SPIRVDebug::FlagTypePassByValue;
472472
if (DFlags & DINode::FlagTypePassByReference)
473473
Flags |= SPIRVDebug::FlagTypePassByReference;
474+
if (DFlags & DINode::FlagEnumClass)
475+
Flags |= SPIRVDebug::FlagIsEnumClass;
474476
return Flags;
475477
}
476478

lib/SPIRV/SPIRVToLLVMDbgTran.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ DINode *SPIRVToLLVMDbgTran::transTypeEnum(const SPIRVExtInst *DebugInst) {
671671
UnderlyingType = transDebugInst<DIType>(static_cast<SPIRVExtInst *>(E));
672672
return getDIBuilder(DebugInst).createEnumerationType(
673673
Scope, Name, File, LineNo, SizeInBits, AlignInBits, Enumerators,
674-
UnderlyingType, "", UnderlyingType);
674+
UnderlyingType, "", Flags & SPIRVDebug::FlagIsEnumClass);
675675
}
676676
}
677677

0 commit comments

Comments
 (0)