14 #ifndef LLVM_OBJECT_BINARY_H
15 #define LLVM_OBJECT_BINARY_H
67 static inline unsigned int getELFType(
bool isLE,
bool is64Bits) {
154 template <
typename T>
class OwningBinary {
155 std::unique_ptr<T> Bin;
156 std::unique_ptr<MemoryBuffer> Buf;
160 OwningBinary(std::unique_ptr<T> Bin, std::unique_ptr<MemoryBuffer> Buf);
162 OwningBinary<T> &
operator=(OwningBinary<T> &&Other);
164 std::pair<std::unique_ptr<T>, std::unique_ptr<MemoryBuffer>>
takeBinary();
170 template <
typename T>
172 std::unique_ptr<MemoryBuffer> Buf)
173 : Bin(std::move(Bin)), Buf(std::move(Buf)) {}
177 template <
typename T>
179 : Bin(std::move(
Other.Bin)), Buf(std::move(
Other.Buf)) {}
181 template <
typename T>
183 Bin = std::move(
Other.Bin);
184 Buf = std::move(
Other.Buf);
188 template <
typename T>
189 std::pair<std::unique_ptr<T>, std::unique_ptr<MemoryBuffer>>
191 return std::make_pair(std::move(Bin), std::move(Buf));
208 #endif // LLVM_OBJECT_BINARY_H
static unsigned int getMachOType(bool isLE, bool is64Bits)
Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr)
Create a Binary from Source, autodetecting the file type.
StringRef getData() const
Tagged union holding either a T or a Error.
MemoryBufferRef getMemoryBufferRef() const
bool isCOFFImportFile() const
unsigned int getType() const
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
static unsigned int getELFType(bool isLE, bool is64Bits)
StringRef getFileName() const
std::pair< std::unique_ptr< T >, std::unique_ptr< MemoryBuffer > > takeBinary()
Triple::ObjectFormatType getTripleObjectFormat() const
OwningBinary< T > & operator=(OwningBinary< T > &&Other)
bool isLittleEndian() const
StringRef - Represent a constant reference to a string, i.e.
bool isMachOUniversalBinary() const