summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/VirtualFileSystem.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-01-24 11:14:29 +0000
committerPavel Labath <labath@google.com>2017-01-24 11:14:29 +0000
commitdcbd614c6c0a6962d28656b7b04bebedc262bbd2 (patch)
treeb81ece951d78f7d04c589d452dc4355cab919f26 /clang/lib/Basic/VirtualFileSystem.cpp
parent78f8630ac098b63d904e8c5ab50c6e2d6d5bae5b (diff)
downloadbcm5719-llvm-dcbd614c6c0a6962d28656b7b04bebedc262bbd2.tar.gz
bcm5719-llvm-dcbd614c6c0a6962d28656b7b04bebedc262bbd2.zip
Replace use of chdir with llvm::sys::fs::set_current_path
NFCI llvm-svn: 292914
Diffstat (limited to 'clang/lib/Basic/VirtualFileSystem.cpp')
-rw-r--r--clang/lib/Basic/VirtualFileSystem.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/clang/lib/Basic/VirtualFileSystem.cpp b/clang/lib/Basic/VirtualFileSystem.cpp
index 50fcb22faf5..9e13bf7cd54 100644
--- a/clang/lib/Basic/VirtualFileSystem.cpp
+++ b/clang/lib/Basic/VirtualFileSystem.cpp
@@ -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() {
OpenPOWER on IntegriCloud