blob: d92e1facad1b9e35141ba7ce5baaf0194536600b [file] [log] [blame]
Eugene Zemtsov82d60d62018-03-13 17:54:29 +00001; Make sure that absolute source dir is detected correctly regardless of the platform.
Eugene Zemtsov82d60d62018-03-13 17:54:29 +00002; REQUIRES: object-emission
Eugene Zemtsovccf30832018-03-14 02:10:07 +00003; On powerpc llvm-nm describes win_func as a global variable, not a function. It breaks the test.
4; It is not essential to DWARF path handling code we're testing here.
5; UNSUPPORTED: powerpc
Eugene Zemtsovb9d29082018-03-13 22:48:39 +00006; RUN: %llc_dwarf -O0 -filetype=obj -o %t < %s
Eugene Zemtsovccf30832018-03-14 02:10:07 +00007; RUN: llvm-nm -radix=o %t | grep posix_absolute_func > %t.posix_absolute_func
8; RUN: llvm-nm -radix=o %t | grep posix_relative_func > %t.posix_relative_func
9; RUN: llvm-nm -radix=o %t | grep win_func > %t.win_func
Eugene Zemtsov82d60d62018-03-13 17:54:29 +000010; RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false --obj %t < %t.posix_absolute_func | FileCheck %s --check-prefix=POSIX_A
11; RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false --obj %t < %t.posix_relative_func | FileCheck %s --check-prefix=POSIX_R
12; RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false --obj %t < %t.win_func | FileCheck %s --check-prefix=WIN
13
14;POSIX_A: posix_absolute_func
15;POSIX_A: /absolute/posix/path{{[\/]}}posix.c
16
17;POSIX_R: posix_relative_func
18;POSIX_R: /ABSOLUTE/CU/PATH{{[\/]}}relative/posix/path{{[\/]}}posix2.c
19
20;WIN: win_func
21;WIN: E:\absolute\windows\path{{[\/]}}win.c
22
Eugene Zemtsov82d60d62018-03-13 17:54:29 +000023define i32 @win_func() #0 !dbg !54 {
24 ret i32 5, !dbg !511
25}
26
27define i32 @posix_absolute_func() #0 !dbg !34 {
28 ret i32 3, !dbg !311
29}
30
31define i32 @posix_relative_func() #0 !dbg !44 {
32 ret i32 4, !dbg !411
33}
34
35!llvm.dbg.cu = !{!50, !30, !40}
36!llvm.module.flags = !{!8, !9}
37!llvm.ident = !{!10}
38!8 = !{i32 2, !"Dwarf Version", i32 4}
39!9 = !{i32 2, !"Debug Info Version", i32 3}
40!10 = !{!"clang"}
41
42!50 = distinct !DICompileUnit(language: DW_LANG_C99, file: !512, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !52)
43!51 = !DIFile(filename: "win.c", directory: "E:\\absolute\\windows\\path")
44!52 = !{}
45!53 = !{!54}
Shiva Chen2c864552018-05-09 02:40:45 +000046!54 = distinct !DISubprogram(name: "win_func", scope: !51, file: !51, line: 55, type: !55, unit: !50, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, retainedNodes: !52)
Eugene Zemtsov82d60d62018-03-13 17:54:29 +000047!55 = !DISubroutineType(types: !56)
48!56 = !{!57}
49!57 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
50!511 = !DILocation(line: 55, column: 2, scope: !54)
51!512 = !DIFile(filename: "a.c", directory: "/WIN_CU/PATH")
52
53!30 = distinct !DICompileUnit(language: DW_LANG_C99, file: !312, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !32)
54!31 = !DIFile(filename: "posix.c", directory: "/absolute/posix/path")
55!32 = !{}
56!33 = !{!34}
Shiva Chen2c864552018-05-09 02:40:45 +000057!34 = distinct !DISubprogram(name: "posix_absolute_func", scope: !31, file: !31, line: 33, type: !35, unit: !30, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, retainedNodes: !32)
Eugene Zemtsov82d60d62018-03-13 17:54:29 +000058!35 = !DISubroutineType(types: !36)
59!36 = !{!37}
60!37 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
61!311 = !DILocation(line: 33, column: 2, scope: !34)
62!312 = !DIFile(filename: "b.c", directory: "/POSIX_CU/PATH")
63
64!40 = distinct !DICompileUnit(language: DW_LANG_C99, file: !412, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !42)
65!41 = !DIFile(filename: "posix2.c", directory: "relative/posix/path")
66!42 = !{}
67!43 = !{!44}
Shiva Chen2c864552018-05-09 02:40:45 +000068!44 = distinct !DISubprogram(name: "posix_relative_func", scope: !41, file: !41, line: 44, type: !45, unit: !40, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, retainedNodes: !42)
Eugene Zemtsov82d60d62018-03-13 17:54:29 +000069!45 = !DISubroutineType(types: !46)
70!46 = !{!47}
71!47 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
72!411 = !DILocation(line: 44, column: 2, scope: !44)
73!412 = !DIFile(filename: "c.c", directory: "/ABSOLUTE/CU/PATH")
74