10 #include "llvm/Support/CommandLine.h" 11 #include "llvm/Support/FileSystem.h" 12 #include "llvm/Support/YAMLTraits.h" 13 #include "llvm/Support/raw_ostream.h" 15 using llvm::yaml::MappingTraits;
17 using llvm::yaml::Input;
30 io.mapRequired(
"Name", Symbol.
Symbol.Name);
31 io.mapRequired(
"Contexts", Symbol.
Symbol.Contexts);
32 io.mapRequired(
"FilePath", Symbol.
Symbol.FilePath);
33 io.mapRequired(
"Type", Symbol.
Symbol.Type);
47 template <>
struct ScalarEnumerationTraits<SymbolKind> {
62 io.mapRequired(
"ContextType", Context.first);
63 io.mapRequired(
"ContextName", Context.second);
71 namespace find_all_symbols {
74 llvm::StringRef FilePath,
75 const std::vector<Context> &Contexts)
76 : Name(Name), Type(Type), FilePath(FilePath), Contexts(Contexts) {}
79 return std::tie(Name, Type, FilePath, Contexts) ==
80 std::tie(Symbol.Name, Symbol.Type, Symbol.FilePath, Symbol.Contexts);
84 return std::tie(Name, Type, FilePath, Contexts) <
85 std::tie(Symbol.Name, Symbol.Type, Symbol.FilePath, Symbol.Contexts);
89 std::string QualifiedName = Name;
90 for (
const auto &
Context : Contexts) {
93 QualifiedName =
Context.second +
"::" + QualifiedName;
120 llvm::yaml::Output yout(OS);
121 for (
const auto &Symbol : Symbols) {
129 std::vector<SymbolAndSignals>
Symbols;
130 llvm::yaml::Input yin(Yaml);
static void enumeration(IO &io, SymbolKind &value)
Some operations such as code completion produce a set of candidates.
bool operator<(const SymbolInfo &Symbol) const
Signals & operator+=(const Signals &RHS)
static void enumeration(IO &io, ContextType &value)
ContextType
The Context Type.
bool WriteSymbolInfosToStream(llvm::raw_ostream &OS, const SymbolInfo::SignalMap &Symbols)
Write SymbolInfos to a stream (YAML format).
std::vector< SymbolAndSignals > ReadSymbolInfosFromYAML(llvm::StringRef Yaml)
Read SymbolInfos from a YAML document.
std::string getQualifiedName() const
Get the fully-qualified symbol name.
SymbolInfo::Signals Signals
clang::find_all_symbols::SymbolInfo SymbolInfo
static constexpr llvm::StringLiteral Name
SymbolKind
The SymbolInfo Type.
static void mapping(IO &io, SymbolInfo::Context &Context)
bool operator==(const SymbolAndSignals &RHS) const
bool operator==(const SymbolInfo &Symbol) const
The class presents a C++ symbol, e.g.
std::pair< ContextType, std::string > Context
A pair of <ContextType, ContextName>.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::map< SymbolInfo, Signals > SignalMap
Signals operator+(const Signals &RHS) const
Describes a named symbol from a header.
static void mapping(IO &io, SymbolAndSignals &Symbol)
bool operator==(const Signals &RHS) const