91 lines · plain
1; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-info - | FileCheck %s2 3; Given the following source, ensure that the decl_line/file is correctly4; emitted and omitted on definitions if it mismatches/matches the declaration5 6; struct foo {7; static void f1() {8; }9; static void f2();10; static void f3();11; };12; void foo::f2() {13; f1(); // just to ensure f1 is emitted14; }15; #line 1 "bar.cpp"16; void foo::f3() {17; }18 19; Skip the declarations20; CHECK: DW_TAG_subprogram21; CHECK: DW_TAG_subprogram22; CHECK: DW_TAG_subprogram23 24; CHECK: DW_TAG_subprogram25; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_file}}26; CHECK: DW_AT_decl_line {{.*}}727; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_file}}28; CHECK: DW_AT_specification {{.*}}f229; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_file}}30 31; CHECK: DW_TAG_subprogram32; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_line|DW_AT_decl_file}}33; CHECK: DW_AT_specification {{.*}}f134 35; CHECK: DW_TAG_subprogram36; CHECK-NOT: {{DW_TAG|NULL}}37; CHECK: DW_AT_decl_file {{.*}}bar.cpp38; CHECK-NOT: {{DW_TAG|NULL}}39; CHECK: DW_AT_decl_line {{.*}}140; CHECK-NOT: {{DW_TAG|NULL}}41; CHECK: DW_AT_specification {{.*}}f342 43; Function Attrs: uwtable44define void @_ZN3foo2f2Ev() #0 align 2 !dbg !12 {45entry:46 call void @_ZN3foo2f1Ev(), !dbg !1947 ret void, !dbg !2048}49 50; Function Attrs: nounwind uwtable51define linkonce_odr void @_ZN3foo2f1Ev() #1 align 2 !dbg !15 {52entry:53 ret void, !dbg !2154}55 56; Function Attrs: nounwind uwtable57define void @_ZN3foo2f3Ev() #1 align 2 !dbg !13 {58entry:59 ret void, !dbg !2260}61 62attributes #0 = { uwtable "disable-tail-calls"="false" "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" }63attributes #1 = { nounwind uwtable "disable-tail-calls"="false" "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" }64 65!llvm.dbg.cu = !{!0}66!llvm.module.flags = !{!16, !17}67!llvm.ident = !{!18}68 69!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 249440) (llvm/trunk 249465)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3)70!1 = !DIFile(filename: "def-line.cpp", directory: "/tmp/dbginfo")71!2 = !{}72!3 = !{!4}73!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !1, line: 1, size: 8, align: 8, elements: !5, identifier: "_ZTS3foo")74!5 = !{!6, !9, !10}75!6 = !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !4, file: !1, line: 2, type: !7, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false)76!7 = !DISubroutineType(types: !8)77!8 = !{null}78!9 = !DISubprogram(name: "f2", linkageName: "_ZN3foo2f2Ev", scope: !4, file: !1, line: 4, type: !7, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)79!10 = !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ev", scope: !4, file: !1, line: 5, type: !7, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)80!12 = distinct !DISubprogram(name: "f2", linkageName: "_ZN3foo2f2Ev", scope: !4, file: !1, line: 7, type: !7, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !9, retainedNodes: !2)81!13 = distinct !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ev", scope: !4, file: !14, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !10, retainedNodes: !2)82!14 = !DIFile(filename: "bar.cpp", directory: "/tmp/dbginfo")83!15 = distinct !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !4, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !6, retainedNodes: !2)84!16 = !{i32 2, !"Dwarf Version", i32 4}85!17 = !{i32 2, !"Debug Info Version", i32 3}86!18 = !{!"clang version 3.8.0 (trunk 249440) (llvm/trunk 249465)"}87!19 = !DILocation(line: 8, column: 3, scope: !12)88!20 = !DILocation(line: 9, column: 1, scope: !12)89!21 = !DILocation(line: 3, column: 3, scope: !15)90!22 = !DILocation(line: 2, column: 1, scope: !13)91