r292914 - Replace use of chdir with llvm::sys::fs::set_current_path
Pavel Labath via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 24 03:14:30 PST 2017
Author: labath
Date: Tue Jan 24 05:14:29 2017
New Revision: 292914
URL: http://llvm.org/viewvc/llvm-project?rev=292914&view=rev
Log:
Replace use of chdir with llvm::sys::fs::set_current_path
NFCI
Modified:
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=292914&r1=292913&r2=292914&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Tue Jan 24 05:14:29 2017
@@ -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::setCurre
// 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() {
More information about the cfe-commits
mailing list