[PATCH] D26734: [ELF] Don't replace path separators on *NIX
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 16 00:03:49 PST 2016
davide created this revision.
davide added reviewers: rafael, pcc.
davide added a subscriber: llvm-commits.
Avoid wasted work. Inspired by Peter Collingbourne's similar change for libArchive. (
https://reviews.llvm.org/D26696)
https://reviews.llvm.org/D26734
Files:
lib/Core/Reproduce.cpp
Index: lib/Core/Reproduce.cpp
===================================================================
--- lib/Core/Reproduce.cpp
+++ lib/Core/Reproduce.cpp
@@ -52,9 +52,11 @@
// Converts path to use unix path separators so the cpio can be extracted on
// both unix and windows.
+#ifdef LLVM_ON_WIN32
static void convertToUnixPathSeparator(SmallString<128> &Path) {
std::replace(Path.begin(), Path.end(), '\\', '/');
}
+#endif
void CpioFile::append(StringRef Path, StringRef Data) {
if (!Seen.insert(Path).second)
@@ -65,7 +67,10 @@
// (i.e. in that case we are creating baz.cpio.)
SmallString<128> Fullpath;
path::append(Fullpath, Basename, Path);
+
+#ifdef LLVM_ON_WIN32
convertToUnixPathSeparator(Fullpath);
+#endif
writeMember(*OS, Fullpath, Data);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26734.78142.patch
Type: text/x-patch
Size: 782 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161116/26307393/attachment.bin>
More information about the llvm-commits
mailing list