Go to the documentation of this file.
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;
31 io.mapRequired(
"Contexts",
Symbol.Symbol.Contexts);
32 io.mapRequired(
"FilePath",
Symbol.Symbol.FilePath);
34 io.mapRequired(
"Seen",
Symbol.Signals.Seen);
35 io.mapRequired(
"Used",
Symbol.Signals.Used);
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)
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;
115 return std::tie(Symbol, Signals) == std::tie(RHS.
Symbol, RHS.
Signals);
121 for (
const auto &Symbol :
Symbols) {
129 std::vector<SymbolAndSignals>
Symbols;
130 llvm::yaml::Input yin(Yaml);
static void mapping(IO &io, SymbolInfo::Context &Context)
Describes a named symbol from a header.
Some operations such as code completion produce a set of candidates.
ContextType
The Context Type.
static void mapping(IO &io, SymbolAndSignals &Symbol)
SymbolInfo::Signals Signals
bool operator<(const SymbolInfo &Symbol) const
Signals & operator+=(const Signals &RHS)
static void enumeration(IO &io, SymbolKind &value)
bool operator==(const SymbolAndSignals &RHS) const
std::string getQualifiedName() const
Get the fully-qualified symbol name.
The class presents a C++ symbol, e.g.
bool operator==(const SymbolInfo &Symbol) const
static constexpr llvm::StringLiteral Name
SymbolKind
The SymbolInfo Type.
llvm::StringRef Name
The unqualified name of the symbol, e.g. "bar" (for ns::bar).
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.
clang::find_all_symbols::SymbolInfo::SymbolKind SymbolKind
Signals operator+(const Signals &RHS) const
static void enumeration(IO &io, ContextType &value)
bool operator==(const Signals &RHS) const
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::raw_string_ostream OS
clang::find_all_symbols::SymbolInfo SymbolInfo
std::pair< ContextType, std::string > Context
A pair of <ContextType, ContextName>.
std::map< SymbolInfo, Signals > SignalMap
llvm::StringRef Type
Raw representation of the OpaqueType of the symbol, used for scoring purposes.