|
| 1 | +; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t |
| 2 | +; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s |
| 3 | + |
| 4 | +; Check for a variant part where a variant has multiple members. |
| 5 | + |
| 6 | +; CHECK: DW_AT_name [DW_FORM_str{{[a-z]+}}] ({{.*}} = "Discr") |
| 7 | +; CHECK: DW_TAG_variant_part |
| 8 | +; CHECK-NOT: TAG |
| 9 | +; CHECK: DW_AT_discr [DW_FORM_ref4] (cu + {{0x[0-9a-fA-F]+}} => {[[OFFSET:0x[0-9a-fA-F]+]]}) |
| 10 | +; CHECK: DW_TAG_variant |
| 11 | +; CHECK: DW_AT_discr_value [DW_FORM_data1] (0x4a) |
| 12 | +; CHECK: DW_TAG_member |
| 13 | +; CHECK: DW_AT_name [DW_FORM_str{{[a-z]+}}] ({{.*}} = "field0") |
| 14 | +; CHECK: DW_AT_type |
| 15 | +; CHECK: DW_AT_alignment |
| 16 | +; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00) |
| 17 | +; CHECK: DW_TAG_member |
| 18 | +; CHECK: DW_AT_name [DW_FORM_str{{[a-z]+}}] ({{.*}} = "field1") |
| 19 | +; CHECK: DW_AT_type |
| 20 | +; CHECK: DW_AT_alignment |
| 21 | +; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x08) |
| 22 | +; CHECK: DW_TAG_variant |
| 23 | +; CHECK: DW_AT_discr_value [DW_FORM_data1] (0x4b) |
| 24 | +; CHECK: DW_TAG_member |
| 25 | +; CHECK: DW_AT_name [DW_FORM_str{{[a-z]+}}] ({{.*}} = "field2") |
| 26 | +; CHECK: DW_AT_type |
| 27 | +; CHECK: DW_AT_alignment |
| 28 | +; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00) |
| 29 | + |
| 30 | +%F = type { [0 x i8], ptr, [8 x i8] } |
| 31 | + |
| 32 | +define internal void @_ZN2e34main17h934ff72f9a38d4bbE() unnamed_addr #0 !dbg !5 { |
| 33 | +start: |
| 34 | + %qq = alloca %F, align 8 |
| 35 | + call void @llvm.dbg.declare(metadata ptr %qq, metadata !10, metadata !24), !dbg !25 |
| 36 | + store ptr null, ptr %qq, !dbg !25 |
| 37 | + ret void, !dbg !26 |
| 38 | +} |
| 39 | + |
| 40 | +; Function Attrs: nounwind readnone |
| 41 | +declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 |
| 42 | + |
| 43 | +attributes #0 = { nounwind uwtable } |
| 44 | + |
| 45 | +!llvm.module.flags = !{!0, !1} |
| 46 | +!llvm.dbg.cu = !{!2} |
| 47 | + |
| 48 | +!0 = !{i32 1, !"PIE Level", i32 2} |
| 49 | +!1 = !{i32 2, !"Debug Info Version", i32 3} |
| 50 | +!2 = distinct !DICompileUnit(language: DW_LANG_Ada95, file: !3, producer: "gnat-llvm", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4) |
| 51 | +!3 = !DIFile(filename: "e3.rs", directory: "/home/tromey/Ada") |
| 52 | +!4 = !{} |
| 53 | +!5 = distinct !DISubprogram(name: "main", linkageName: "_ZN2e34mainE", scope: !6, file: !3, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagMainSubprogram, isOptimized: false, unit: !2, templateParams: !4, retainedNodes: !4) |
| 54 | +!6 = !DINamespace(name: "e3", scope: null) |
| 55 | +!7 = !DIFile(filename: "<unknown>", directory: "") |
| 56 | +!8 = !DISubroutineType(types: !9) |
| 57 | +!9 = !{null} |
| 58 | +!10 = !DILocalVariable(name: "qq", scope: !11, file: !3, line: 3, type: !12, align: 64) |
| 59 | +!11 = distinct !DILexicalBlock(scope: !5, file: !3, line: 3, column: 4) |
| 60 | +!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "F", scope: !6, file: !7, size: 128, align: 64, elements: !13, identifier: "7ce1efff6b82281ab9ceb730566e7e20") |
| 61 | +!13 = !{!14, !15} |
| 62 | +!14 = !DIDerivedType(tag: DW_TAG_member, name: "Discr", scope: !12, file: !7, baseType: !23, size: 64, align: 64) |
| 63 | +!15 = !DICompositeType(tag: DW_TAG_variant_part, scope: !12, file: !7, size: 128, align: 64, elements: !16, identifier: "7ce1efff6b82281ab9ceb730566e7e20", discriminator: !14) |
| 64 | +!16 = !{!17, !22} |
| 65 | +!17 = !DIDerivedType(tag: DW_TAG_member, scope: !15, file: !7, baseType: !18, size: 128, align: 64, extraData: i32 74) |
| 66 | +!18 = !DICompositeType(tag: DW_TAG_variant, scope: !15, file: !7, size: 128, align: 64, elements: !19) |
| 67 | +!19 = !{!20, !21} |
| 68 | +!20 = !DIDerivedType(tag: DW_TAG_member, name: "field0", scope: !18, file: !7, baseType: !23, size: 64, align: 64, offset: 0) |
| 69 | +!21 = !DIDerivedType(tag: DW_TAG_member, name: "field1", scope: !18, file: !7, baseType: !23, size: 64, align: 64, offset: 64) |
| 70 | +!22 = !DIDerivedType(tag: DW_TAG_member, name: "field2", scope: !15, file: !7, baseType: !23, size: 64, align: 64, offset: 0, extraData: i32 75) |
| 71 | +!23 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) |
| 72 | +!24 = !DIExpression() |
| 73 | +!25 = !DILocation(line: 3, scope: !11) |
| 74 | +!26 = !DILocation(line: 4, scope: !5) |
0 commit comments