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);


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to