diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -423,6 +423,8 @@ } bool FileManager::FixupRelativePath(SmallVectorImpl &path) const { + using namespace llvm::sys::path; + StringRef pathRef(path.data(), path.size()); if (FileSystemOpts.WorkingDir.empty() @@ -430,7 +432,19 @@ return false; SmallString<128> NewPath(FileSystemOpts.WorkingDir); - llvm::sys::path::append(NewPath, pathRef); + Style sepStyle = Style::native; + + for (char c : NewPath) { + if (is_separator(c, Style::windows)) { + sepStyle = Style::windows; + break; + } else if (is_separator(c, Style::posix)) { + sepStyle = Style::posix; + break; + } + } + + append(NewPath, sepStyle, pathRef); path = NewPath; return true; }