21 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_DEX_H 22 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_DEX_H 45 template <
typename SymbolRange,
typename RefsRange>
46 Dex(SymbolRange &&Symbols, RefsRange &&Refs) :
Corpus(0) {
47 for (
auto &&Sym : Symbols)
48 this->Symbols.push_back(&Sym);
49 for (
auto &&
Ref : Refs)
50 this->Refs.try_emplace(
Ref.first,
Ref.second);
54 template <
typename SymbolRange,
typename RefsRange,
typename Payload>
55 Dex(SymbolRange &&Symbols, RefsRange &&Refs, Payload &&BackingData,
56 size_t BackingDataSize)
57 :
Dex(std::forward<SymbolRange>(Symbols), std::forward<RefsRange>(Refs)) {
58 KeepAlive = std::shared_ptr<void>(
59 std::make_shared<Payload>(std::move(BackingData)),
nullptr);
60 this->BackingDataSize = BackingDataSize;
74 llvm::function_ref<
void(
const Ref &)>
Callback)
const override;
80 std::unique_ptr<Iterator> iterator(
const Token &Tok)
const;
83 std::vector<const Symbol *> Symbols;
85 std::vector<float> SymbolQuality;
86 llvm::DenseMap<SymbolID, const Symbol *> LookupTable;
93 llvm::DenseMap<Token, PostingList> InvertedIndex;
95 llvm::DenseMap<SymbolID, llvm::ArrayRef<Ref>> Refs;
96 std::shared_ptr<void> KeepAlive;
98 size_t BackingDataSize = 0;
111 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_DEX_H Dex(SymbolRange &&Symbols, RefsRange &&Refs)
void refs(const RefsRequest &Req, llvm::function_ref< void(const Ref &)> Callback) const override
Finds all occurrences (e.g.
Interface for symbol indexes that can be used for searching or matching symbols among a set of symbol...
llvm::unique_function< void(llvm::Expected< T >)> Callback
A Callback<T> is a void function that accepts Expected<T>.
bool fuzzyFind(const FuzzyFindRequest &Req, llvm::function_ref< void(const Symbol &)> Callback) const override
Constructs iterators over tokens extracted from the query and exhausts it while applying Callback to ...
A Token represents an attribute of a symbol, such as a particular trigram present in the name (used f...
std::vector< std::string > generateProximityURIs(llvm::StringRef URIPath)
Returns Search Token for a number of parent directories of given Path.
static std::unique_ptr< SymbolIndex > build(SymbolSlab, RefSlab)
Builds an index from slabs. The index takes ownership of the slab.
void lookup(const LookupRequest &Req, llvm::function_ref< void(const Symbol &)> Callback) const override
Looks up symbols with any of the given symbol IDs and applies Callback on each matched symbol...
This defines posting list interface: a storage for identifiers of symbols which can be characterized ...
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Trigrams are attributes of the symbol unqualified name used to effectively extract symbols which can ...
Symbol index queries consist of specific requirements for the requested symbol, such as high fuzzy ma...
In-memory Dex trigram-based index implementation.
size_t estimateMemoryUsage() const override
Returns estimated size of index (in bytes).
Token objects represent a characteristic of a symbol, which can be used to perform efficient search...
Dex(SymbolRange &&Symbols, RefsRange &&Refs, Payload &&BackingData, size_t BackingDataSize)