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/Index.h | |
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/Index.h')
-rw-r--r-- | clang-tools-extra/clangd/index/Index.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/index/Index.h b/clang-tools-extra/clangd/index/Index.h index 87a777e72df..8ccadf20653 100644 --- a/clang-tools-extra/clangd/index/Index.h +++ b/clang-tools-extra/clangd/index/Index.h @@ -73,6 +73,13 @@ struct RefsRequest { llvm::Optional<uint32_t> Limit; }; +struct RelationsRequest { + llvm::DenseSet<SymbolID> Subjects; + index::SymbolRole Predicate; + /// If set, limit the number of relations returned from the index. + llvm::Optional<uint32_t> Limit; +}; + /// Interface for symbol indexes that can be used for searching or /// matching symbols among a set of symbols based on names or unique IDs. class SymbolIndex { @@ -103,6 +110,14 @@ public: virtual void refs(const RefsRequest &Req, llvm::function_ref<void(const Ref &)> Callback) const = 0; + /// Finds all relations (S, P, O) stored in the index such that S is among + /// Req.Subjects and P is Req.Predicate, and invokes \p Callback for (S, O) in + /// each. + virtual void relations( + const RelationsRequest &Req, + llvm::function_ref<void(const SymbolID &Subject, const Symbol &Object)> + Callback) const = 0; + /// Returns estimated size of index (in bytes). virtual size_t estimateMemoryUsage() const = 0; }; @@ -123,6 +138,10 @@ public: llvm::function_ref<void(const Symbol &)>) const override; void refs(const RefsRequest &, llvm::function_ref<void(const Ref &)>) const override; + void relations(const RelationsRequest &, + llvm::function_ref<void(const SymbolID &, const Symbol &)>) + const override; + size_t estimateMemoryUsage() const override; private: |