1; REQUIRES: object-emission 2 3; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t 4; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s 5 6; Check for a variant part that has two members, one of which has a 7; discriminant value. 8 9; CHECK: DW_TAG_variant_part 10; CHECK-NOT: TAG 11; CHECK: DW_AT_discr [DW_FORM_ref4] (cu + {{0x[0-9a-fA-F]+}} => {[[OFFSET:0x[0-9a-fA-F]+]]}) 12; CHECK-NOT: TAG 13; CHECK: [[OFFSET]]: DW_TAG_member 14; CHECK: DW_AT_type 15; CHECK: DW_AT_alignment 16; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00) 17; CHECK: DW_AT_artificial [DW_FORM_flag_present] (true) 18; CHECK: DW_TAG_variant 19; CHECK: DW_TAG_member 20; CHECK: DW_AT_type 21; CHECK: DW_AT_alignment 22; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00) 23; CHECK: DW_TAG_variant 24; CHECK: DW_AT_discr_value [DW_FORM_data1] (0x00) 25; CHECK: DW_TAG_member 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], {}*, [8 x i8] } 31%"F::Nope" = type {} 32 33define internal void @_ZN2e34main17h934ff72f9a38d4bbE() unnamed_addr #0 !dbg !5 { 34start: 35 %qq = alloca %F, align 8 36 call void @llvm.dbg.declare(metadata %F* %qq, metadata !10, metadata !28), !dbg !29 37 %0 = bitcast %F* %qq to {}**, !dbg !29 38 store {}* null, {}** %0, !dbg !29 39 %1 = bitcast %F* %qq to %"F::Nope"*, !dbg !29 40 ret void, !dbg !30 41} 42 43; Function Attrs: nounwind readnone 44declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 45 46attributes #0 = { nounwind uwtable } 47 48!llvm.module.flags = !{!0, !1} 49!llvm.dbg.cu = !{!2} 50 51!0 = !{i32 1, !"PIE Level", i32 2} 52!1 = !{i32 2, !"Debug Info Version", i32 3} 53!2 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !3, producer: "clang LLVM (rustc version 1.24.0-dev)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4) 54!3 = !DIFile(filename: "e3.rs", directory: "/home/tromey/Rust") 55!4 = !{} 56!5 = distinct !DISubprogram(name: "main", linkageName: "_ZN2e34mainE", scope: !6, file: !3, line: 2, type: !8, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped | DIFlagMainSubprogram, isOptimized: false, unit: !2, templateParams: !4, retainedNodes: !4) 57!6 = !DINamespace(name: "e3", scope: null) 58!7 = !DIFile(filename: "<unknown>", directory: "") 59!8 = !DISubroutineType(types: !9) 60!9 = !{null} 61!10 = !DILocalVariable(name: "qq", scope: !11, file: !3, line: 3, type: !12, align: 8) 62!11 = distinct !DILexicalBlock(scope: !5, file: !3, line: 3, column: 4) 63!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "F", scope: !6, file: !7, size: 128, align: 64, elements: !13, identifier: "7ce1efff6b82281ab9ceb730566e7e20") 64!13 = !{!14} 65!14 = !DICompositeType(tag: DW_TAG_variant_part, name: "", scope: !12, file: !7, size: 128, align: 64, elements: !16, identifier: "7ce1efff6b82281ab9ceb730566e7e20", discriminator: !15) 66!15 = !DIDerivedType(tag: DW_TAG_member, scope: !14, file: !7, baseType: !27, size: 64, align: 64, flags: DIFlagArtificial) 67!16 = !{!17, !24} 68!17 = !DIDerivedType(tag: DW_TAG_member, scope: !14, file: !7, baseType: !18, size: 128, align: 64) 69!18 = !DICompositeType(tag: DW_TAG_structure_type, name: "Yep", scope: !12, file: !7, size: 128, align: 64, elements: !19, identifier: "7ce1efff6b82281ab9ceb730566e7e20::Yep") 70!19 = !{!20, !22} 71!20 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !18, file: !7, baseType: !21, size: 8, align: 8, offset: 64) 72!21 = !DIBasicType(name: "u8", size: 8, encoding: DW_ATE_unsigned) 73!22 = !DIDerivedType(tag: DW_TAG_member, name: "__1", scope: !18, file: !7, baseType: !23, size: 64, align: 64) 74!23 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "&u8", baseType: !21, size: 64, align: 64) 75!24 = !DIDerivedType(tag: DW_TAG_member, scope: !14, file: !7, baseType: !25, size: 128, align: 64, extraData: i64 0) 76!25 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nope", scope: !12, file: !7, size: 128, align: 64, elements: !4, identifier: "7ce1efff6b82281ab9ceb730566e7e20::Nope") 77!27 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) 78!28 = !DIExpression() 79!29 = !DILocation(line: 3, scope: !11) 80!30 = !DILocation(line: 4, scope: !5) 81