diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-09 00:26:10 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-09 00:26:10 +0000 |
commit | f5b6d11cf226cd62af2cdd1f28c8d3da6c4dbd59 (patch) | |
tree | 3b6fa96f54efa2986815c770cbad24160118860a /llvm/lib/Support/VirtualFileSystem.cpp | |
parent | 4680386c34ab5475d3ea5fdeca2735f36c8b9112 (diff) | |
download | llvm-f5b6d11cf226cd62af2cdd1f28c8d3da6c4dbd59.zip llvm-f5b6d11cf226cd62af2cdd1f28c8d3da6c4dbd59.tar.gz llvm-f5b6d11cf226cd62af2cdd1f28c8d3da6c4dbd59.tar.bz2 |
[VFS] Add "expand tilde" argument to getRealPath.
Add an optional argument to expand tildes in the path to mirror llvm's
implementation of the corresponding function.
llvm-svn: 346453
Diffstat (limited to 'llvm/lib/Support/VirtualFileSystem.cpp')
-rw-r--r-- | llvm/lib/Support/VirtualFileSystem.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index e8b0435..eeac883 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -132,7 +132,8 @@ std::error_code FileSystem::makeAbsolute(SmallVectorImpl<char> &Path) const { } std::error_code FileSystem::getRealPath(const Twine &Path, - SmallVectorImpl<char> &Output) const { + SmallVectorImpl<char> &Output, + bool ExpandTilde) const { return errc::operation_not_permitted; } @@ -238,8 +239,8 @@ public: llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const override; std::error_code setCurrentWorkingDirectory(const Twine &Path) override; std::error_code isLocal(const Twine &Path, bool &Result) override; - std::error_code getRealPath(const Twine &Path, - SmallVectorImpl<char> &Output) const override; + std::error_code getRealPath(const Twine &Path, SmallVectorImpl<char> &Output, + bool ExpandTilde = false) const override; private: mutable std::mutex CWDMutex; @@ -297,9 +298,9 @@ std::error_code RealFileSystem::isLocal(const Twine &Path, bool &Result) { return llvm::sys::fs::is_local(Path, Result); } -std::error_code -RealFileSystem::getRealPath(const Twine &Path, - SmallVectorImpl<char> &Output) const { +std::error_code RealFileSystem::getRealPath(const Twine &Path, + SmallVectorImpl<char> &Output, + bool ExpandTilde) const { return llvm::sys::fs::real_path(Path, Output); } @@ -393,12 +394,12 @@ std::error_code OverlayFileSystem::isLocal(const Twine &Path, bool &Result) { return errc::no_such_file_or_directory; } -std::error_code -OverlayFileSystem::getRealPath(const Twine &Path, - SmallVectorImpl<char> &Output) const { +std::error_code OverlayFileSystem::getRealPath(const Twine &Path, + SmallVectorImpl<char> &Output, + bool ExpandTilde) const { for (auto &FS : FSList) if (FS->exists(Path)) - return FS->getRealPath(Path, Output); + return FS->getRealPath(Path, Output, ExpandTilde); return errc::no_such_file_or_directory; } @@ -916,9 +917,9 @@ std::error_code InMemoryFileSystem::setCurrentWorkingDirectory(const Twine &P) { return {}; } -std::error_code -InMemoryFileSystem::getRealPath(const Twine &Path, - SmallVectorImpl<char> &Output) const { +std::error_code InMemoryFileSystem::getRealPath(const Twine &Path, + SmallVectorImpl<char> &Output, + bool ExpandTilde) const { auto CWD = getCurrentWorkingDirectory(); if (!CWD || CWD->empty()) return errc::operation_not_permitted; |