99 lines · plain
1 2; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s3 4; From source:5; struct foo {6; int __attribute__((always_inline)) func(int x) { return x + 2; }7; };8 9; int i;10 11; int main() {12; return foo().func(i);13; }14 15; CHECK: DW_TAG_structure_type16; CHECK: DW_TAG_subprogram17 18; But make sure we emit DW_AT_object_pointer on the abstract definition.19; CHECK: [[ABSTRACT_ORIGIN:.*]]: DW_TAG_subprogram20; CHECK-NOT: {{NULL|TAG}}21; CHECK: DW_AT_specification {{.*}} "_ZN3foo4funcEi"22; CHECK-NOT: {{NULL|TAG}}23; CHECK: DW_AT_object_pointer24 25; Ensure we omit DW_AT_object_pointer on inlined subroutines.26; CHECK: DW_TAG_inlined_subroutine27; CHECK-NEXT: DW_AT_abstract_origin {{.*}} {[[ABSTRACT_ORIGIN]]} "_ZN3foo4funcEi"28; CHECK-NOT: NULL29; CHECK-NOT: DW_AT_object_pointer30; CHECK: DW_TAG_formal_parameter31; CHECK-NOT: DW_AT_artificial32; CHECK: DW_TAG33 34source_filename = "test/DebugInfo/X86/inline-member-function.ll"35 36%struct.foo = type { i8 }37 38@i = global i32 0, align 4, !dbg !039 40; Function Attrs: uwtable41define i32 @main() #0 !dbg !17 {42entry:43 %this.addr.i = alloca ptr, align 844 %x.addr.i = alloca i32, align 445 %retval = alloca i32, align 446 %tmp = alloca %struct.foo, align 147 store i32 0, ptr %retval48 %0 = load i32, ptr @i, align 4, !dbg !2049 store ptr %tmp, ptr %this.addr.i, align 850 call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !21, metadata !24), !dbg !2551 store i32 %0, ptr %x.addr.i, align 452 call void @llvm.dbg.declare(metadata ptr %x.addr.i, metadata !26, metadata !24), !dbg !2753 %this1.i = load ptr, ptr %this.addr.i54 %1 = load i32, ptr %x.addr.i, align 4, !dbg !2755 %add.i = add nsw i32 %1, 2, !dbg !2756 ret i32 %add.i, !dbg !2057}58 59; Function Attrs: nounwind readnone60 61declare void @llvm.dbg.declare(metadata, metadata, metadata) #162 63attributes #0 = { uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" }64attributes #1 = { nounwind readnone }65 66!llvm.dbg.cu = !{!4}67!llvm.module.flags = !{!14, !15}68!llvm.ident = !{!16}69 70!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())71!1 = !DIGlobalVariable(name: "i", scope: null, file: !2, line: 5, type: !3, isLocal: false, isDefinition: true)72!2 = !DIFile(filename: "inline.cpp", directory: "/tmp/dbginfo")73!3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)74!4 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "clang version 3.5.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !6, globals: !13, imports: !5)75!5 = !{}76!6 = !{!7}77!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !2, line: 1, size: 8, align: 8, elements: !8, identifier: "_ZTS3foo")78!8 = !{!9}79!9 = !DISubprogram(name: "func", linkageName: "_ZN3foo4funcEi", scope: !7, file: !2, line: 2, type: !10, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false)80!10 = !DISubroutineType(types: !11)81!11 = !{!3, !12, !3}82!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)83!13 = !{!0}84!14 = !{i32 2, !"Dwarf Version", i32 4}85!15 = !{i32 1, !"Debug Info Version", i32 3}86!16 = !{!"clang version 3.5.0 "}87!17 = distinct !DISubprogram(name: "main", scope: !2, file: !2, line: 7, type: !18, isLocal: false, isDefinition: true, scopeLine: 7, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !4, retainedNodes: !5)88!18 = !DISubroutineType(types: !19)89!19 = !{!3}90!20 = !DILocation(line: 8, scope: !17)91!21 = !DILocalVariable(name: "this", arg: 1, scope: !22, type: !23, flags: DIFlagArtificial | DIFlagObjectPointer)92!22 = distinct !DISubprogram(name: "func", linkageName: "_ZN3foo4funcEi", scope: !7, file: !2, line: 2, type: !10, isLocal: false, isDefinition: true, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !4, declaration: !9, retainedNodes: !5)93!23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64)94!24 = !DIExpression()95!25 = !DILocation(line: 0, scope: !22, inlinedAt: !20)96!26 = !DILocalVariable(name: "x", arg: 2, scope: !22, file: !2, line: 2, type: !3)97!27 = !DILocation(line: 2, scope: !22, inlinedAt: !20)98 99