[PATCH] D26696: Object: replace backslashes with slashes in embedded relative thin archive paths on Windows.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 13:46:25 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL287038: Object: replace backslashes with slashes in embedded relative thin archiveā€¦ (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D26696?vs=78063&id=78072#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26696

Files:
  llvm/trunk/lib/Object/ArchiveWriter.cpp
  llvm/trunk/test/Object/archive-thin-paths.test


Index: llvm/trunk/test/Object/archive-thin-paths.test
===================================================================
--- llvm/trunk/test/Object/archive-thin-paths.test
+++ llvm/trunk/test/Object/archive-thin-paths.test
@@ -0,0 +1,9 @@
+REQUIRES: system-windows
+
+RUN: cd %T
+RUN: mkdir -p archive-thin-paths.dir
+RUN: echo foo > archive-thin-paths.dir/foo.o
+
+RUN: rm -f archive-thin-paths.a
+RUN: llvm-ar rcsT archive-thin-paths.a archive-thin-paths.dir\foo.o
+RUN: grep archive-thin-paths.dir/foo.o archive-thin-paths.a
Index: llvm/trunk/lib/Object/ArchiveWriter.cpp
===================================================================
--- llvm/trunk/lib/Object/ArchiveWriter.cpp
+++ llvm/trunk/lib/Object/ArchiveWriter.cpp
@@ -205,6 +205,12 @@
   for (auto ToE = sys::path::end(To); ToI != ToE; ++ToI)
     sys::path::append(Relative, *ToI);
 
+#ifdef LLVM_ON_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();
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26696.78072.patch
Type: text/x-patch
Size: 1078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161115/88dde41a/attachment.bin>


More information about the llvm-commits mailing list