Go to the documentation of this file.
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_INDEX_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_INDEX_H
16 #include "llvm/ADT/DenseSet.h"
17 #include "llvm/ADT/Optional.h"
18 #include "llvm/ADT/StringExtras.h"
19 #include "llvm/Support/JSON.h"
60 bool fromJSON(
const llvm::json::Value &Value, FuzzyFindRequest &Request);
61 llvm::json::Value
toJSON(
const FuzzyFindRequest &Request);
64 llvm::DenseSet<SymbolID>
IDs;
68 llvm::DenseSet<SymbolID>
IDs;
113 llvm::function_ref<
void(
const Ref &)>
Callback)
const = 0;
132 : Index(std::move(Index)) {}
133 void reset(std::unique_ptr<SymbolIndex>);
138 llvm::function_ref<
void(
const Symbol &)>)
const override;
140 llvm::function_ref<
void(
const Symbol &)>)
const override;
142 llvm::function_ref<
void(
const Ref &)>)
const override;
150 std::shared_ptr<SymbolIndex> snapshot()
const;
151 mutable std::mutex Mutex;
152 std::shared_ptr<SymbolIndex> Index;
158 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_INDEX_H
SwapIndex(std::unique_ptr< SymbolIndex > Index=nullptr)
std::vector< std::string > PreferredTypes
Preferred types of symbols. These are raw representation of OpaqueType.
bool operator==(const FuzzyFindRequest &Req) const
llvm::Optional< uint32_t > Limit
If set, limit the number of relations returned from the index.
void reset(std::unique_ptr< SymbolIndex >)
RefKind
Describes the kind of a cross-reference.
virtual ~SymbolIndex()=default
std::vector< std::string > Scopes
If this is non-empty, symbols must be in at least one of the scopes (e.g.
std::string Query
A query string for the fuzzy find.
virtual size_t estimateMemoryUsage() const =0
Returns estimated size of index (in bytes).
bool operator!=(const FuzzyFindRequest &Req) const
virtual void lookup(const LookupRequest &Req, llvm::function_ref< void(const Symbol &)> Callback) const =0
Looks up symbols with any of the given symbol IDs and applies Callback on each matched symbol.
llvm::DenseSet< SymbolID > Subjects
virtual void relations(const RelationsRequest &Req, llvm::function_ref< void(const SymbolID &Subject, const Symbol &Object)> Callback) const =0
Finds all relations (S, P, O) stored in the index such that S is among Req.Subjects and P is Req....
void relations(const RelationsRequest &, llvm::function_ref< void(const SymbolID &, const Symbol &)>) const override
llvm::json::Value toJSON(const FuzzyFindRequest &Request)
The class presents a C++ symbol, e.g.
bool refs(const RefsRequest &, llvm::function_ref< void(const Ref &)>) const override
Finds all occurrences (e.g.
bool fromJSON(const llvm::json::Value &Parameters, FuzzyFindRequest &Request)
llvm::DenseSet< SymbolID > IDs
llvm::Optional< uint32_t > Limit
The number of top candidates to return.
llvm::DenseSet< SymbolID > IDs
virtual bool refs(const RefsRequest &Req, llvm::function_ref< void(const Ref &)> Callback) const =0
Finds all occurrences (e.g.
Interface for symbol indexes that can be used for searching or matching symbols among a set of symbol...
Represents a symbol occurrence in the source file.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
size_t estimateMemoryUsage() const override
Returns estimated size of index (in bytes).
llvm::Optional< uint32_t > Limit
If set, limit the number of refers returned from the index.
bool AnyScope
If set to true, allow symbols from any scope.
llvm::unique_function< void(llvm::Expected< T >)> Callback
A Callback<T> is a void function that accepts Expected<T>.
bool RestrictForCodeCompletion
If set to true, only symbols for completion support will be considered.
bool fuzzyFind(const FuzzyFindRequest &, llvm::function_ref< void(const Symbol &)>) const override
Matches symbols in the index fuzzily and applies Callback on each matched symbol before returning.
std::vector< std::string > ProximityPaths
Contextually relevant files (e.g.
void lookup(const LookupRequest &, llvm::function_ref< void(const Symbol &)>) const override
Looks up symbols with any of the given symbol IDs and applies Callback on each matched symbol.
virtual bool fuzzyFind(const FuzzyFindRequest &Req, llvm::function_ref< void(const Symbol &)> Callback) const =0
Matches symbols in the index fuzzily and applies Callback on each matched symbol before returning.