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/FunctionExtras.h"
18#include "llvm/Support/JSON.h"
60bool fromJSON(
const llvm::json::Value &
Value, FuzzyFindRequest &Request,
62llvm::json::Value
toJSON(
const FuzzyFindRequest &Request);
65 llvm::DenseSet<SymbolID>
IDs;
69 llvm::DenseSet<SymbolID>
IDs;
103 static_cast<uint8_t
>(R));
108 static_cast<uint8_t
>(R));
142 llvm::function_ref<
void(
const Ref &)>
Callback)
const = 0;
167 : Index(std::move(Index)) {}
168 void reset(std::unique_ptr<SymbolIndex>);
173 llvm::function_ref<
void(
const Symbol &)>)
const override;
175 llvm::function_ref<
void(
const Symbol &)>)
const override;
177 llvm::function_ref<
void(
const Ref &)>)
const override;
188 std::shared_ptr<SymbolIndex> snapshot()
const;
189 mutable std::mutex Mutex;
190 std::shared_ptr<SymbolIndex> Index;
void relations(const RelationsRequest &, llvm::function_ref< void(const SymbolID &, const Symbol &)>) const override
bool refs(const RefsRequest &, llvm::function_ref< void(const Ref &)>) const override
Finds all occurrences (e.g.
void reset(std::unique_ptr< SymbolIndex >)
llvm::unique_function< IndexContents(llvm::StringRef) const > indexedFiles() const override
size_t estimateMemoryUsage() const override
Returns estimated size of index (in bytes).
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.
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.
SwapIndex(std::unique_ptr< SymbolIndex > Index=nullptr)
Interface for symbol indexes that can be used for searching or matching symbols among a set of 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.
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....
virtual bool refs(const RefsRequest &Req, llvm::function_ref< void(const Ref &)> Callback) const =0
Finds all occurrences (e.g.
virtual size_t estimateMemoryUsage() const =0
Returns estimated size of index (in bytes).
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.
virtual ~SymbolIndex()=default
llvm::unique_function< IndexContents(llvm::StringRef) const > IndexedFiles
Returns function which checks if the specified file was used to build this index or not.
virtual IndexedFiles indexedFiles() const =0
IndexContents
Describes what data is covered by an index.
DeclRelationSet operator&(DeclRelation L, DeclRelation R)
DeclRelationSet operator|(DeclRelation L, DeclRelation R)
llvm::unique_function< void(llvm::Expected< T >)> Callback
A Callback<T> is a void function that accepts Expected<T>.
llvm::json::Value toJSON(const FuzzyFindRequest &Request)
RefKind
Describes the kind of a cross-reference.
bool fromJSON(const llvm::json::Value &Parameters, FuzzyFindRequest &Request, llvm::json::Path P)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::vector< std::string > Scopes
If this is non-empty, symbols must be in at least one of the scopes (e.g.
bool RestrictForCodeCompletion
If set to true, only symbols for completion support will be considered.
bool operator!=(const FuzzyFindRequest &Req) const
std::string Query
A query string for the fuzzy find.
std::vector< std::string > ProximityPaths
Contextually relevant files (e.g.
bool operator==(const FuzzyFindRequest &Req) const
bool AnyScope
If set to true, allow symbols from any scope.
std::optional< uint32_t > Limit
The number of top candidates to return.
std::vector< std::string > PreferredTypes
Preferred types of symbols. These are raw representation of OpaqueType.
llvm::DenseSet< SymbolID > IDs
Represents a symbol occurrence in the source file.
bool WantContainer
If set, populates the container of the reference.
llvm::DenseSet< SymbolID > IDs
std::optional< uint32_t > Limit
If set, limit the number of refers returned from the index.
std::optional< uint32_t > Limit
If set, limit the number of relations returned from the index.
llvm::DenseSet< SymbolID > Subjects
The class presents a C++ symbol, e.g.