11 #include "llvm/Support/CommandLine.h" 12 #include "llvm/Support/FileSystem.h" 13 #include "llvm/Support/YAMLTraits.h" 14 #include "llvm/Support/raw_ostream.h" 16 using llvm::yaml::MappingTraits;
18 using llvm::yaml::Input;
31 io.mapRequired(
"Name", Symbol.
Symbol.Name);
32 io.mapRequired(
"Contexts", Symbol.
Symbol.Contexts);
33 io.mapRequired(
"FilePath", Symbol.
Symbol.FilePath);
34 io.mapRequired(
"Type", Symbol.
Symbol.Type);
48 template <>
struct ScalarEnumerationTraits<SymbolKind> {
63 io.mapRequired(
"ContextType", Context.first);
64 io.mapRequired(
"ContextName", Context.second);
72 namespace find_all_symbols {
75 llvm::StringRef FilePath,
76 const std::vector<Context> &Contexts)
77 : Name(Name), Type(Type), FilePath(FilePath), Contexts(Contexts) {}
80 return std::tie(Name, Type, FilePath, Contexts) ==
81 std::tie(Symbol.Name, Symbol.Type, Symbol.FilePath, Symbol.Contexts);
85 return std::tie(Name, Type, FilePath, Contexts) <
86 std::tie(Symbol.Name, Symbol.Type, Symbol.FilePath, Symbol.Contexts);
90 std::string QualifiedName = Name;
91 for (
const auto &
Context : Contexts) {
94 QualifiedName =
Context.second +
"::" + QualifiedName;
121 llvm::yaml::Output yout(OS);
122 for (
const auto &Symbol : Symbols) {
130 std::vector<SymbolAndSignals> Symbols;
131 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.
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
static void mapping(IO &io, SymbolInfo::Context &Context)
bool operator==(const SymbolAndSignals &RHS) const
bool operator==(const SymbolInfo &Symbol) const
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