xref: /llvm-project/llvm/test/DebugInfo/Generic/lto-comp-dir.ll (revision 5336b1ed755627892129454a9d9351463503bb82)
1; XFAIL: target={{.*}}-aix{{.*}}
2; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-line - | FileCheck %s
3; RUN: %llc_dwarf < %s -filetype=asm | FileCheck --check-prefix=ASM %s
4
5; If multiple line tables are emitted, one per CU, those line tables can
6; unambiguously rely on the comp_dir of their owning CU and use directory '0'
7; to refer to it.
8
9; CHECK: .debug_line contents:
10; CHECK-NEXT: debug_line[{{.*}}]
11; CHECK-NEXT: Line table prologue:
12; CHECK-NOT: include_directories
13; CHECK: file_names[   1]
14; CHECK: name: "a.cpp"
15; CHECK-NEXT: dir_index: 0
16; CHECK-NOT: file_names
17
18; CHECK: debug_line[{{.*}}]
19; CHECK-NEXT: Line table prologue:
20; CHECK-NOT: include_directories
21; CHECK: file_names[   1]
22; CHECK: name: "b.cpp"
23; CHECK-NEXT: dir_index: 0
24; CHECK-NOT: file_names
25
26; However, if a single line table is emitted and shared between CUs, the
27; comp_dir is ambiguous and relying on it would lead to different path
28; interpretations depending on which CU lead to the table - so ensure that
29; full paths are always emitted in this case, never comp_dir relative.
30
31; ASM: .file   1 "/tmp/dbginfo/a" "a.cpp"
32; ASM: .file   2 "/tmp/dbginfo/b" "b.cpp"
33
34; Generated from the following source compiled to bitcode from within their
35; respective directories (with debug info) and linked together with llvm-link
36
37; a/a.cpp
38; void func() {
39; }
40
41; b/b.cpp
42; void func();
43; int main() {
44;   func();
45; }
46
47; Function Attrs: nounwind uwtable
48define void @_Z4funcv() #0 !dbg !4 {
49entry:
50  ret void, !dbg !19
51}
52
53; Function Attrs: uwtable
54define i32 @main() #1 !dbg !11 {
55entry:
56  call void @_Z4funcv(), !dbg !20
57  ret i32 0, !dbg !21
58}
59
60attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
61attributes #1 = { uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
62
63!llvm.dbg.cu = !{!0, !8}
64!llvm.module.flags = !{!16, !17}
65!llvm.ident = !{!18, !18}
66
67!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
68!1 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo/a")
69!2 = !{}
70!4 = distinct !DISubprogram(name: "func", linkageName: "_Z4funcv", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)
71!5 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo/a")
72!6 = !DISubroutineType(types: !7)
73!7 = !{null}
74!8 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !9, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
75!9 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo/b")
76!11 = distinct !DISubprogram(name: "main", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !8, scopeLine: 2, file: !9, scope: !12, type: !13, retainedNodes: !2)
77!12 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo/b")
78!13 = !DISubroutineType(types: !14)
79!14 = !{!15}
80!15 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
81!16 = !{i32 2, !"Dwarf Version", i32 4}
82!17 = !{i32 1, !"Debug Info Version", i32 3}
83!18 = !{!"clang version 3.5.0 "}
84!19 = !DILocation(line: 2, scope: !4)
85!20 = !DILocation(line: 3, scope: !11)
86!21 = !DILocation(line: 4, scope: !11)
87
88