diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp index 4116ed4628eb..1092b9d5c2ae 100644 --- a/llvm/lib/Object/ArchiveWriter.cpp +++ b/llvm/lib/Object/ArchiveWriter.cpp @@ -514,13 +514,9 @@ std::string computeArchiveRelativePath(StringRef From, StringRef To) { 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 NewMembers,