Skip to content

Commit 042c235

Browse files
committed
[DebugInfo] Remove dots from getFilenameByIndex return value
When concatenating directory with filename in getFilenameByIndex, we might end up with a path that contains extra dots. For example, if the input is /path and ./example, we would return /path/./example. Run sys::path::remove_dots on the output to eliminate unnecessary dots. Differential Revision: https://reviews.llvm.org/D87657
1 parent 1f83726 commit 042c235

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,7 @@ bool DWARFDebugLine::Prologue::getFileNameByIndex(
13911391

13921392
// sys::path::append skips empty strings.
13931393
sys::path::append(FilePath, Style, IncludeDir, FileName);
1394+
sys::path::remove_dots(FilePath, /*remove_dot_dot=*/true, Style);
13941395
Result = std::string(FilePath.str());
13951396
return true;
13961397
}

llvm/test/tools/llvm-symbolizer/frame-fortran.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
// CHECK: foo
1515
// CHECK-NEXT: array
16-
// CHECK-NEXT: /home/ubuntu{{/|\\}}.{{/|\\}}example.cpp:1
16+
// CHECK-NEXT: /home/ubuntu{{/|\\}}example.cpp:1
1717
// CHECK-NEXT: -24 8 ??
1818

1919
.file "example.cpp"

0 commit comments

Comments
 (0)