13#ifndef LLVM_OBJECT_BINARY_H
14#define LLVM_OBJECT_BINARY_H
78 static inline unsigned int getELFType(
bool isLE,
bool is64Bits) {
178 Addr +
Size >
reinterpret_cast<uintptr_t
>(M.getBufferEnd()) ||
179 Addr <
reinterpret_cast<uintptr_t
>(M.getBufferStart())) {
194 bool InitContent =
true);
197 std::unique_ptr<T> Bin;
198 std::unique_ptr<MemoryBuffer> Buf;
202 OwningBinary(std::unique_ptr<T> Bin, std::unique_ptr<MemoryBuffer> Buf);
206 std::pair<std::unique_ptr<T>, std::unique_ptr<MemoryBuffer>>
takeBinary();
214 std::unique_ptr<MemoryBuffer> Buf)
226 Buf = std::move(
Other.Buf);
231std::pair<std::unique_ptr<T>, std::unique_ptr<MemoryBuffer>>
233 return std::make_pair(std::move(
Bin), std::move(Buf));
246 bool InitContent =
true);
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a 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.
bool isTapiUniversal() const
bool isMachOUniversalBinary() const
static unsigned int getELFType(bool isLE, bool is64Bits)
Triple::ObjectFormatType getTripleObjectFormat() const
StringRef getData() const
bool isCOFFImportFile() const
unsigned int getType() const
bool isLittleEndian() const
virtual Error initContent()
bool isOffloadFile() const
static unsigned int getMachOType(bool isLE, bool is64Bits)
@ ID_MachOUniversalBinary
MemoryBufferRef getMemoryBufferRef() const
StringRef getFileName() const
Binary(const Binary &other)=delete
static Error checkOffset(MemoryBufferRef M, uintptr_t Addr, const uint64_t Size)
const T * getBinary() const
OwningBinary< T > & operator=(OwningBinary< T > &&Other)
std::pair< std::unique_ptr< T >, std::unique_ptr< MemoryBuffer > > takeBinary()
OwningBinary(std::unique_ptr< T > Bin, std::unique_ptr< MemoryBuffer > Buf)
OwningBinary(OwningBinary< T > &&Other)
struct LLVMOpaqueBinary * LLVMBinaryRef
Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr, bool InitContent=true)
Create a Binary from Source, autodetecting the file type.
This is an optimization pass for GlobalISel generic memory operations.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Implement std::hash so that hash_code can be used in STL containers.