14 #ifndef LLVM_OBJECT_BINARY_H 15 #define LLVM_OBJECT_BINARY_H 68 static inline unsigned int getELFType(
bool isLE,
bool is64Bits) {
92 unsigned int getType()
const {
return TypeID; }
128 return TypeID ==
ID_IR;
149 const uint64_t
Size) {
150 if (Addr + Size < Addr || Addr + Size < Size ||
155 return std::error_code();
166 std::unique_ptr<T> Bin;
167 std::unique_ptr<MemoryBuffer> Buf;
171 OwningBinary(std::unique_ptr<T> Bin, std::unique_ptr<MemoryBuffer> Buf);
175 std::pair<std::unique_ptr<T>, std::unique_ptr<MemoryBuffer>> takeBinary();
178 const T* getBinary()
const;
181 template <
typename T>
183 std::unique_ptr<MemoryBuffer> Buf)
184 : Bin(
std::move(Bin)), Buf(
std::move(Buf)) {}
188 template <
typename T>
192 template <
typename T>
194 Bin = std::move(
Other.Bin);
195 Buf = std::move(
Other.Buf);
199 template <
typename T>
200 std::pair<std::unique_ptr<T>, std::unique_ptr<MemoryBuffer>>
202 return std::make_pair(std::move(Bin), std::move(Buf));
219 #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)
Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr)
Create a Binary from Source, autodetecting the file type.
bool isCOFFImportFile() const
Tagged union holding either a T or a Error.
MemoryBufferRef getMemoryBufferRef() const
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