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"
28 io.mapRequired(
"Contexts",
Symbol.Symbol.Contexts);
29 io.mapRequired(
"FilePath",
Symbol.Symbol.FilePath);
31 io.mapRequired(
"Seen",
Symbol.Signals.Seen);
32 io.mapRequired(
"Used",
Symbol.Signals.Used);
38 io.enumCase(value,
"Record", ContextType::Record);
39 io.enumCase(value,
"Namespace", ContextType::Namespace);
40 io.enumCase(value,
"EnumDecl", ContextType::EnumDecl);
44template <>
struct ScalarEnumerationTraits<
SymbolKind> {
46 io.enumCase(value,
"Variable", SymbolKind::Variable);
47 io.enumCase(value,
"Function", SymbolKind::Function);
48 io.enumCase(value,
"Class", SymbolKind::Class);
49 io.enumCase(value,
"TypedefName", SymbolKind::TypedefName);
50 io.enumCase(value,
"EnumDecl", SymbolKind::EnumDecl);
51 io.enumCase(value,
"EnumConstantDecl", SymbolKind::EnumConstantDecl);
52 io.enumCase(value,
"Macro", SymbolKind::Macro);
53 io.enumCase(value,
"Unknown", SymbolKind::Unknown);
59 io.mapRequired(
"ContextType", Context.first);
60 io.mapRequired(
"ContextName", Context.second);
71 llvm::StringRef FilePath,
72 const std::vector<Context> &Contexts)
73 : Name(Name), Type(Type), FilePath(FilePath), Contexts(Contexts) {}
76 return std::tie(Name, Type, FilePath, Contexts) ==
77 std::tie(Symbol.Name, Symbol.Type, Symbol.FilePath, Symbol.Contexts);
81 return std::tie(Name, Type, FilePath, Contexts) <
82 std::tie(Symbol.Name, Symbol.Type, Symbol.FilePath, Symbol.Contexts);
86 std::string QualifiedName = Name;
87 for (
const auto &
Context : Contexts) {
88 if (
Context.first == ContextType::EnumDecl)
90 QualifiedName =
Context.second +
"::" + QualifiedName;
117 llvm::yaml::Output yout(OS);
118 for (
const auto &Symbol : Symbols) {
126 std::vector<SymbolAndSignals> Symbols;
127 llvm::yaml::Input yin(Yaml);
clang::find_all_symbols::SymbolInfo::ContextType ContextType
clang::find_all_symbols::SymbolInfo::SymbolKind SymbolKind
Describes a named symbol from a header.
bool operator==(const SymbolInfo &Symbol) const
ContextType
The Context Type.
std::pair< ContextType, std::string > Context
A pair of <ContextType, ContextName>.
SymbolKind
The SymbolInfo Type.
std::string getQualifiedName() const
Get the fully-qualified symbol name.
bool operator<(const SymbolInfo &Symbol) const
std::map< SymbolInfo, Signals > SignalMap
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.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Some operations such as code completion produce a set of candidates.
The class presents a C++ symbol, e.g.
llvm::StringRef Type
Raw representation of the OpaqueType of the symbol, used for scoring purposes.
llvm::StringRef Name
The unqualified name of the symbol, e.g. "bar" (for ns::bar).
bool operator==(const SymbolAndSignals &RHS) const
SymbolInfo::Signals Signals
static void mapping(IO &io, SymbolAndSignals &Symbol)
static void mapping(IO &io, SymbolInfo::Context &Context)
static void enumeration(IO &io, ContextType &value)
static void enumeration(IO &io, SymbolKind &value)