def-line.ll 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. ; REQUIRES: object-emission
  2. ; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-info - | FileCheck %s
  3. ; Given the following source, ensure that the decl_line/file is correctly
  4. ; emitted and omitted on definitions if it mismatches/matches the declaration
  5. ; struct foo {
  6. ; static void f1() {
  7. ; }
  8. ; static void f2();
  9. ; static void f3();
  10. ; };
  11. ; void foo::f2() {
  12. ; f1(); // just to ensure f1 is emitted
  13. ; }
  14. ; #line 1 "bar.cpp"
  15. ; void foo::f3() {
  16. ; }
  17. ; Skip the declarations
  18. ; CHECK: DW_TAG_subprogram
  19. ; CHECK: DW_TAG_subprogram
  20. ; CHECK: DW_TAG_subprogram
  21. ; CHECK: DW_TAG_subprogram
  22. ; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_file}}
  23. ; CHECK: DW_AT_decl_line {{.*}}7
  24. ; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_file}}
  25. ; CHECK: DW_AT_specification {{.*}}f2
  26. ; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_file}}
  27. ; CHECK: DW_TAG_subprogram
  28. ; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_line|DW_AT_decl_file}}
  29. ; CHECK: DW_AT_specification {{.*}}f1
  30. ; CHECK: DW_TAG_subprogram
  31. ; CHECK-NOT: {{DW_TAG|NULL}}
  32. ; CHECK: DW_AT_decl_file {{.*}}bar.cpp
  33. ; CHECK-NOT: {{DW_TAG|NULL}}
  34. ; CHECK: DW_AT_decl_line {{.*}}1
  35. ; CHECK-NOT: {{DW_TAG|NULL}}
  36. ; CHECK: DW_AT_specification {{.*}}f3
  37. ; Function Attrs: uwtable
  38. define void @_ZN3foo2f2Ev() #0 align 2 !dbg !12 {
  39. entry:
  40. call void @_ZN3foo2f1Ev(), !dbg !19
  41. ret void, !dbg !20
  42. }
  43. ; Function Attrs: nounwind uwtable
  44. define linkonce_odr void @_ZN3foo2f1Ev() #1 align 2 !dbg !15 {
  45. entry:
  46. ret void, !dbg !21
  47. }
  48. ; Function Attrs: nounwind uwtable
  49. define void @_ZN3foo2f3Ev() #1 align 2 !dbg !13 {
  50. entry:
  51. ret void, !dbg !22
  52. }
  53. attributes #0 = { uwtable "disable-tail-calls"="false" "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" }
  54. attributes #1 = { nounwind uwtable "disable-tail-calls"="false" "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" }
  55. !llvm.dbg.cu = !{!0}
  56. !llvm.module.flags = !{!16, !17}
  57. !llvm.ident = !{!18}
  58. !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)
  59. !1 = !DIFile(filename: "def-line.cpp", directory: "/tmp/dbginfo")
  60. !2 = !{}
  61. !3 = !{!4}
  62. !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !1, line: 1, size: 8, align: 8, elements: !5, identifier: "_ZTS3foo")
  63. !5 = !{!6, !9, !10}
  64. !6 = !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !4, file: !1, line: 2, type: !7, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false)
  65. !7 = !DISubroutineType(types: !8)
  66. !8 = !{null}
  67. !9 = !DISubprogram(name: "f2", linkageName: "_ZN3foo2f2Ev", scope: !4, file: !1, line: 4, type: !7, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)
  68. !10 = !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ev", scope: !4, file: !1, line: 5, type: !7, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)
  69. !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)
  70. !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)
  71. !14 = !DIFile(filename: "bar.cpp", directory: "/tmp/dbginfo")
  72. !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)
  73. !16 = !{i32 2, !"Dwarf Version", i32 4}
  74. !17 = !{i32 2, !"Debug Info Version", i32 3}
  75. !18 = !{!"clang version 3.8.0 (trunk 249440) (llvm/trunk 249465)"}
  76. !19 = !DILocation(line: 8, column: 3, scope: !12)
  77. !20 = !DILocation(line: 9, column: 1, scope: !12)
  78. !21 = !DILocation(line: 3, column: 3, scope: !15)
  79. !22 = !DILocation(line: 2, column: 1, scope: !13)