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