22 return OS << llvm::StringRef(S).rtrim(
'|');
38 auto It = llvm::partition_point(Symbols,
39 [&](
const Symbol &S) {
return S.
ID < ID; });
40 if (It != Symbols.end() && It->ID == ID)
47 visitStrings(S, [&](llvm::StringRef &V) { V = Strings.save(V); });
51 own(Symbols[S.
ID] = S, UniqueStrings);
56 std::vector<Symbol> SortedSymbols;
57 SortedSymbols.reserve(Symbols.size());
58 for (
auto &
Entry : Symbols)
59 SortedSymbols.push_back(std::move(
Entry.second));
60 llvm::sort(SortedSymbols,
63 llvm::BumpPtrAllocator NewArena;
64 llvm::UniqueStringSaver
Strings(NewArena);
65 for (
auto &S : SortedSymbols)
67 return SymbolSlab(std::move(NewArena), std::move(SortedSymbols));
An immutable symbol container that stores a set of symbols.
void log(Logger::Level, const llvm::formatv_object_base &)
std::vector< Symbol >::const_iterator const_iterator
const_iterator find(const SymbolID &SymID) const
void insert(const Symbol &S)
Adds a symbol, overwriting any existing one with the same ID.
llvm::StringRef Scope
The containing namespace. e.g. "" (global), "ns::" (top-level namespace).
unsigned References
The number of translation units that reference this symbol from their main file.
SymbolID ID
The ID of the symbol.
SymbolSlab build() &&
Consumes the builder to finalize the slab.
Whether or not this symbol is meant to be used for the code completion.
std::vector< llvm::StringRef > Strings
static void own(Symbol &S, llvm::UniqueStringSaver &Strings)
The class presents a C++ symbol, e.g.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::StringRef Name
The unqualified name of the symbol, e.g. "bar" (for ns::bar).
Indicates if the symbol is deprecated.
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
void visitStrings(Symbol &S, const Callback &CB)
Invokes Callback with each StringRef& contained in the Symbol.
float quality(const Symbol &S)
Computes query-independent quality score for a Symbol.