diff options
author | Eric Liu <ioeric@google.com> | 2018-10-22 15:37:58 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2018-10-22 15:37:58 +0000 |
commit | 0b70a87480eae19dd34fe7c320545be260cc0364 (patch) | |
tree | 5c96565cf6969c05440f327293e3b86f7670b1ca | |
parent | 01b9fd6868104bc05a48c819d7516078d325b929 (diff) | |
download | bcm5719-llvm-0b70a87480eae19dd34fe7c320545be260cc0364.tar.gz bcm5719-llvm-0b70a87480eae19dd34fe7c320545be260cc0364.zip |
[clangd] Support URISchemes configuration in BackgroundIndex.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D53503
llvm-svn: 344912
-rw-r--r-- | clang-tools-extra/clangd/index/Background.cpp | 7 | ||||
-rw-r--r-- | clang-tools-extra/clangd/index/Background.h | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/clang-tools-extra/clangd/index/Background.cpp b/clang-tools-extra/clangd/index/Background.cpp index 8f40075cacc..9137d1d84b8 100644 --- a/clang-tools-extra/clangd/index/Background.cpp +++ b/clang-tools-extra/clangd/index/Background.cpp @@ -24,10 +24,11 @@ namespace clangd { BackgroundIndex::BackgroundIndex(Context BackgroundContext, StringRef ResourceDir, - const FileSystemProvider &FSProvider) + const FileSystemProvider &FSProvider, + ArrayRef<std::string> URISchemes) : SwapIndex(make_unique<MemIndex>()), ResourceDir(ResourceDir), FSProvider(FSProvider), BackgroundContext(std::move(BackgroundContext)), - Thread([this] { run(); }) {} + URISchemes(URISchemes), Thread([this] { run(); }) {} BackgroundIndex::~BackgroundIndex() { stop(); @@ -185,7 +186,7 @@ Error BackgroundIndex::index(tooling::CompileCommand Cmd) { // FIXME: this should rebuild once-in-a-while, not after every file. // At that point we should use Dex, too. vlog("Rebuilding automatic index"); - reset(IndexedSymbols.buildIndex(IndexType::Light)); + reset(IndexedSymbols.buildIndex(IndexType::Light, URISchemes)); return Error::success(); } diff --git a/clang-tools-extra/clangd/index/Background.h b/clang-tools-extra/clangd/index/Background.h index 3f52423faa8..57cee99d922 100644 --- a/clang-tools-extra/clangd/index/Background.h +++ b/clang-tools-extra/clangd/index/Background.h @@ -18,7 +18,9 @@ #include "llvm/Support/SHA1.h" #include <condition_variable> #include <deque> +#include <string> #include <thread> +#include <vector> namespace clang { namespace clangd { @@ -31,7 +33,8 @@ class BackgroundIndex : public SwapIndex { public: // FIXME: resource-dir injection should be hoisted somewhere common. BackgroundIndex(Context BackgroundContext, StringRef ResourceDir, - const FileSystemProvider &); + const FileSystemProvider &, + ArrayRef<std::string> URISchemes = {}); ~BackgroundIndex(); // Blocks while the current task finishes. // Enqueue a translation unit for indexing. @@ -54,6 +57,7 @@ private: std::string ResourceDir; const FileSystemProvider &FSProvider; Context BackgroundContext; + std::vector<std::string> URISchemes; // index state llvm::Error index(tooling::CompileCommand); |