13 #include "llvm/ADT/STLExtras.h" 14 #include "llvm/ADT/StringSet.h" 15 #include "llvm/Support/raw_ostream.h" 37 unsigned DynamicCount = 0;
38 unsigned StaticCount = 0;
39 unsigned MergedCount = 0;
46 llvm::DenseSet<SymbolID> SeenDynamicSymbols;
48 auto DynS = Dyn.
find(S.
ID);
50 if (DynS == Dyn.
end())
53 SeenDynamicSymbols.insert(S.
ID);
59 for (
const Symbol &S : Dyn)
60 if (!SeenDynamicSymbols.count(S.
ID))
73 auto RemainingIDs = Req.
IDs;
76 RemainingIDs.erase(S.
ID);
82 for (
const auto &ID : RemainingIDs)
88 llvm::function_ref<
void(
const Ref &)>
Callback)
const {
91 Req.
Limit.getValueOr(std::numeric_limits<uint32_t>::max());
100 llvm::StringSet<> DynamicIndexFileURIs;
101 Dynamic->
refs(Req, [&](
const Ref &O) {
106 assert(Remaining >= 0);
111 Static->
refs(Req, [&](
const Ref &O) {
112 if (Remaining > 0 && !DynamicIndexFileURIs.count(O.
Location.
FileURI)) {
120 assert(L.
ID == R.
ID);
130 Symbol S = PreferR ? R : L;
131 const Symbol &O = PreferR ? L : R;
153 if (SI.IncludeHeader == OI.IncludeHeader) {
155 SI.References += OI.References;
159 if (!Found && MergeIncludes)
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...
const Symbol * find(const SymbolID &ID)
const_iterator find(const SymbolID &SymID) const
llvm::DenseSet< SymbolID > IDs
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...
void insert(const Symbol &S)
llvm::unique_function< void(llvm::Expected< T >)> Callback
A Callback<T> is a void function that accepts Expected<T>.
SymbolLocation Definition
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...
llvm::SmallVector< IncludeHeaderWithReferences, 1 > IncludeHeaders
One Symbol can potentially be incuded via different headers.
llvm::StringRef Signature
A brief description of the symbol that can be appended in the completion candidate list...
llvm::StringRef Documentation
Documentation including comment for the symbol declaration.
SymbolLocation CanonicalDeclaration
Symbol mergeSymbol(const Symbol &L, const Symbol &R)
virtual void refs(const RefsRequest &Req, llvm::function_ref< void(const Ref &)> Callback) const =0
Finds all occurrences (e.g.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::Optional< uint32_t > Limit
If set, limit the number of refers returned from the index.
void refs(const RefsRequest &, llvm::function_ref< void(const Ref &)>) const override
Finds all occurrences (e.g.
llvm::StringRef CompletionSnippetSuffix
What to insert when completing this symbol, after the symbol name.
const_iterator end() const
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...
llvm::StringRef Type
Raw representation of the OpaqueType of the symbol, used for scoring purposes.
SymbolOrigin Origin
Where this symbol came from. Usually an index provides a constant value.
Records an event whose duration is the lifetime of the Span object.
llvm::StringRef ReturnType
Type when this symbol is used in an expression.
#define SPAN_ATTACH(S, Name, Expr)
Attach a key-value pair to a Span event.