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
74 return std::unique_ptr(new COFFImportFile(Object));
80 if (!Obj || !Context)
81 return std::move(Obj);
82
85 if (!BCData) {
87 return std::move(Obj);
88 }
89
91 MemoryBufferRef(BCData->getBuffer(), Object.getBufferIdentifier()),
92 *Context);
93 }
94 default:
96 }
97}
98
100 switch (Type) {
102 return Context != nullptr;
128 return true;
129 default:
130 return false;
131 }
132}
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
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.
Binary(unsigned int Type, MemoryBufferRef Source)
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)
Definition SymbolicFile.cpp:37
SymbolicFile(unsigned int Type, MemoryBufferRef Source)
Definition SymbolicFile.cpp:31
static bool isSymbolicFile(file_magic Type, const LLVMContext *Context)
Definition SymbolicFile.cpp:99
#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.
LLVM_ABI file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
LLVM_ABI 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.
@ dxcontainer_object
DirectX container file.
@ 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.