mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
Make ObjectFile ownership of the MemoryBuffer optional.
This allows llvm-ar to mmap the input files only once. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200040 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -270,7 +270,7 @@ class ObjectFile : public Binary {
|
||||
ObjectFile(const ObjectFile &other) LLVM_DELETED_FUNCTION;
|
||||
|
||||
protected:
|
||||
ObjectFile(unsigned int Type, MemoryBuffer *source);
|
||||
ObjectFile(unsigned int Type, MemoryBuffer *Source, bool BufferOwned = true);
|
||||
|
||||
const uint8_t *base() const {
|
||||
return reinterpret_cast<const uint8_t *>(Data->getBufferStart());
|
||||
@ -379,7 +379,7 @@ public:
|
||||
/// @brief Create ObjectFile from path.
|
||||
static ErrorOr<ObjectFile *> createObjectFile(StringRef ObjectPath);
|
||||
static ErrorOr<ObjectFile *>
|
||||
createObjectFile(MemoryBuffer *Object,
|
||||
createObjectFile(MemoryBuffer *Object, bool BufferOwned = true,
|
||||
sys::fs::file_magic Type = sys::fs::file_magic::unknown);
|
||||
|
||||
static inline bool classof(const Binary *v) {
|
||||
@ -387,9 +387,12 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
static ErrorOr<ObjectFile *> createCOFFObjectFile(MemoryBuffer *Object);
|
||||
static ErrorOr<ObjectFile *> createELFObjectFile(MemoryBuffer *Object);
|
||||
static ErrorOr<ObjectFile *> createMachOObjectFile(MemoryBuffer *Object);
|
||||
static ErrorOr<ObjectFile *> createCOFFObjectFile(MemoryBuffer *Object,
|
||||
bool BufferOwned = true);
|
||||
static ErrorOr<ObjectFile *> createELFObjectFile(MemoryBuffer *Object,
|
||||
bool BufferOwned = true);
|
||||
static ErrorOr<ObjectFile *> createMachOObjectFile(MemoryBuffer *Object,
|
||||
bool BufferOwned = true);
|
||||
};
|
||||
|
||||
// Inline function definitions.
|
||||
|
Reference in New Issue
Block a user