Skip to content

Commit

Permalink
[Backport to 16][DebugInfo] Fix EnumClass support (#2876)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matborzyszkowski committed Dec 17, 2024
1 parent bb57356 commit bfc45bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/SPIRV/LLVMToSPIRVDbgTran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ SPIRVWord mapDebugFlags(DINode::DIFlags DFlags) {
Flags |= SPIRVDebug::FlagTypePassByValue;
if (DFlags & DINode::FlagTypePassByReference)
Flags |= SPIRVDebug::FlagTypePassByReference;
if (DFlags & DINode::FlagEnumClass)
Flags |= SPIRVDebug::FlagIsEnumClass;
return Flags;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/SPIRV/SPIRVToLLVMDbgTran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ DINode *SPIRVToLLVMDbgTran::transTypeEnum(const SPIRVExtInst *DebugInst) {
UnderlyingType = transDebugInst<DIType>(static_cast<SPIRVExtInst *>(E));
return getDIBuilder(DebugInst).createEnumerationType(
Scope, Name, File, LineNo, SizeInBits, AlignInBits, Enumerators,
UnderlyingType, "", UnderlyingType);
UnderlyingType, "", Flags & SPIRVDebug::FlagIsEnumClass);
}
}

Expand Down

0 comments on commit bfc45bf

Please sign in to comment.