[llvm] 042c235 - [DebugInfo] Remove dots from getFilenameByIndex return value

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 20:31:29 PDT 2020


Author: Petr Hosek
Date: 2020-09-14T20:19:06-07:00
New Revision: 042c23506869b4ae9a49d2c4bc5ea6e6baeabe78

URL: https://github.com/llvm/llvm-project/commit/042c23506869b4ae9a49d2c4bc5ea6e6baeabe78
DIFF: https://github.com/llvm/llvm-project/commit/042c23506869b4ae9a49d2c4bc5ea6e6baeabe78.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
    llvm/test/tools/llvm-symbolizer/frame-fortran.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 678f58694e0b..e7662fc5d295 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -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;
 }

diff  --git a/llvm/test/tools/llvm-symbolizer/frame-fortran.s b/llvm/test/tools/llvm-symbolizer/frame-fortran.s
index 744236fd76f9..0cd6f2838a6b 100644
--- a/llvm/test/tools/llvm-symbolizer/frame-fortran.s
+++ b/llvm/test/tools/llvm-symbolizer/frame-fortran.s
@@ -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"


        


More information about the llvm-commits mailing list