[PATCH] D87657: [DebugInfo] Remove dots from getFilenameByIndex return value

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 17:51:26 PDT 2020


phosek created this revision.
phosek added a reviewer: dblaikie.
Herald added subscribers: llvm-commits, rupprecht, arphaman, hiraditya.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.
phosek requested review of this revision.
Herald added a subscriber: MaskRay.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87657

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


Index: llvm/test/tools/llvm-symbolizer/frame-fortran.s
===================================================================
--- llvm/test/tools/llvm-symbolizer/frame-fortran.s
+++ 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"
Index: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -1391,6 +1391,7 @@
 
   // 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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87657.291747.patch
Type: text/x-patch
Size: 925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/85a300b5/attachment.bin>


More information about the llvm-commits mailing list