Skip to content

Commit 1f4d6fe

Browse files
pratikasharigcbot
authored andcommitted
Fix bug where class type was encoded as struct type in dwarf.
1 parent e5b67d8 commit 1f4d6fe

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ class SPIRVToLLVMDbgTran {
463463
flags |= llvm::DINode::FlagPrivate;
464464
if (spirvFlags & SPIRVDebug::FlagIsObjectPointer)
465465
flags |= llvm::DINode::FlagObjectPointer;
466+
if (spirvFlags & SPIRVDebug::FlagIsStaticMember)
467+
flags |= llvm::DINode::FlagStaticMember;
466468

467469
return flags;
468470
}
@@ -746,8 +748,14 @@ class SPIRVToLLVMDbgTran {
746748
}
747749
else if (tag == SPIRVDebug::CompositeTypeTag::Class)
748750
{
749-
newNode = addMDNode(inst, Builder.createClassType(scope, name,
750-
file, line, size, 0, 0, flags, derivedFrom, DINodeArray()));
751+
// TODO: should be replaced with createClassType, when bug with creating
752+
// ClassType with llvm::dwarf::DW_TAG_struct_type tag will be fixed
753+
auto CT = Builder.createReplaceableCompositeType(
754+
llvm::dwarf::DW_TAG_class_type, name, scope, file, line, 0,
755+
size, 0, flags);
756+
CT = llvm::MDNode::replaceWithDistinct(llvm::TempDICompositeType(CT));
757+
758+
newNode = addMDNode(inst, CT);
751759
}
752760

753761
SmallVector<Metadata*, 6> elements;

0 commit comments

Comments
 (0)