1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

[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
This commit is contained in:
Petr Hosek 2020-09-14 17:44:12 -07:00
parent c84dc6693c
commit 86964429fa
2 changed files with 2 additions and 1 deletions

View File

@ -1391,6 +1391,7 @@ bool DWARFDebugLine::Prologue::getFileNameByIndex(
// sys::path::append skips empty strings.
sys::path::append(FilePath, Style, IncludeDir, FileName);
sys::path::remove_dots(FilePath, /*remove_dot_dot=*/true, Style);
Result = std::string(FilePath.str());
return true;
}

View File

@ -13,7 +13,7 @@
// CHECK: foo
// CHECK-NEXT: array
// CHECK-NEXT: /home/ubuntu{{/|\\}}.{{/|\\}}example.cpp:1
// CHECK-NEXT: /home/ubuntu{{/|\\}}example.cpp:1
// CHECK-NEXT: -24 8 ??
.file "example.cpp"