20 LLVM_YAML_STRONG_TYPEDEF(
ELFArch, ELFArchMapper)
34 if (!IO.outputting() && IO.matchEnumFallback())
40 template <>
struct ScalarTraits<ELFArchMapper> {
82 return StringRef(
"Can't parse version: invalid version format.");
85 return StringRef(
"Unsupported TBE version.");
98 IO.mapRequired(
"Type", Symbol.
Type);
101 IO.mapOptional(
"Size", Symbol.
Size, (uint64_t)0);
105 IO.mapRequired(
"Size", Symbol.
Size);
107 IO.mapOptional(
"Undefined", Symbol.
Undefined,
false);
108 IO.mapOptional(
"Weak", Symbol.
Weak,
false);
109 IO.mapOptional(
"Warning", Symbol.
Warning);
113 static const bool flow =
true;
117 template <>
struct CustomMappingTraits<
std::set<ELFSymbol>> {
120 IO.mapRequired(Key.
str().c_str(), Sym);
124 static void output(IO &IO, std::set<ELFSymbol> &Set) {
125 for (
auto &Sym : Set)
126 IO.mapRequired(Sym.Name.c_str(),
const_cast<ELFSymbol &
>(Sym));
133 if (!IO.mapTag(
"!tapi-tbe",
true))
134 IO.setError(
"Not a .tbe YAML file.");
135 IO.mapRequired(
"TbeVersion", Stub.
TbeVersion);
136 IO.mapOptional(
"SoName", Stub.
SoName);
137 IO.mapRequired(
"Arch", (ELFArchMapper &)Stub.
Arch);
138 IO.mapOptional(
"NeededLibs", Stub.
NeededLibs);
139 IO.mapRequired(
"Symbols", Stub.
Symbols);
147 yaml::Input YamlIn(Buf);
148 std::unique_ptr<ELFStub> Stub(
new ELFStub());
150 if (std::error_code Err = YamlIn.error())
153 return std::move(Stub);
157 yaml::Output YamlOut(OS, NULL, 0);
159 YamlOut << const_cast<ELFStub &>(Stub);
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
static void output(const ELFArchMapper &Value, void *, llvm::raw_ostream &Out)
std::set< ELFSymbol > Symbols
This class represents lattice values for constants.
static void mapping(IO &IO, ELFStub &Stub)
Error writeTBEToOutputStream(raw_ostream &OS, const ELFStub &Stub)
Attempts to write an ELF interface file to a raw_ostream.
Optional< std::string > Warning
static QuotingType mustQuote(StringRef)
Tagged union holding either a T or a Error.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(T Value)
static void mapping(IO &IO, ELFSymbol &Symbol)
Optional< std::string > SoName
static QuotingType mustQuote(StringRef)
A switch()-like statement whose cases are string literals.
static void inputOne(IO &IO, StringRef Key, std::set< ELFSymbol > &Set)
static StringRef input(StringRef Scalar, void *, VersionTuple &Value)
std::vector< std::string > NeededLibs
const VersionTuple TBEVersionCurrent(1, 0)
static ErrorSuccess success()
Create a success value.
bool tryParse(StringRef string)
Try to parse the given string as a version number.
static void output(const VersionTuple &Value, void *, llvm::raw_ostream &Out)
This file declares an interface for reading and writing .tbe (text-based ELF) files.
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(StringLiteral S, T Value)
Represents a version number in the form major[.minor[.subminor[.build]]].
std::string getAsString() const
Retrieve a string representation of the version number.
This file defines an internal representation of an ELF stub.
static void enumeration(IO &IO, ELFSymbolType &SymbolType)
static void output(IO &IO, std::set< ELFSymbol > &Set)
LLVM Value Representation.
Lightweight error class with error context and mandatory checking.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
static StringRef input(StringRef Scalar, void *, ELFArchMapper &Value)
Expected< std::unique_ptr< ELFStub > > readTBEFromBuffer(StringRef Buf)
Attempts to read an ELF interface file from a StringRef buffer.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.