Go to the documentation of this file.
11 #include "llvm/ADT/StringExtras.h"
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/Support/Error.h"
14 #include "llvm/Support/raw_ostream.h"
22 std::shared_ptr<SymbolIndex> Pin;
24 std::lock_guard<std::mutex> Lock(Mutex);
25 Pin = std::move(this->Index);
26 this->Index = std::move(Index);
29 std::shared_ptr<SymbolIndex> SwapIndex::snapshot()
const {
30 std::lock_guard<std::mutex> Lock(Mutex);
38 O && O.map(
"Query", Request.
Query) && O.map(
"Scopes", Request.
Scopes) &&
39 O.map(
"AnyScope", Request.
AnyScope) && O.map(
"Limit", Limit) &&
43 if (OK && Limit <= std::numeric_limits<uint32_t>::max())
44 Request.
Limit = Limit;
49 return llvm::json::Object{
50 {
"Query", Request.
Query},
51 {
"Scopes", llvm::json::Array{Request.
Scopes}},
53 {
"Limit", Request.
Limit},
61 llvm::function_ref<
void(
const Symbol &)> CB)
const {
62 return snapshot()->fuzzyFind(R, CB);
65 llvm::function_ref<
void(
const Symbol &)> CB)
const {
66 return snapshot()->lookup(R, CB);
69 llvm::function_ref<
void(
const Ref &)> CB)
const {
70 return snapshot()->refs(R, CB);
74 llvm::function_ref<
void(
const SymbolID &,
const Symbol &)> CB)
const {
75 return snapshot()->relations(R, CB);
79 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.
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 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::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.