From 1949578de3a69064c320fc9b19e44316fa324031 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Fri, 9 Nov 2018 15:11:34 +0000 Subject: [PATCH] Revert "[VFS] Add "expand tilde" argument to getRealPath." This reverts commit r346453. This is a complex change to a widely-used interface, and was not reviewed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346500 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/VirtualFileSystem.h | 17 ++++++------- lib/Support/VirtualFileSystem.cpp | 27 ++++++++++----------- unittests/Support/VirtualFileSystemTest.cpp | 4 +-- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/include/llvm/Support/VirtualFileSystem.h b/include/llvm/Support/VirtualFileSystem.h index 123cc2bce54..b3326bbbe48 100644 --- a/include/llvm/Support/VirtualFileSystem.h +++ b/include/llvm/Support/VirtualFileSystem.h @@ -274,8 +274,7 @@ public: /// symlinks. For real file system, this uses `llvm::sys::fs::real_path`. /// This returns errc::operation_not_permitted if not implemented by subclass. virtual std::error_code getRealPath(const Twine &Path, - SmallVectorImpl &Output, - bool ExpandTilde = false) const; + SmallVectorImpl &Output) const; /// Check whether a file exists. Provided for convenience. bool exists(const Twine &Path); @@ -331,8 +330,8 @@ public: llvm::ErrorOr 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 &Output, - bool ExpandTilde = false) const override; + std::error_code getRealPath(const Twine &Path, + SmallVectorImpl &Output) const override; using iterator = FileSystemList::reverse_iterator; using const_iterator = FileSystemList::const_reverse_iterator; @@ -371,9 +370,9 @@ public: std::error_code setCurrentWorkingDirectory(const Twine &Path) override { return FS->setCurrentWorkingDirectory(Path); } - std::error_code getRealPath(const Twine &Path, SmallVectorImpl &Output, - bool ExpandTilde = false) const override { - return FS->getRealPath(Path, Output, ExpandTilde); + std::error_code getRealPath(const Twine &Path, + SmallVectorImpl &Output) const override { + return FS->getRealPath(Path, Output); } protected: @@ -466,8 +465,8 @@ public: /// /// This doesn't resolve symlinks as they are not supported in in-memory file /// system. - std::error_code getRealPath(const Twine &Path, SmallVectorImpl &Output, - bool ExpandTilde = false) const override; + std::error_code getRealPath(const Twine &Path, + SmallVectorImpl &Output) const override; std::error_code isLocal(const Twine &Path, bool &Result) override; std::error_code setCurrentWorkingDirectory(const Twine &Path) override; }; diff --git a/lib/Support/VirtualFileSystem.cpp b/lib/Support/VirtualFileSystem.cpp index eeac88383aa..e8b0435b9cd 100644 --- a/lib/Support/VirtualFileSystem.cpp +++ b/lib/Support/VirtualFileSystem.cpp @@ -132,8 +132,7 @@ std::error_code FileSystem::makeAbsolute(SmallVectorImpl &Path) const { } std::error_code FileSystem::getRealPath(const Twine &Path, - SmallVectorImpl &Output, - bool ExpandTilde) const { + SmallVectorImpl &Output) const { return errc::operation_not_permitted; } @@ -239,8 +238,8 @@ public: llvm::ErrorOr 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 &Output, - bool ExpandTilde = false) const override; + std::error_code getRealPath(const Twine &Path, + SmallVectorImpl &Output) const override; private: mutable std::mutex CWDMutex; @@ -298,9 +297,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 &Output, - bool ExpandTilde) const { +std::error_code +RealFileSystem::getRealPath(const Twine &Path, + SmallVectorImpl &Output) const { return llvm::sys::fs::real_path(Path, Output); } @@ -394,12 +393,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 &Output, - bool ExpandTilde) const { +std::error_code +OverlayFileSystem::getRealPath(const Twine &Path, + SmallVectorImpl &Output) const { for (auto &FS : FSList) if (FS->exists(Path)) - return FS->getRealPath(Path, Output, ExpandTilde); + return FS->getRealPath(Path, Output); return errc::no_such_file_or_directory; } @@ -917,9 +916,9 @@ std::error_code InMemoryFileSystem::setCurrentWorkingDirectory(const Twine &P) { return {}; } -std::error_code InMemoryFileSystem::getRealPath(const Twine &Path, - SmallVectorImpl &Output, - bool ExpandTilde) const { +std::error_code +InMemoryFileSystem::getRealPath(const Twine &Path, + SmallVectorImpl &Output) const { auto CWD = getCurrentWorkingDirectory(); if (!CWD || CWD->empty()) return errc::operation_not_permitted; diff --git a/unittests/Support/VirtualFileSystemTest.cpp b/unittests/Support/VirtualFileSystemTest.cpp index 3bbb5089c99..466cd117a50 100644 --- a/unittests/Support/VirtualFileSystemTest.cpp +++ b/unittests/Support/VirtualFileSystemTest.cpp @@ -73,8 +73,8 @@ public: return std::error_code(); } // Map any symlink to "/symlink". - std::error_code getRealPath(const Twine &Path, SmallVectorImpl &Output, - bool ExpandTilde) const override { + std::error_code getRealPath(const Twine &Path, + SmallVectorImpl &Output) const override { auto I = FilesAndDirs.find(Path.str()); if (I == FilesAndDirs.end()) return make_error_code(llvm::errc::no_such_file_or_directory);