23 unsigned CurDocNum = 0;
25 if (++CurDocNum != DocNum)
30 if (std::error_code EC = YIn.error()) {
31 ErrHandler(
"failed to parse YAML input: " + EC.message());
38 return yaml2elf(*Doc.
Elf, Out, ErrHandler, MaxSize);
56 ErrHandler(
"unknown document type");
59 }
while (YIn.nextDocument());
61 ErrHandler(
"cannot find the " +
Twine(DocNum) +
62 getOrdinalSuffix(DocNum).data() +
" document");
66std::unique_ptr<object::ObjectFile>
72 yaml::Input YIn(Yaml);
80 return std::move(*ObjOrErr);
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
An efficient, type-erasing, non-owning reference to a callable.
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an SmallVector or SmallString.
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
bool yaml2dxcontainer(DXContainerYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)
bool yaml2elf(ELFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH, uint64_t MaxSize)
bool yaml2goff(GOFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)
bool yaml2coff(COFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)
bool convertYAML(Input &YIn, raw_ostream &Out, ErrorHandler ErrHandler, unsigned DocNum=1, uint64_t MaxSize=UINT64_MAX)
bool yaml2wasm(WasmYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)
bool yaml2offload(OffloadYAML::Binary &Doc, raw_ostream &Out, ErrorHandler EH)
std::unique_ptr< object::ObjectFile > yaml2ObjectFile(SmallVectorImpl< char > &Storage, StringRef Yaml, ErrorHandler ErrHandler)
Convenience function for tests.
bool yaml2xcoff(XCOFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)
bool yaml2macho(YamlObjectFile &Doc, raw_ostream &Out, ErrorHandler EH)
bool yaml2archive(ArchYAML::Archive &Doc, raw_ostream &Out, ErrorHandler EH)
bool yaml2minidump(MinidumpYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< MachOYAML::UniversalBinary > FatMachO
std::unique_ptr< XCOFFYAML::Object > Xcoff
std::unique_ptr< OffloadYAML::Binary > Offload
std::unique_ptr< MachOYAML::Object > MachO
std::unique_ptr< ArchYAML::Archive > Arch
std::unique_ptr< COFFYAML::Object > Coff
std::unique_ptr< ELFYAML::Object > Elf
std::unique_ptr< GOFFYAML::Object > Goff
std::unique_ptr< WasmYAML::Object > Wasm
std::unique_ptr< DXContainerYAML::Object > DXContainer
std::unique_ptr< MinidumpYAML::Object > Minidump
Common declarations for yaml2obj.