1*9880d681SAndroid Build Coastguard Worker; REQUIRES: object-emission 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; RUN: %llc_dwarf -O0 -filetype=obj -o - < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s 4*9880d681SAndroid Build Coastguard Worker; Radar 7833483 5*9880d681SAndroid Build Coastguard Worker; Do not emit a separate out-of-line definition DIE for the function-local 'foo' 6*9880d681SAndroid Build Coastguard Worker; function (member of the function local 'A' type) 7*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_class_type 8*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_class_type 9*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: DW_AT_name {{.*}} "A" 10*9880d681SAndroid Build Coastguard Worker; Check that the subprogram inside the class definition has low_pc, only 11*9880d681SAndroid Build Coastguard Worker; attached to the definition. 12*9880d681SAndroid Build Coastguard Worker; CHECK: [[FOO_INL:0x........]]: DW_TAG_subprogram 13*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG 14*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_low_pc 15*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG 16*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_name {{.*}} "foo" 17*9880d681SAndroid Build Coastguard Worker; And just double check that there's no out of line definition that references 18*9880d681SAndroid Build Coastguard Worker; this subprogram. 19*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_AT_specification {{.*}} {[[FOO_INL]]} 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker%class.A = type { i8 } 22*9880d681SAndroid Build Coastguard Worker%class.B = type { i8 } 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Workerdefine i32 @main() ssp !dbg !2 { 25*9880d681SAndroid Build Coastguard Workerentry: 26*9880d681SAndroid Build Coastguard Worker %retval = alloca i32, align 4 ; <i32*> [#uses=3] 27*9880d681SAndroid Build Coastguard Worker %b = alloca %class.A, align 1 ; <%class.A*> [#uses=1] 28*9880d681SAndroid Build Coastguard Worker store i32 0, i32* %retval 29*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %class.A* %b, metadata !0, metadata !DIExpression()), !dbg !14 30*9880d681SAndroid Build Coastguard Worker %call = call i32 @_ZN1B2fnEv(%class.A* %b), !dbg !15 ; <i32> [#uses=1] 31*9880d681SAndroid Build Coastguard Worker store i32 %call, i32* %retval, !dbg !15 32*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %retval, !dbg !16 ; <i32> [#uses=1] 33*9880d681SAndroid Build Coastguard Worker ret i32 %0, !dbg !16 34*9880d681SAndroid Build Coastguard Worker} 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr i32 @_ZN1B2fnEv(%class.A* %this) ssp align 2 !dbg !10 { 39*9880d681SAndroid Build Coastguard Workerentry: 40*9880d681SAndroid Build Coastguard Worker %retval = alloca i32, align 4 ; <i32*> [#uses=2] 41*9880d681SAndroid Build Coastguard Worker %this.addr = alloca %class.A*, align 8 ; <%class.A**> [#uses=2] 42*9880d681SAndroid Build Coastguard Worker %a = alloca %class.A, align 1 ; <%class.A*> [#uses=1] 43*9880d681SAndroid Build Coastguard Worker %i = alloca i32, align 4 ; <i32*> [#uses=2] 44*9880d681SAndroid Build Coastguard Worker store %class.A* %this, %class.A** %this.addr 45*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !17, metadata !DIExpression(DW_OP_deref)), !dbg !18 46*9880d681SAndroid Build Coastguard Worker %this1 = load %class.A*, %class.A** %this.addr ; <%class.A*> [#uses=0] 47*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %class.A* %a, metadata !19, metadata !DIExpression()), !dbg !27 48*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata i32* %i, metadata !28, metadata !DIExpression()), !dbg !29 49*9880d681SAndroid Build Coastguard Worker %call = call i32 @_ZZN1B2fnEvEN1A3fooEv(%class.A* %a), !dbg !30 ; <i32> [#uses=1] 50*9880d681SAndroid Build Coastguard Worker store i32 %call, i32* %i, !dbg !30 51*9880d681SAndroid Build Coastguard Worker %tmp = load i32, i32* %i, !dbg !31 ; <i32> [#uses=1] 52*9880d681SAndroid Build Coastguard Worker store i32 %tmp, i32* %retval, !dbg !31 53*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %retval, !dbg !32 ; <i32> [#uses=1] 54*9880d681SAndroid Build Coastguard Worker ret i32 %0, !dbg !32 55*9880d681SAndroid Build Coastguard Worker} 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Workerdefine internal i32 @_ZZN1B2fnEvEN1A3fooEv(%class.A* %this) ssp align 2 !dbg !23 { 58*9880d681SAndroid Build Coastguard Workerentry: 59*9880d681SAndroid Build Coastguard Worker %retval = alloca i32, align 4 ; <i32*> [#uses=2] 60*9880d681SAndroid Build Coastguard Worker %this.addr = alloca %class.A*, align 8 ; <%class.A**> [#uses=2] 61*9880d681SAndroid Build Coastguard Worker store %class.A* %this, %class.A** %this.addr 62*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !33, metadata !DIExpression(DW_OP_deref)), !dbg !34 63*9880d681SAndroid Build Coastguard Worker %this1 = load %class.A*, %class.A** %this.addr ; <%class.A*> [#uses=0] 64*9880d681SAndroid Build Coastguard Worker store i32 42, i32* %retval, !dbg !35 65*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %retval, !dbg !35 ; <i32> [#uses=1] 66*9880d681SAndroid Build Coastguard Worker ret i32 %0, !dbg !35 67*9880d681SAndroid Build Coastguard Worker} 68*9880d681SAndroid Build Coastguard Worker 69*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!4} 70*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!40} 71*9880d681SAndroid Build Coastguard Worker!37 = !{!2, !10, !23} 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Worker!0 = !DILocalVariable(name: "b", line: 16, scope: !1, file: !3, type: !8) 74*9880d681SAndroid Build Coastguard Worker!1 = distinct !DILexicalBlock(line: 15, column: 12, file: !38, scope: !2) 75*9880d681SAndroid Build Coastguard Worker!2 = distinct !DISubprogram(name: "main", linkageName: "main", line: 15, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !4, scopeLine: 15, file: !38, scope: !3, type: !5) 76*9880d681SAndroid Build Coastguard Worker!3 = !DIFile(filename: "one.cc", directory: "/tmp") 77*9880d681SAndroid Build Coastguard Worker!4 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang 1.5", isOptimized: false, emissionKind: FullDebug, file: !38, enums: !39, retainedTypes: !39, imports: null) 78*9880d681SAndroid Build Coastguard Worker!5 = !DISubroutineType(types: !6) 79*9880d681SAndroid Build Coastguard Worker!6 = !{!7} 80*9880d681SAndroid Build Coastguard Worker!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 81*9880d681SAndroid Build Coastguard Worker!8 = !DICompositeType(tag: DW_TAG_class_type, name: "B", line: 2, size: 8, align: 8, file: !38, scope: !3, elements: !9) 82*9880d681SAndroid Build Coastguard Worker!9 = !{!10} 83*9880d681SAndroid Build Coastguard Worker!10 = distinct !DISubprogram(name: "fn", linkageName: "_ZN1B2fnEv", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !4, scopeLine: 4, file: !38, scope: !8, type: !11) 84*9880d681SAndroid Build Coastguard Worker!11 = !DISubroutineType(types: !12) 85*9880d681SAndroid Build Coastguard Worker!12 = !{!7, !13} 86*9880d681SAndroid Build Coastguard Worker!13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !38, scope: !3, baseType: !8) 87*9880d681SAndroid Build Coastguard Worker!14 = !DILocation(line: 16, column: 5, scope: !1) 88*9880d681SAndroid Build Coastguard Worker!15 = !DILocation(line: 17, column: 3, scope: !1) 89*9880d681SAndroid Build Coastguard Worker!16 = !DILocation(line: 18, column: 1, scope: !2) 90*9880d681SAndroid Build Coastguard Worker; Manually modified to avoid pointers (thus dependence on pointer size) in Generic test 91*9880d681SAndroid Build Coastguard Worker!17 = !DILocalVariable(name: "this", line: 4, arg: 1, scope: !10, file: !3, type: !8) 92*9880d681SAndroid Build Coastguard Worker!18 = !DILocation(line: 4, column: 7, scope: !10) 93*9880d681SAndroid Build Coastguard Worker!19 = !DILocalVariable(name: "a", line: 9, scope: !20, file: !3, type: !21) 94*9880d681SAndroid Build Coastguard Worker!20 = distinct !DILexicalBlock(line: 4, column: 12, file: !38, scope: !10) 95*9880d681SAndroid Build Coastguard Worker!21 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 5, size: 8, align: 8, file: !38, scope: !10, elements: !22) 96*9880d681SAndroid Build Coastguard Worker!22 = !{!23} 97*9880d681SAndroid Build Coastguard Worker!23 = distinct !DISubprogram(name: "foo", linkageName: "_ZZN1B2fnEvEN1A3fooEv", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !4, scopeLine: 7, file: !38, scope: !21, type: !24) 98*9880d681SAndroid Build Coastguard Worker!24 = !DISubroutineType(types: !25) 99*9880d681SAndroid Build Coastguard Worker!25 = !{!7, !26} 100*9880d681SAndroid Build Coastguard Worker!26 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !38, scope: !3, baseType: !21) 101*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 9, column: 7, scope: !20) 102*9880d681SAndroid Build Coastguard Worker!28 = !DILocalVariable(name: "i", line: 10, scope: !20, file: !3, type: !7) 103*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 10, column: 9, scope: !20) 104*9880d681SAndroid Build Coastguard Worker!30 = !DILocation(line: 10, column: 5, scope: !20) 105*9880d681SAndroid Build Coastguard Worker!31 = !DILocation(line: 11, column: 5, scope: !20) 106*9880d681SAndroid Build Coastguard Worker!32 = !DILocation(line: 12, column: 3, scope: !10) 107*9880d681SAndroid Build Coastguard Worker; Manually modified like !17 above 108*9880d681SAndroid Build Coastguard Worker!33 = !DILocalVariable(name: "this", line: 7, arg: 1, scope: !23, file: !3, type: !21) 109*9880d681SAndroid Build Coastguard Worker!34 = !DILocation(line: 7, column: 11, scope: !23) 110*9880d681SAndroid Build Coastguard Worker!35 = !DILocation(line: 7, column: 19, scope: !36) 111*9880d681SAndroid Build Coastguard Worker!36 = distinct !DILexicalBlock(line: 7, column: 17, file: !38, scope: !23) 112*9880d681SAndroid Build Coastguard Worker!38 = !DIFile(filename: "one.cc", directory: "/tmp") 113*9880d681SAndroid Build Coastguard Worker!39 = !{} 114*9880d681SAndroid Build Coastguard Worker!40 = !{i32 1, !"Debug Info Version", i32 3} 115