Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/Generic/def-line.ll

raw
1 ; REQUIRES: object-emission
2
3 ; RUN: llvm-as < %s -o %t.bc
4 ; RUN: llvm-spirv %t.bc -o %t.spv
5 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
6
7 ; RUN: llc -mtriple=%triple < %t.ll -filetype=obj | llvm-dwarfdump -debug-info - | FileCheck %s
8
9 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
10 target triple = "spir64-unknown-unknown"
11
12 ; Given the following source, ensure that the decl_line/file is correctly
13 ; emitted and omitted on definitions if it mismatches/matches the declaration
14
15 ; struct foo {
16 ; static void f1() {
17 ; }
18 ; static void f2();
19 ; static void f3();
20 ; };
21 ; void foo::f2() {
22 ; f1(); // just to ensure f1 is emitted
23 ; }
24 ; #line 1 "bar.cpp"
25 ; void foo::f3() {
26 ; }
27
28 ; Skip the declarations
29 ; CHECK: DW_TAG_subprogram
30 ; CHECK: DW_TAG_subprogram
31 ; CHECK: DW_TAG_subprogram
32
33 ; CHECK: DW_TAG_subprogram
34 ; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_file}}
35 ; CHECK: DW_AT_decl_line {{.*}}7
36 ; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_file}}
37 ; CHECK: DW_AT_specification {{.*}}f2
38 ; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_file}}
39
40 ; CHECK: DW_TAG_subprogram
41 ; CHECK-NOT: {{DW_TAG|NULL|DW_AT_decl_line|DW_AT_decl_file}}
42 ; CHECK: DW_AT_specification {{.*}}f1
43
44 ; CHECK: DW_TAG_subprogram
45 ; CHECK-NOT: {{DW_TAG|NULL}}
46 ; CHECK: DW_AT_decl_file {{.*}}bar.cpp
47 ; CHECK-NOT: {{DW_TAG|NULL}}
48 ; CHECK: DW_AT_decl_line {{.*}}1
49 ; CHECK-NOT: {{DW_TAG|NULL}}
50 ; CHECK: DW_AT_specification {{.*}}f3
51
52 ; Function Attrs: uwtable
53 define void @_ZN3foo2f2Ev() #0 align 2 !dbg !12 {
54 entry:
55 call void @_ZN3foo2f1Ev(), !dbg !19
56 ret void, !dbg !20
57 }
58
59 ; Function Attrs: nounwind uwtable
60 define linkonce_odr void @_ZN3foo2f1Ev() #1 align 2 !dbg !15 {
61 entry:
62 ret void, !dbg !21
63 }
64
65 ; Function Attrs: nounwind uwtable
66 define void @_ZN3foo2f3Ev() #1 align 2 !dbg !13 {
67 entry:
68 ret void, !dbg !22
69 }
70
71 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" }
72 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" }
73
74 !llvm.dbg.cu = !{!0}
75 !llvm.module.flags = !{!16, !17}
76 !llvm.ident = !{!18}
77
78 !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)
79 !1 = !DIFile(filename: "def-line.cpp", directory: "/tmp/dbginfo")
80 !2 = !{}
81 !3 = !{!4}
82 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !1, line: 1, size: 8, align: 8, elements: !5, identifier: "_ZTS3foo")
83 !5 = !{!6, !9, !10}
84 !6 = !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !4, file: !1, line: 2, type: !7, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false)
85 !7 = !DISubroutineType(types: !8)
86 !8 = !{null}
87 !9 = !DISubprogram(name: "f2", linkageName: "_ZN3foo2f2Ev", scope: !4, file: !1, line: 4, type: !7, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)
88 !10 = !DISubprogram(name: "f3", linkageName: "_ZN3foo2f3Ev", scope: !4, file: !1, line: 5, type: !7, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)
89 !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)
90 !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)
91 !14 = !DIFile(filename: "bar.cpp", directory: "/tmp/dbginfo")
92 !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)
93 !16 = !{i32 2, !"Dwarf Version", i32 4}
94 !17 = !{i32 2, !"Debug Info Version", i32 3}
95 !18 = !{!"clang version 3.8.0 (trunk 249440) (llvm/trunk 249465)"}
96 !19 = !DILocation(line: 8, column: 3, scope: !12)
97 !20 = !DILocation(line: 9, column: 1, scope: !12)
98 !21 = !DILocation(line: 3, column: 3, scope: !15)
99 !22 = !DILocation(line: 2, column: 1, scope: !13)