Go to the documentation of this file.
10 #include "llvm/ADT/StringRef.h"
18 std::shared_ptr<SymbolIndex> Pin;
20 std::lock_guard<std::mutex> Lock(Mutex);
21 Pin = std::move(this->Index);
22 this->Index = std::move(Index);
25 std::shared_ptr<SymbolIndex> SwapIndex::snapshot()
const {
26 std::lock_guard<std::mutex> Lock(Mutex);
35 O && O.map(
"Query", Request.
Query) && O.map(
"Scopes", Request.
Scopes) &&
36 O.map(
"AnyScope", Request.
AnyScope) && O.map(
"Limit", Limit) &&
40 if (OK && Limit <= std::numeric_limits<uint32_t>::max())
41 Request.
Limit = Limit;
46 return llvm::json::Object{
47 {
"Query", Request.
Query},
48 {
"Scopes", Request.
Scopes},
50 {
"Limit", Request.
Limit},
58 llvm::function_ref<
void(
const Symbol &)> CB)
const {
59 return snapshot()->fuzzyFind(R, CB);
62 llvm::function_ref<
void(
const Symbol &)> CB)
const {
63 return snapshot()->lookup(R, CB);
66 llvm::function_ref<
void(
const Ref &)> CB)
const {
67 return snapshot()->refs(R, CB);
71 llvm::function_ref<
void(
const SymbolID &,
const Symbol &)> CB)
const {
72 return snapshot()->relations(R, CB);
78 auto SnapShot = snapshot();
80 return [KeepAlive{std::move(SnapShot)},
81 IndexContainsFile{std::move(
IndexedFiles)}](llvm::StringRef File) {
82 return IndexContainsFile(File);
87 return snapshot()->estimateMemoryUsage();
std::vector< std::string > PreferredTypes
Preferred types of symbols. These are raw representation of OpaqueType.
void reset(std::unique_ptr< SymbolIndex >)
std::vector< std::string > Scopes
If this is non-empty, symbols must be in at least one of the scopes (e.g.
llvm::unique_function< IndexContents(llvm::StringRef) const > IndexedFiles
Returns function which checks if the specified file was used to build this index or not.
std::string Query
A query string for the fuzzy find.
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 fromJSON(const llvm::json::Value &Parameters, FuzzyFindRequest &Request, llvm::json::Path P)
IndexContents
Describes what data is covered by an index.
bool refs(const RefsRequest &, llvm::function_ref< void(const Ref &)>) const override
Finds all occurrences (e.g.
llvm::unique_function< IndexContents(llvm::StringRef) const > indexedFiles() const override
llvm::Optional< uint32_t > Limit
The number of top candidates to return.
const SymbolIndex * Index
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).
bool AnyScope
If set to true, allow symbols from any scope.
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.
static constexpr bool Value
std::vector< HeaderHandle > Path