11 #include "llvm/ADT/StringExtras.h" 12 #include "llvm/Support/SHA1.h" 13 #include "llvm/Support/raw_ostream.h" 21 return OS <<
"(none)";
27 : HashValue(SHA1::hash(arrayRefFromStringRef(USR))) {}
30 OS << toHex(toStringRef(ID.HashValue));
36 llvm::raw_string_ostream OS(ID);
42 std::string HexString = fromHex(Str);
43 assert(HexString.size() == ID.HashValue.size());
44 std::copy(HexString.begin(), HexString.end(), ID.HashValue.begin());
49 return OS <<
"unknown";
50 constexpr
static char Sigils[] =
"ADSM4567";
51 for (
unsigned I = 0; I <
sizeof(Sigils); ++I)
52 if (static_cast<uint8_t>(O) & 1u << I)
70 auto It = std::lower_bound(Symbols.begin(), Symbols.end(), ID,
74 if (It != Symbols.end() && It->ID == ID)
80 static void own(
Symbol &S, DenseSet<StringRef> &Strings,
81 BumpPtrAllocator &Arena) {
83 auto Intern = [&](StringRef &V) {
84 auto R = Strings.insert(V);
86 *R.first = V.copy(Arena);
116 Symbols.push_back(S);
117 own(Symbols.back(), Strings, Arena);
119 auto &Copy = Symbols[R.first->second] = S;
120 own(Copy, Strings, Arena);
125 Symbols = {Symbols.begin(), Symbols.end()};
127 std::sort(Symbols.begin(), Symbols.end(),
130 BumpPtrAllocator NewArena;
131 DenseSet<StringRef> Strings;
132 for (
auto &S : Symbols)
133 own(S, Strings, NewArena);
134 return SymbolSlab(std::move(NewArena), std::move(Symbols));
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...
void log(Logger::Level, const llvm::formatv_object_base &)
std::vector< Symbol >::const_iterator const_iterator
Interface for symbol indexes that can be used for searching or matching symbols among a set of symbol...
const_iterator find(const SymbolID &SymID) const
void insert(const Symbol &S)
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
Position Start
The symbol range, using half-open range [Start, End).
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
void operator>>(StringRef Str, SymbolID &ID)
double quality(const Symbol &S)
llvm::StringRef CompletionSnippetSuffix
What to insert when completing this symbol, after the symbol name.
static void own(Symbol &S, DenseSet< StringRef > &Strings, BumpPtrAllocator &Arena)
raw_ostream & operator<<(raw_ostream &OS, const CodeCompletion &C)