[PATCH] D58298: [libObject][NFC] Use sys::path::convert_to_slash.

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 15 11:54:28 PST 2019


rupprecht created this revision.
rupprecht added a reviewer: compnerd.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

As suggested in rL353995 <https://reviews.llvm.org/rL353995>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58298

Files:
  llvm/lib/Object/ArchiveWriter.cpp


Index: llvm/lib/Object/ArchiveWriter.cpp
===================================================================
--- llvm/lib/Object/ArchiveWriter.cpp
+++ llvm/lib/Object/ArchiveWriter.cpp
@@ -514,13 +514,9 @@
   for (auto ToE = sys::path::end(To); ToI != ToE; ++ToI)
     sys::path::append(Relative, *ToI);
 
-#ifdef _WIN32
   // Replace backslashes with slashes so that the path is portable between *nix
   // and Windows.
-  std::replace(Relative.begin(), Relative.end(), '\\', '/');
-#endif
-
-  return Relative.str();
+  return sys::path::convert_to_slash(Relative);
 }
 
 Error writeArchive(StringRef ArcName, ArrayRef<NewArchiveMember> NewMembers,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58298.187058.patch
Type: text/x-patch
Size: 651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190215/8bff0c99/attachment.bin>


More information about the llvm-commits mailing list