Replace use of chdir with llvm::sys::fs::set_current_path

NFCI

llvm-svn: 292914
This commit is contained in:
Pavel Labath 2017-01-24 11:14:29 +00:00
parent 78f8630ac0
commit dcbd614c6c
1 changed files with 1 additions and 12 deletions

View File

@ -27,13 +27,6 @@
#include <memory>
#include <utility>
// For chdir.
#ifdef LLVM_ON_WIN32
# include <direct.h>
#else
# include <unistd.h>
#endif
using namespace clang;
using namespace clang::vfs;
using namespace llvm;
@ -235,11 +228,7 @@ std::error_code RealFileSystem::setCurrentWorkingDirectory(const Twine &Path) {
// difference for example on network filesystems, where symlinks might be
// switched during runtime of the tool. Fixing this depends on having a
// file system abstraction that allows openat() style interactions.
SmallString<256> Storage;
StringRef Dir = Path.toNullTerminatedStringRef(Storage);
if (int Err = ::chdir(Dir.data()))
return std::error_code(Err, std::generic_category());
return std::error_code();
return llvm::sys::fs::set_current_path(Path);
}
IntrusiveRefCntPtr<FileSystem> vfs::getRealFileSystem() {