xref: /llvm-project/llvm/test/CodeGen/Generic/dwarf-source.ll (revision 7683a084de6bd2637f2351f53389df8b610566cf)
1; Source text provided by IR should be passed through to asm.
2; It is emitted to an object file only for DWARF 5 or later.
3
4; RUN: %llc_dwarf -dwarf-version 4 -filetype=asm -o - %s | FileCheck %s --check-prefix=ASM-4
5; RUN: %llc_dwarf -dwarf-version 5 -filetype=asm -o - %s | FileCheck %s --check-prefix=ASM-5
6; RUN: %llc_dwarf -dwarf-version 4 -filetype=obj -o %t4.o %s
7; RUN: llvm-dwarfdump -debug-line %t4.o | FileCheck %s --check-prefixes=OBJ,OBJ-4
8; RUN: %llc_dwarf -dwarf-version 5 -filetype=obj -o %t5.o %s
9; RUN: llvm-dwarfdump -debug-line %t5.o | FileCheck %s --check-prefixes=OBJ,OBJ-5
10
11; ASM-4: .file 1 "/test{{.*[/\\]}}t1.h" source "11111111111111111111111111111111"
12; ASM-4: .file 2 "/test{{.*[/\\]}}t2.h" source "22222222222222222222222222222222"
13; ASM-5: .file 0 "/test{{.*[/\\]}}t.c" source "00000000000000000000000000000000"
14; ASM-5: .file 1 "t1.h" source "11111111111111111111111111111111"
15; ASM-5: .file 2 "t2.h" source "22222222222222222222222222222222"
16
17; OBJ-5: file_names[ 0]:
18; OBJ-5-NEXT: name: "t.c"
19; OBJ-5-NEXT: dir_index: 0
20; OBJ-5-NEXT: source: "00000000000000000000000000000000"
21; OBJ: file_names[ 1]:
22; OBJ-NEXT: name: "t1.h"
23; OBJ-NEXT: dir_index: 0
24; OBJ-4-NOT: 11111111111111111111111111111111
25; OBJ-5-NEXT: source: "11111111111111111111111111111111"
26; OBJ: file_names[ 2]:
27; OBJ-NEXT: name: "t2.h"
28; OBJ-NEXT: dir_index: 0
29; OBJ-4-NOT: 22222222222222222222222222222222
30; OBJ-5-NEXT: source: "22222222222222222222222222222222"
31
32; ModuleID = 't.c'
33source_filename = "t.c"
34
35@t1 = global i32 1, align 4, !dbg !0
36@t2 = global i32 0, align 4, !dbg !6
37
38!llvm.dbg.cu = !{!2}
39!llvm.module.flags = !{!11, !12, !13}
40!llvm.ident = !{!14}
41
42!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
43!1 = distinct !DIGlobalVariable(name: "t1", scope: !2, file: !10, line: 1, type: !9, isLocal: false, isDefinition: true)
44!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (trunk 322159)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
45!3 = !DIFile(filename: "t.c", directory: "/test", source: "00000000000000000000000000000000")
46!4 = !{}
47!5 = !{!0, !6}
48!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
49!7 = distinct !DIGlobalVariable(name: "t2", scope: !2, file: !8, line: 1, type: !9, isLocal: false, isDefinition: true)
50!8 = !DIFile(filename: "t2.h", directory: "/test", source: "22222222222222222222222222222222")
51!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
52!10 = !DIFile(filename: "t1.h", directory: "/test", source: "11111111111111111111111111111111")
53!11 = !{i32 2, !"Dwarf Version", i32 4}
54!12 = !{i32 2, !"Debug Info Version", i32 3}
55!13 = !{i32 1, !"wchar_size", i32 4}
56!14 = !{!"clang version 7.0.0 (trunk 322159)"}
57