diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-15 21:36:35 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-15 21:36:35 +0000 |
commit | bc9a574657acea3740e1765a9144a95aee3dca95 (patch) | |
tree | 78e02293031584948def6e6b3fe85fe61d24e7a8 /llvm/lib/Object/ArchiveWriter.cpp | |
parent | d5d761663efbdda724f8c6a2c8ef734808b93f66 (diff) | |
download | llvm-bc9a574657acea3740e1765a9144a95aee3dca95.zip llvm-bc9a574657acea3740e1765a9144a95aee3dca95.tar.gz llvm-bc9a574657acea3740e1765a9144a95aee3dca95.tar.bz2 |
Object: replace backslashes with slashes in embedded relative thin archive paths on Windows.
This makes these thin archives portable between *nix and Windows.
Differential Revision: https://reviews.llvm.org/D26696
llvm-svn: 287038
Diffstat (limited to 'llvm/lib/Object/ArchiveWriter.cpp')
-rw-r--r-- | llvm/lib/Object/ArchiveWriter.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp index a7cd95f..64d04a0 100644 --- a/llvm/lib/Object/ArchiveWriter.cpp +++ b/llvm/lib/Object/ArchiveWriter.cpp @@ -205,6 +205,12 @@ static std::string computeRelativePath(StringRef From, StringRef To) { 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(); } |