13 #ifndef LLVM_OBJECT_BINARY_H 14 #define LLVM_OBJECT_BINARY_H 75 static inline unsigned int getELFType(
bool isLE,
bool is64Bits) {
99 unsigned int getType()
const {
return TypeID; }
139 return TypeID ==
ID_IR;
164 const uint64_t
Size) {
165 if (Addr + Size < Addr || Addr + Size < Size ||
170 return std::error_code();
184 std::unique_ptr<T> Bin;
185 std::unique_ptr<MemoryBuffer> Buf;
189 OwningBinary(std::unique_ptr<T> Bin, std::unique_ptr<MemoryBuffer> Buf);
193 std::pair<std::unique_ptr<T>, std::unique_ptr<MemoryBuffer>> takeBinary();
196 const T* getBinary()
const;
199 template <
typename T>
201 std::unique_ptr<MemoryBuffer> Buf)
202 : Bin(
std::move(Bin)), Buf(
std::move(Buf)) {}
206 template <
typename T>
210 template <
typename T>
212 Bin = std::move(
Other.Bin);
213 Buf = std::move(
Other.Buf);
217 template <
typename T>
218 std::pair<std::unique_ptr<T>, std::unique_ptr<MemoryBuffer>>
220 return std::make_pair(std::move(Bin), std::move(Buf));
237 #endif // LLVM_OBJECT_BINARY_H
static unsigned int getMachOType(bool isLE, bool is64Bits)
This class represents lattice values for constants.
const char * getBufferEnd() const
StringRef getFileName() const
static std::error_code checkOffset(MemoryBufferRef M, uintptr_t Addr, const uint64_t Size)
Optional< std::vector< StOtherPiece > > Other
Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr)
Create a Binary from Source, autodetecting the file type.
bool isTapiUniversal() const
bool isCOFFImportFile() const
Tagged union holding either a T or a Error.
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
MemoryBufferRef getMemoryBufferRef() const
struct LLVMOpaqueBinary * LLVMBinaryRef
The instances of the Type class are immutable: once they are created, they are never changed...
unsigned int getType() const
This is an important class for using LLVM in a threaded context.
Expected< OwningBinary< Binary > > createBinary(StringRef Path)
static unsigned int getELFType(bool isLE, bool is64Bits)
bool isLittleEndian() const
bool isMachOUniversalBinary() const
Triple::ObjectFormatType getTripleObjectFormat() const
const char * getBufferStart() const
StringRef - Represent a constant reference to a string, i.e.
StringRef getData() const