10 #include "llvm/ADT/STLExtras.h" 11 #include "llvm/Support/raw_ostream.h" 17 class MergedIndex :
public SymbolIndex {
19 MergedIndex(
const SymbolIndex *
Dynamic,
const SymbolIndex *
Static)
20 : Dynamic(Dynamic), Static(Static) {}
27 bool fuzzyFind(
const FuzzyFindRequest &Req,
28 function_ref<
void(
const Symbol &)>
Callback)
const override {
36 SymbolSlab::Builder DynB;
37 More |=
Dynamic->fuzzyFind(Req, [&](
const Symbol &S) { DynB.insert(S); });
38 SymbolSlab Dyn = std::move(DynB).build();
40 DenseSet<SymbolID> SeenDynamicSymbols;
41 Symbol::Details Scratch;
42 More |=
Static->fuzzyFind(Req, [&](
const Symbol &S) {
43 auto DynS = Dyn.find(S.ID);
44 if (DynS == Dyn.end())
46 SeenDynamicSymbols.insert(S.ID);
49 for (
const Symbol &S : Dyn)
50 if (!SeenDynamicSymbols.count(S.ID))
56 lookup(
const LookupRequest &Req,
57 llvm::function_ref<
void(
const Symbol &)>
Callback)
const override {
58 SymbolSlab::Builder B;
60 Dynamic->lookup(Req, [&](
const Symbol &S) { B.insert(S); });
62 auto RemainingIDs = Req.IDs;
63 Symbol::Details Scratch;
64 Static->lookup(Req, [&](
const Symbol &S) {
65 const Symbol *Sym = B.find(S.ID);
66 RemainingIDs.erase(S.ID);
72 for (
const auto &ID : RemainingIDs)
73 if (
const Symbol *Sym = B.find(ID))
89 Symbol S = PreferR ? R : L;
90 const Symbol &O = PreferR ? L : R;
llvm::StringRef Documentation
Documentation including comment for the symbol declaration.
Optional symbol details that are not required to be set.
Some operations such as code completion produce a set of candidates.
llvm::StringRef IncludeHeader
This can be either a URI of the header to be #include'd for this symbol, or a literal header quoted w...
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>.
llvm::StringRef ReturnType
Type when this symbol is used in an expression.
SymbolLocation Definition
llvm::StringRef Signature
A brief description of the symbol that can be appended in the completion candidate list...
SymbolLocation CanonicalDeclaration
Symbol mergeSymbol(const Symbol &L, const Symbol &R, Symbol::Details *Scratch)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::StringRef CompletionSnippetSuffix
What to insert when completing this symbol, after the symbol name.
SymbolOrigin Origin
Where this symbol came from. Usually an index provides a constant value.
std::unique_ptr< SymbolIndex > mergeIndex(const SymbolIndex *Dynamic, const SymbolIndex *Static)