From 791574d72e4d5f5620c02ad77a691829f8cdf753 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 24 Jan 2017 11:14:29 +0000 Subject: [PATCH] Replace use of chdir with llvm::sys::fs::set_current_path NFCI git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292914 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/VirtualFileSystem.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/lib/Basic/VirtualFileSystem.cpp b/lib/Basic/VirtualFileSystem.cpp index 50fcb22faf..9e13bf7cd5 100644 --- a/lib/Basic/VirtualFileSystem.cpp +++ b/lib/Basic/VirtualFileSystem.cpp @@ -27,13 +27,6 @@ #include #include -// For chdir. -#ifdef LLVM_ON_WIN32 -# include -#else -# include -#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 vfs::getRealFileSystem() { -- 2.40.0