diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2019-01-07 15:45:19 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2019-01-07 15:45:19 +0000 |
commit | f2001aa74394885dc178c5997b83687acb4f55e4 (patch) | |
tree | 80666e16bbebadef8f35d1d962e09da8a7812d13 /clang-tools-extra/clangd/FS.cpp | |
parent | 25d3de8a0ac4d65f2ac9820ba62a372414780649 (diff) | |
download | bcm5719-llvm-f2001aa74394885dc178c5997b83687acb4f55e4.tar.gz bcm5719-llvm-f2001aa74394885dc178c5997b83687acb4f55e4.zip |
[clangd] Remove 'using namespace llvm' from .cpp files. NFC
The new guideline is to qualify with 'llvm::' explicitly both in
'.h' and '.cpp' files. This simplifies moving the code between
header and source files and is easier to keep consistent.
llvm-svn: 350531
Diffstat (limited to 'clang-tools-extra/clangd/FS.cpp')
-rw-r--r-- | clang-tools-extra/clangd/FS.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/clang-tools-extra/clangd/FS.cpp b/clang-tools-extra/clangd/FS.cpp index e588e00bb77..5d690c86f6b 100644 --- a/clang-tools-extra/clangd/FS.cpp +++ b/clang-tools-extra/clangd/FS.cpp @@ -12,17 +12,17 @@ #include "llvm/ADT/None.h" #include "llvm/Support/Path.h" -using namespace llvm; namespace clang { namespace clangd { -PreambleFileStatusCache::PreambleFileStatusCache(StringRef MainFilePath) +PreambleFileStatusCache::PreambleFileStatusCache(llvm::StringRef MainFilePath) : MainFilePath(MainFilePath) { - assert(sys::path::is_absolute(MainFilePath)); + assert(llvm::sys::path::is_absolute(MainFilePath)); } -void PreambleFileStatusCache::update(const vfs::FileSystem &FS, vfs::Status S) { - SmallString<32> PathStore(S.getName()); +void PreambleFileStatusCache::update(const llvm::vfs::FileSystem &FS, + llvm::vfs::Status S) { + llvm::SmallString<32> PathStore(S.getName()); if (FS.makeAbsolute(PathStore)) return; // Do not cache status for the main file. @@ -32,25 +32,27 @@ void PreambleFileStatusCache::update(const vfs::FileSystem &FS, vfs::Status S) { StatCache.insert({PathStore, std::move(S)}); } -Optional<vfs::Status> PreambleFileStatusCache::lookup(StringRef File) const { +llvm::Optional<llvm::vfs::Status> +PreambleFileStatusCache::lookup(llvm::StringRef File) const { auto I = StatCache.find(File); if (I != StatCache.end()) return I->getValue(); return None; } -IntrusiveRefCntPtr<vfs::FileSystem> PreambleFileStatusCache::getProducingFS( - IntrusiveRefCntPtr<vfs::FileSystem> FS) { +llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> +PreambleFileStatusCache::getProducingFS( + llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) { // This invalidates old status in cache if files are re-`open()`ed or // re-`stat()`ed in case file status has changed during preamble build. - class CollectFS : public vfs::ProxyFileSystem { + class CollectFS : public llvm::vfs::ProxyFileSystem { public: - CollectFS(IntrusiveRefCntPtr<vfs::FileSystem> FS, + CollectFS(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS, PreambleFileStatusCache &StatCache) : ProxyFileSystem(std::move(FS)), StatCache(StatCache) {} - ErrorOr<std::unique_ptr<vfs::File>> - openFileForRead(const Twine &Path) override { + llvm::ErrorOr<std::unique_ptr<llvm::vfs::File>> + openFileForRead(const llvm::Twine &Path) override { auto File = getUnderlyingFS().openFileForRead(Path); if (!File || !*File) return File; @@ -64,7 +66,7 @@ IntrusiveRefCntPtr<vfs::FileSystem> PreambleFileStatusCache::getProducingFS( return File; } - ErrorOr<vfs::Status> status(const Twine &Path) override { + llvm::ErrorOr<llvm::vfs::Status> status(const llvm::Twine &Path) override { auto S = getUnderlyingFS().status(Path); if (S) StatCache.update(getUnderlyingFS(), *S); @@ -74,18 +76,20 @@ IntrusiveRefCntPtr<vfs::FileSystem> PreambleFileStatusCache::getProducingFS( private: PreambleFileStatusCache &StatCache; }; - return IntrusiveRefCntPtr<CollectFS>(new CollectFS(std::move(FS), *this)); + return llvm::IntrusiveRefCntPtr<CollectFS>( + new CollectFS(std::move(FS), *this)); } -IntrusiveRefCntPtr<vfs::FileSystem> PreambleFileStatusCache::getConsumingFS( - IntrusiveRefCntPtr<vfs::FileSystem> FS) const { - class CacheVFS : public vfs::ProxyFileSystem { +llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> +PreambleFileStatusCache::getConsumingFS( + llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) const { + class CacheVFS : public llvm::vfs::ProxyFileSystem { public: - CacheVFS(IntrusiveRefCntPtr<vfs::FileSystem> FS, + CacheVFS(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS, const PreambleFileStatusCache &StatCache) : ProxyFileSystem(std::move(FS)), StatCache(StatCache) {} - ErrorOr<vfs::Status> status(const Twine &Path) override { + llvm::ErrorOr<llvm::vfs::Status> status(const llvm::Twine &Path) override { if (auto S = StatCache.lookup(Path.str())) return *S; return getUnderlyingFS().status(Path); @@ -94,7 +98,7 @@ IntrusiveRefCntPtr<vfs::FileSystem> PreambleFileStatusCache::getConsumingFS( private: const PreambleFileStatusCache &StatCache; }; - return IntrusiveRefCntPtr<CacheVFS>(new CacheVFS(std::move(FS), *this)); + return llvm::IntrusiveRefCntPtr<CacheVFS>(new CacheVFS(std::move(FS), *this)); } } // namespace clangd |