10#include "llvm/ADT/STLExtras.h"
17 return OS <<
"Unknown";
18 static constexpr std::array<const char *, 4>
Messages = {
"Decl",
"Def",
"Ref",
20 bool VisitedOnce =
false;
21 for (
unsigned I = 0; I <
Messages.size(); ++I) {
22 if (
static_cast<uint8_t
>(
K) & 1u << I) {
38 E.Reference.Location.FileURI = UniqueStrings.save(S.Location.FileURI).data();
39 Entries.insert(std::move(
E));
43 std::vector<std::pair<SymbolID, llvm::ArrayRef<Ref>>> Result;
46 std::vector<std::pair<SymbolID, const Ref *>> Flat;
47 Flat.reserve(Entries.size());
48 for (
const Entry &
E : Entries)
49 Flat.emplace_back(
E.Symbol, &
E.Reference);
51 llvm::sort(Flat, llvm::less_first());
52 std::vector<Ref> Refs;
54 for (
auto I = Flat.begin(), End = Flat.end(); I != End;) {
58 Refs.push_back(*I->second);
60 }
while (I != End && I->first == Sym);
62 Result.emplace_back(Sym, llvm::ArrayRef<Ref>(Refs).copy(Arena));
64 return RefSlab(std::move(Result), std::move(Arena), Entries.size());
llvm::raw_string_ostream OS
RefSlab build() &&
Consumes the builder to finalize the slab.
void insert(const SymbolID &ID, const Ref &S)
Adds a ref to the slab. Deep copy: Strings will be owned by the slab.
An efficient structure of storing large set of symbol references in memory.
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
RefKind
Describes the kind of a cross-reference.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Represents a symbol occurrence in the source file.
SymbolLocation Location
The source location where the symbol is named.