[PATCH] D35405: [index] Added a method indexTopLevelDecls to run indexing on a list of Decls.

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 14 03:48:19 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL308016: [index] Added a method indexTopLevelDecls to run indexing on a list of Decls. (authored by ibiryukov).

Changed prior to commit:
  https://reviews.llvm.org/D35405?vs=106604&id=106614#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35405

Files:
  cfe/trunk/include/clang/Index/IndexingAction.h
  cfe/trunk/lib/Index/IndexingAction.cpp


Index: cfe/trunk/lib/Index/IndexingAction.cpp
===================================================================
--- cfe/trunk/lib/Index/IndexingAction.cpp
+++ cfe/trunk/lib/Index/IndexingAction.cpp
@@ -177,6 +177,18 @@
   DataConsumer->finish();
 }
 
+void index::indexTopLevelDecls(ASTContext &Ctx, ArrayRef<const Decl *> Decls,
+                               std::shared_ptr<IndexDataConsumer> DataConsumer,
+                               IndexingOptions Opts) {
+  IndexingContext IndexCtx(Opts, *DataConsumer);
+  IndexCtx.setASTContext(Ctx);
+
+  DataConsumer->initialize(Ctx);
+  for (const Decl *D : Decls)
+    IndexCtx.indexTopLevelDecl(D);
+  DataConsumer->finish();
+}
+
 void index::indexModuleFile(serialization::ModuleFile &Mod,
                             ASTReader &Reader,
                             std::shared_ptr<IndexDataConsumer> DataConsumer,
Index: cfe/trunk/include/clang/Index/IndexingAction.h
===================================================================
--- cfe/trunk/include/clang/Index/IndexingAction.h
+++ cfe/trunk/include/clang/Index/IndexingAction.h
@@ -11,11 +11,14 @@
 #define LLVM_CLANG_INDEX_INDEXINGACTION_H
 
 #include "clang/Basic/LLVM.h"
+#include "llvm/ADT/ArrayRef.h"
 #include <memory>
 
 namespace clang {
+  class ASTContext;
   class ASTReader;
   class ASTUnit;
+  class Decl;
   class FrontendAction;
 
 namespace serialization {
@@ -47,8 +50,11 @@
                   std::shared_ptr<IndexDataConsumer> DataConsumer,
                   IndexingOptions Opts);
 
-void indexModuleFile(serialization::ModuleFile &Mod,
-                     ASTReader &Reader,
+void indexTopLevelDecls(ASTContext &Ctx, ArrayRef<const Decl *> Decls,
+                        std::shared_ptr<IndexDataConsumer> DataConsumer,
+                        IndexingOptions Opts);
+
+void indexModuleFile(serialization::ModuleFile &Mod, ASTReader &Reader,
                      std::shared_ptr<IndexDataConsumer> DataConsumer,
                      IndexingOptions Opts);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35405.106614.patch
Type: text/x-patch
Size: 2006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170714/2c7e6c54/attachment.bin>


More information about the cfe-commits mailing list