12 #include "llvm/ADT/Optional.h" 13 #include "llvm/Support/Errc.h" 14 #include "llvm/Support/MemoryBuffer.h" 15 #include "llvm/Support/raw_ostream.h" 26 using clang::index::SymbolLanguage;
48 IO.mapRequired(
"Line", Value.
Line);
49 IO.mapRequired(
"Column", Value.
Column);
55 IO.mapRequired(
"FileURI", Value.
FileURI);
56 IO.mapRequired(
"Start", Value.
Start);
57 IO.mapRequired(
"End", Value.
End);
64 io.mapRequired(
"Kind", SymInfo.Kind);
65 io.mapRequired(
"Lang", SymInfo.Lang);
69 template <>
struct MappingTraits<
Symbol::Details> {
72 io.mapOptional(
"ReturnType", Detail.
ReturnType);
87 assert(IO.getContext() &&
"Expecting an arena (as context) to allocate " 88 "data for read symbols.");
91 return new (*
static_cast<llvm::BumpPtrAllocator *
>(IO.getContext()))
95 llvm::Optional<T>
Opt;
98 template <>
struct MappingTraits<
Symbol> {
100 MappingNormalization<NormalizedSymbolID, SymbolID> NSymbolID(IO, Sym.
ID);
101 MappingNormalization<ArenaPtr<Symbol::Details>,
const Symbol::Details *>
103 IO.mapRequired(
"ID", NSymbolID->HexString);
104 IO.mapRequired(
"Name", Sym.
Name);
105 IO.mapRequired(
"Scope", Sym.
Scope);
106 IO.mapRequired(
"SymInfo", Sym.
SymInfo);
110 IO.mapOptional(
"References", Sym.
References, 0u);
113 IO.mapOptional(
"Signature", Sym.
Signature);
115 IO.mapOptional(
"Detail", NDetail->Opt);
119 template <>
struct ScalarEnumerationTraits<SymbolLanguage> {
121 IO.enumCase(Value,
"C", SymbolLanguage::C);
122 IO.enumCase(Value,
"Cpp", SymbolLanguage::CXX);
123 IO.enumCase(Value,
"ObjC", SymbolLanguage::ObjC);
124 IO.enumCase(Value,
"Swift", SymbolLanguage::Swift);
130 #define DEFINE_ENUM(name) IO.enumCase(Value, #name, SymbolKind::name) 173 llvm::BumpPtrAllocator Arena;
174 llvm::yaml::Input Yin(YAMLContent, &Arena);
175 std::vector<Symbol> S;
181 return std::move(Syms).build();
186 assert(Input.getContext() == &Arena);
193 llvm::yaml::Output Yout(OS);
200 llvm::raw_string_ostream OS(Str);
201 llvm::yaml::Output Yout(OS);
llvm::StringRef Documentation
Documentation including comment for the symbol declaration.
ArenaPtr(IO &, const T *D)
Optional symbol details that are not required to be set.
bool IsIndexedForCodeCompletion
Whether or not this symbol is meant to be used for the code completion.
Some operations such as code completion produce a set of candidates.
static void mapping(IO &io, SymbolInfo &SymInfo)
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...
clang::find_all_symbols::SymbolInfo::SymbolKind SymbolKind
SymbolID denormalize(IO &)
void insert(const Symbol &S)
#define DEFINE_ENUM(name)
static void enumeration(IO &IO, SymbolKind &Value)
llvm::StringRef ReturnType
Type when this symbol is used in an expression.
static void mapping(IO &IO, Symbol &Sym)
index::SymbolInfo SymInfo
static void mapping(IO &IO, SymbolLocation::Position &Value)
SymbolLocation Definition
clang::find_all_symbols::SymbolInfo SymbolInfo
static void mapping(IO &io, Symbol::Details &Detail)
llvm::StringRef Signature
A brief description of the symbol that can be appended in the completion candidate list...
static void enumeration(IO &IO, SymbolLanguage &Value)
SymbolLocation CanonicalDeclaration
void SymbolsToYAML(const SymbolSlab &Symbols, llvm::raw_ostream &OS)
std::string SymbolToYAML(Symbol Sym)
static void mapping(IO &IO, SymbolLocation &Value)
const T * denormalize(IO &IO)
Symbol SymbolFromYAML(llvm::yaml::Input &Input, llvm::BumpPtrAllocator &Arena)
Position Start
The symbol range, using half-open range [Start, End).
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
NormalizedSymbolID(IO &, const SymbolID &ID)
SymbolSlab symbolsFromYAML(llvm::StringRef YAMLContent)
llvm::StringRef CompletionSnippetSuffix
What to insert when completing this symbol, after the symbol name.
std::array< uint8_t, 20 > SymbolID