1; REQUIRES: object-emission 2 3; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s 4 5; From source: 6; struct foo { 7; int __attribute__((always_inline)) func(int x) { return x + 2; } 8; }; 9 10; int i; 11 12; int main() { 13; return foo().func(i); 14; } 15 16; CHECK: DW_TAG_structure_type 17; CHECK: DW_TAG_subprogram 18 19; But make sure we emit DW_AT_object_pointer on the abstract definition. 20; CHECK: [[ABSTRACT_ORIGIN:.*]]: DW_TAG_subprogram 21; CHECK-NOT: {{NULL|TAG}} 22; CHECK: DW_AT_specification {{.*}} "_ZN3foo4funcEi" 23; CHECK-NOT: {{NULL|TAG}} 24; CHECK: DW_AT_object_pointer 25 26; Ensure we omit DW_AT_object_pointer on inlined subroutines. 27; CHECK: DW_TAG_inlined_subroutine 28; CHECK-NEXT: DW_AT_abstract_origin {{.*}} {[[ABSTRACT_ORIGIN]]} "_ZN3foo4funcEi" 29; CHECK-NOT: NULL 30; CHECK-NOT: DW_AT_object_pointer 31; CHECK: DW_TAG_formal_parameter 32; CHECK-NOT: DW_AT_artificial 33; CHECK: DW_TAG 34 35%struct.foo = type { i8 } 36 37@i = global i32 0, align 4 38 39; Function Attrs: uwtable 40define i32 @main() #0 { 41entry: 42 %this.addr.i = alloca %struct.foo*, align 8 43 %x.addr.i = alloca i32, align 4 44 %retval = alloca i32, align 4 45 %tmp = alloca %struct.foo, align 1 46 store i32 0, i32* %retval 47 %0 = load i32, i32* @i, align 4, !dbg !23 48 store %struct.foo* %tmp, %struct.foo** %this.addr.i, align 8 49 call void @llvm.dbg.declare(metadata %struct.foo** %this.addr.i, metadata !24, metadata !MDExpression()), !dbg !26 50 store i32 %0, i32* %x.addr.i, align 4 51 call void @llvm.dbg.declare(metadata i32* %x.addr.i, metadata !27, metadata !MDExpression()), !dbg !28 52 %this1.i = load %struct.foo*, %struct.foo** %this.addr.i 53 %1 = load i32, i32* %x.addr.i, align 4, !dbg !28 54 %add.i = add nsw i32 %1, 2, !dbg !28 55 ret i32 %add.i, !dbg !23 56} 57 58; Function Attrs: nounwind readnone 59declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 60 61attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 62attributes #1 = { nounwind readnone } 63 64!llvm.dbg.cu = !{!0} 65!llvm.module.flags = !{!20, !21} 66!llvm.ident = !{!22} 67 68!0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !12, globals: !18, imports: !2) 69!1 = !MDFile(filename: "inline.cpp", directory: "/tmp/dbginfo") 70!2 = !{} 71!3 = !{!4} 72!4 = !MDCompositeType(tag: DW_TAG_structure_type, name: "foo", line: 1, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS3foo") 73!5 = !{!6} 74!6 = !MDSubprogram(name: "func", linkageName: "_ZN3foo4funcEi", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !"_ZTS3foo", type: !7) 75!7 = !MDSubroutineType(types: !8) 76!8 = !{!9, !10, !9} 77!9 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 78!10 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS3foo") 79!12 = !{!13, !17} 80!13 = !MDSubprogram(name: "main", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !14, type: !15, function: i32 ()* @main, variables: !2) 81!14 = !MDFile(filename: "inline.cpp", directory: "/tmp/dbginfo") 82!15 = !MDSubroutineType(types: !16) 83!16 = !{!9} 84!17 = !MDSubprogram(name: "func", linkageName: "_ZN3foo4funcEi", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !"_ZTS3foo", type: !7, declaration: !6, variables: !2) 85!18 = !{!19} 86!19 = !MDGlobalVariable(name: "i", line: 5, isLocal: false, isDefinition: true, scope: null, file: !14, type: !9, variable: i32* @i) 87!20 = !{i32 2, !"Dwarf Version", i32 4} 88!21 = !{i32 1, !"Debug Info Version", i32 3} 89!22 = !{!"clang version 3.5.0 "} 90!23 = !MDLocation(line: 8, scope: !13) 91!24 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !25) 92!25 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS3foo") 93!26 = !MDLocation(line: 0, scope: !17, inlinedAt: !23) 94!27 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 2, arg: 2, scope: !17, file: !14, type: !9) 95!28 = !MDLocation(line: 2, scope: !17, inlinedAt: !23) 96