summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/FS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/FS.cpp')
-rw-r--r--clang-tools-extra/clangd/FS.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/clang-tools-extra/clangd/FS.cpp b/clang-tools-extra/clangd/FS.cpp
index fa94b967214..5f5dd5c64a5 100644
--- a/clang-tools-extra/clangd/FS.cpp
+++ b/clang-tools-extra/clangd/FS.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "FS.h"
-#include "clang/Basic/VirtualFileSystem.h"
+#include "clang/Basic/LLVM.h"
#include "llvm/ADT/None.h"
#include "llvm/Support/Path.h"
@@ -20,7 +20,8 @@ PreambleFileStatusCache::PreambleFileStatusCache(llvm::StringRef MainFilePath)
assert(llvm::sys::path::is_absolute(MainFilePath));
}
-void PreambleFileStatusCache::update(const vfs::FileSystem &FS, vfs::Status S) {
+void PreambleFileStatusCache::update(const llvm::vfs::FileSystem &FS,
+ llvm::vfs::Status S) {
SmallString<32> PathStore(S.getName());
if (FS.makeAbsolute(PathStore))
return;
@@ -31,7 +32,7 @@ void PreambleFileStatusCache::update(const vfs::FileSystem &FS, vfs::Status S) {
StatCache.insert({PathStore, std::move(S)});
}
-llvm::Optional<vfs::Status>
+llvm::Optional<llvm::vfs::Status>
PreambleFileStatusCache::lookup(llvm::StringRef File) const {
auto I = StatCache.find(File);
if (I != StatCache.end())
@@ -39,17 +40,18 @@ PreambleFileStatusCache::lookup(llvm::StringRef File) const {
return llvm::None;
}
-IntrusiveRefCntPtr<vfs::FileSystem> PreambleFileStatusCache::getProducingFS(
- IntrusiveRefCntPtr<vfs::FileSystem> FS) {
+IntrusiveRefCntPtr<llvm::vfs::FileSystem>
+PreambleFileStatusCache::getProducingFS(
+ 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(IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
PreambleFileStatusCache &StatCache)
: ProxyFileSystem(std::move(FS)), StatCache(StatCache) {}
- llvm::ErrorOr<std::unique_ptr<vfs::File>>
+ llvm::ErrorOr<std::unique_ptr<llvm::vfs::File>>
openFileForRead(const Twine &Path) override {
auto File = getUnderlyingFS().openFileForRead(Path);
if (!File || !*File)
@@ -64,7 +66,7 @@ IntrusiveRefCntPtr<vfs::FileSystem> PreambleFileStatusCache::getProducingFS(
return File;
}
- llvm::ErrorOr<vfs::Status> status(const Twine &Path) override {
+ llvm::ErrorOr<llvm::vfs::Status> status(const Twine &Path) override {
auto S = getUnderlyingFS().status(Path);
if (S)
StatCache.update(getUnderlyingFS(), *S);
@@ -77,15 +79,16 @@ IntrusiveRefCntPtr<vfs::FileSystem> PreambleFileStatusCache::getProducingFS(
return IntrusiveRefCntPtr<CollectFS>(new CollectFS(std::move(FS), *this));
}
-IntrusiveRefCntPtr<vfs::FileSystem> PreambleFileStatusCache::getConsumingFS(
- IntrusiveRefCntPtr<vfs::FileSystem> FS) const {
- class CacheVFS : public vfs::ProxyFileSystem {
+IntrusiveRefCntPtr<llvm::vfs::FileSystem>
+PreambleFileStatusCache::getConsumingFS(
+ IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) const {
+ class CacheVFS : public llvm::vfs::ProxyFileSystem {
public:
- CacheVFS(IntrusiveRefCntPtr<vfs::FileSystem> FS,
+ CacheVFS(IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
const PreambleFileStatusCache &StatCache)
: ProxyFileSystem(std::move(FS)), StatCache(StatCache) {}
- llvm::ErrorOr<vfs::Status> status(const Twine &Path) override {
+ llvm::ErrorOr<llvm::vfs::Status> status(const Twine &Path) override {
if (auto S = StatCache.lookup(Path.str()))
return *S;
return getUnderlyingFS().status(Path);
OpenPOWER on IntegriCloud