[clang-tools-extra] r344912 - [clangd] Support URISchemes configuration in BackgroundIndex.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 22 08:37:58 PDT 2018


Author: ioeric
Date: Mon Oct 22 08:37:58 2018
New Revision: 344912

URL: http://llvm.org/viewvc/llvm-project?rev=344912&view=rev
Log:
[clangd] Support URISchemes configuration in BackgroundIndex.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D53503

Modified:
    clang-tools-extra/trunk/clangd/index/Background.cpp
    clang-tools-extra/trunk/clangd/index/Background.h

Modified: clang-tools-extra/trunk/clangd/index/Background.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Background.cpp?rev=344912&r1=344911&r2=344912&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/Background.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/Background.cpp Mon Oct 22 08:37:58 2018
@@ -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::Co
   // 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();
 }
 

Modified: clang-tools-extra/trunk/clangd/index/Background.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Background.h?rev=344912&r1=344911&r2=344912&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/Background.h (original)
+++ clang-tools-extra/trunk/clangd/index/Background.h Mon Oct 22 08:37:58 2018
@@ -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);




More information about the cfe-commits mailing list