LLVM: lib/ObjectYAML/yaml2obj.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

16

17namespace llvm {

18namespace yaml {

19

21 unsigned DocNum, uint64_t MaxSize) {

22 unsigned CurDocNum = 0;

23 do {

24 if (++CurDocNum != DocNum)

25 continue;

26

28 YIn >> Doc;

29 if (std::error_code EC = YIn.error()) {

30 ErrHandler("failed to parse YAML input: " + EC.message());

31 return false;

32 }

33

36 if (Doc.Elf)

37 return yaml2elf(*Doc.Elf, Out, ErrHandler, MaxSize);

43 return yaml2macho(Doc, Out, ErrHandler);

54

55 ErrHandler("unknown document type");

56 return false;

57

59

60 ErrHandler("cannot find the " + Twine(DocNum) +

62 return false;

63}

64

65std::unique_ptrobject::ObjectFile

70

73 return {};

74

78 if (ObjOrErr)

79 return std::move(*ObjOrErr);

80

82 return {};

83}

84

85}

86}

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...

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.

StringRef str() const

Return a StringRef for the vector contents.

The Input class is used to parse a yaml document into in-memory structs and vectors.

std::error_code error() override

LLVM_ABI bool yaml2dxcontainer(DXContainerYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)

LLVM_ABI bool yaml2elf(ELFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH, uint64_t MaxSize)

LLVM_ABI bool yaml2goff(GOFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)

LLVM_ABI bool yaml2coff(COFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)

llvm::function_ref< void(const Twine &Msg)> ErrorHandler

LLVM_ABI bool convertYAML(Input &YIn, raw_ostream &Out, ErrorHandler ErrHandler, unsigned DocNum=1, uint64_t MaxSize=UINT64_MAX)

Definition yaml2obj.cpp:20

LLVM_ABI bool yaml2wasm(WasmYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)

LLVM_ABI bool yaml2offload(OffloadYAML::Binary &Doc, raw_ostream &Out, ErrorHandler EH)

LLVM_ABI std::unique_ptr< object::ObjectFile > yaml2ObjectFile(SmallVectorImpl< char > &Storage, StringRef Yaml, ErrorHandler ErrHandler)

Convenience function for tests.

Definition yaml2obj.cpp:66

LLVM_ABI bool yaml2xcoff(XCOFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)

LLVM_ABI bool yaml2macho(YamlObjectFile &Doc, raw_ostream &Out, ErrorHandler EH)

LLVM_ABI bool yaml2archive(ArchYAML::Archive &Doc, raw_ostream &Out, ErrorHandler EH)

LLVM_ABI bool yaml2minidump(MinidumpYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)

This is an optimization pass for GlobalISel generic memory operations.

StringRef getOrdinalSuffix(unsigned Val)

Returns the English suffix for an ordinal integer (-st, -nd, -rd, -th).

std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)

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.