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);
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);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits