Skip to content

Commit 0888551

Browse files
authored
Support DWARF5 static member as DW_TAG_variable (#2229)
This resolves #2224
1 parent dd1f598 commit 0888551

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

lib/SPIRV/LLVMToSPIRVDbgTran.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ SPIRVEntry *LLVMToSPIRVDbgTran::transDbgEntryImpl(const MDNode *MDN) {
359359
return transDbgLocalVariable(LV);
360360
if (const DIGlobalVariable *GV = dyn_cast<DIGlobalVariable>(DIEntry))
361361
return transDbgGlobalVariable(GV);
362+
if (const DIDerivedType *MT = dyn_cast<DIDerivedType>(DIEntry))
363+
if (MT->isStaticMember())
364+
return transDbgMemberType(MT);
362365
llvm_unreachable("Unxpected debug info type for variable");
363366
case dwarf::DW_TAG_formal_parameter:
364367
return transDbgLocalVariable(cast<DILocalVariable>(DIEntry));

test/DebugInfo/Generic/dwarf-public-names.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ attributes #1 = { nounwind readnone }
109109
!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 1, size: 8, align: 8, elements: !4)
110110
!3 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
111111
!4 = !{!5, !7, !12}
112-
!5 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", scope: !2, file: !3, line: 4, baseType: !6, flags: DIFlagStaticMember)
112+
!5 = !DIDerivedType(tag: DW_TAG_variable, name: "static_member_variable", scope: !2, file: !3, line: 4, baseType: !6, flags: DIFlagStaticMember)
113113
!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
114114
!7 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11)
115115
!8 = !DISubroutineType(types: !9)

test/DebugInfo/NonSemantic/static_member_array.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ target triple = "spir64-unknown-unknown"
6666
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
6767
!10 = !{!11}
6868
!11 = !DISubrange(count: 4)
69-
!12 = !DIDerivedType(tag: DW_TAG_member, name: "smem", scope: !13, file: !3, line: 4, baseType: !16, flags: DIFlagStaticMember)
69+
!12 = !DIDerivedType(tag: DW_TAG_variable, name: "smem", scope: !13, file: !3, line: 4, baseType: !16, flags: DIFlagStaticMember)
7070
!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 1, size: 8, elements: !14, identifier: "_ZTS1A")
7171
!14 = !{!15, !12}
72-
!15 = !DIDerivedType(tag: DW_TAG_member, name: "fully_specified", scope: !13, file: !3, line: 3, baseType: !9, flags: DIFlagStaticMember)
72+
!15 = !DIDerivedType(tag: DW_TAG_variable, name: "fully_specified", scope: !13, file: !3, line: 3, baseType: !9, flags: DIFlagStaticMember)
7373
!16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, elements: !17)
7474
!17 = !{!18}
7575
!18 = !DISubrange(count: -1)

0 commit comments

Comments
 (0)