ioeric created this revision.
ioeric added a reviewer: sammccall.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay, 
ilya-biryukov.

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53503

Files:
  clangd/index/Background.cpp
  clangd/index/Background.h


Index: clangd/index/Background.h
===================================================================
--- clangd/index/Background.h
+++ 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 @@
 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 @@
   std::string ResourceDir;
   const FileSystemProvider &FSProvider;
   Context BackgroundContext;
+  std::vector<std::string> URISchemes;
 
   // index state
   llvm::Error index(tooling::CompileCommand);
Index: clangd/index/Background.cpp
===================================================================
--- clangd/index/Background.cpp
+++ clangd/index/Background.cpp
@@ -24,10 +24,11 @@
 
 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 @@
   // 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();
 }
 


Index: clangd/index/Background.h
===================================================================
--- clangd/index/Background.h
+++ 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 @@
 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 @@
   std::string ResourceDir;
   const FileSystemProvider &FSProvider;
   Context BackgroundContext;
+  std::vector<std::string> URISchemes;
 
   // index state
   llvm::Error index(tooling::CompileCommand);
Index: clangd/index/Background.cpp
===================================================================
--- clangd/index/Background.cpp
+++ clangd/index/Background.cpp
@@ -24,10 +24,11 @@
 
 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 @@
   // 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();
 }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to