mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-17 11:39:11 +00:00
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287038 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eb47aeba1e
commit
0f03473737
@ -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();
|
||||
}
|
||||
|
||||
|
9
test/Object/archive-thin-paths.test
Normal file
9
test/Object/archive-thin-paths.test
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user