diff options
| author | Nathan Ridge <zeratul976@hotmail.com> | 2019-06-15 02:26:47 +0000 |
|---|---|---|
| committer | Nathan Ridge <zeratul976@hotmail.com> | 2019-06-15 02:26:47 +0000 |
| commit | f1e6f5713caac5da97dcde34a7042061bb0e6afa (patch) | |
| tree | 3749a6a8cc46c27e65c31811fd870f2c3f9056f8 /clang-tools-extra/clangd/index/IndexAction.cpp | |
| parent | 0b1ea8cb2825cb51c1c2f6dfa9bef95f4a450f93 (diff) | |
| download | bcm5719-llvm-f1e6f5713caac5da97dcde34a7042061bb0e6afa.tar.gz bcm5719-llvm-f1e6f5713caac5da97dcde34a7042061bb0e6afa.zip | |
[clangd] Index API and implementations for relations
Summary:
This builds on the relations support added in D59407, D62459,
and D62471 to expose relations in SymbolIndex and its
implementations.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62839
llvm-svn: 363481
Diffstat (limited to 'clang-tools-extra/clangd/index/IndexAction.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/index/IndexAction.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/index/IndexAction.cpp b/clang-tools-extra/clangd/index/IndexAction.cpp index c4f553bfb61..d3bb8ef818a 100644 --- a/clang-tools-extra/clangd/index/IndexAction.cpp +++ b/clang-tools-extra/clangd/index/IndexAction.cpp @@ -116,9 +116,11 @@ public: const index::IndexingOptions &Opts, std::function<void(SymbolSlab)> SymbolsCallback, std::function<void(RefSlab)> RefsCallback, + std::function<void(RelationSlab)> RelationsCallback, std::function<void(IncludeGraph)> IncludeGraphCallback) : WrapperFrontendAction(index::createIndexingAction(C, Opts, nullptr)), SymbolsCallback(SymbolsCallback), RefsCallback(RefsCallback), + RelationsCallback(RelationsCallback), IncludeGraphCallback(IncludeGraphCallback), Collector(C), Includes(std::move(Includes)), PragmaHandler(collectIWYUHeaderMaps(this->Includes.get())) {} @@ -155,6 +157,8 @@ public: SymbolsCallback(Collector->takeSymbols()); if (RefsCallback != nullptr) RefsCallback(Collector->takeRefs()); + if (RelationsCallback != nullptr) + RelationsCallback(Collector->takeRelations()); if (IncludeGraphCallback != nullptr) { #ifndef NDEBUG // This checks if all nodes are initialized. @@ -168,6 +172,7 @@ public: private: std::function<void(SymbolSlab)> SymbolsCallback; std::function<void(RefSlab)> RefsCallback; + std::function<void(RelationSlab)> RelationsCallback; std::function<void(IncludeGraph)> IncludeGraphCallback; std::shared_ptr<SymbolCollector> Collector; std::unique_ptr<CanonicalIncludes> Includes; @@ -181,6 +186,7 @@ std::unique_ptr<FrontendAction> createStaticIndexingAction( SymbolCollector::Options Opts, std::function<void(SymbolSlab)> SymbolsCallback, std::function<void(RefSlab)> RefsCallback, + std::function<void(RelationSlab)> RelationsCallback, std::function<void(IncludeGraph)> IncludeGraphCallback) { index::IndexingOptions IndexOpts; IndexOpts.SystemSymbolFilter = @@ -198,7 +204,8 @@ std::unique_ptr<FrontendAction> createStaticIndexingAction( Opts.Includes = Includes.get(); return llvm::make_unique<IndexAction>( std::make_shared<SymbolCollector>(std::move(Opts)), std::move(Includes), - IndexOpts, SymbolsCallback, RefsCallback, IncludeGraphCallback); + IndexOpts, SymbolsCallback, RefsCallback, RelationsCallback, + IncludeGraphCallback); } } // namespace clangd |

