LLVM: lib/Object/SymbolicFile.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

22#include

23

24using namespace llvm;

25using namespace object;

26

27namespace llvm {

29}

30

33

35

42

45

46 switch (Type) {

48

49

73 return std::unique_ptr(new COFFImportFile(Object));

79 if (!Obj || !Context)

80 return std::move(Obj);

81

84 if (!BCData) {

86 return std::move(Obj);

87 }

88

90 MemoryBufferRef(BCData->getBuffer(), Object.getBufferIdentifier()),

91 *Context);

92 }

93 default:

95 }

96}

97

99 switch (Type) {

101 return Context != nullptr;

126 return true;

127 default:

128 return false;

129 }

130}

Tagged union holding either a T or a Error.

Error takeError()

Take ownership of the stored error.

reference get()

Returns a reference to the stored T value.

This is an important class for using LLVM in a threaded context.

StringRef - Represent a constant reference to a string, i.e.

The instances of the Type class are immutable: once they are created, they are never changed.

static Expected< MemoryBufferRef > findBitcodeInObject(const ObjectFile &Obj)

Finds and returns bitcode embedded in the given object file, or an error code if not found.

static Expected< std::unique_ptr< IRObjectFile > > create(MemoryBufferRef Object, LLVMContext &Context)

static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)

static Expected< std::unique_ptr< SymbolicFile > > createSymbolicFile(MemoryBufferRef Object, llvm::file_magic Type, LLVMContext *Context, bool InitContent=true)

SymbolicFile(unsigned int Type, MemoryBufferRef Source)

static bool isSymbolicFile(file_magic Type, const LLVMContext *Context)

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

This is an optimization pass for GlobalISel generic memory operations.

file_magic identify_magic(StringRef magic)

Identify the type of a binary file based on how magical it is.

Error errorCodeToError(std::error_code EC)

Helper for converting an std::error_code to a Error.

void consumeError(Error Err)

Consume a Error without doing anything.

file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...

@ coff_import_library

COFF import library.

@ elf_relocatable

ELF Relocatable object file.

@ elf_shared_object

ELF dynamically linked shared lib.

@ goff_object

GOFF object file.

@ macho_dynamically_linked_shared_lib

Mach-O dynlinked shared lib.

@ xcoff_object_64

64-bit XCOFF object file

@ elf_executable

ELF Executable image.

@ macho_dynamically_linked_shared_lib_stub

Mach-O Shared lib stub.

@ macho_preload_executable

Mach-O Preloaded Executable.

@ macho_file_set

Mach-O file set binary.

@ macho_kext_bundle

Mach-O kext bundle file.

@ pecoff_executable

PECOFF executable file.

@ macho_core

Mach-O Core File.

@ wasm_object

WebAssembly Object file.

@ xcoff_object_32

32-bit XCOFF object file

@ elf_core

ELF core image.

@ macho_object

Mach-O Object file.

@ coff_object

COFF object file.

@ macho_bundle

Mach-O Bundle file.

@ macho_executable

Mach-O Executable.

@ macho_dsym_companion

Mach-O dSYM companion file.

@ unknown

Unrecognized file.

@ macho_fixed_virtual_memory_shared_lib

Mach-O Shared Lib, FVM.

@ macho_dynamic_linker

The Mach-O dynamic linker.