diff options
Diffstat (limited to 'include/llvm/Object/Binary.h')
-rw-r--r-- | include/llvm/Object/Binary.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/llvm/Object/Binary.h b/include/llvm/Object/Binary.h index 8ac84e7..9be2fbe 100644 --- a/include/llvm/Object/Binary.h +++ b/include/llvm/Object/Binary.h @@ -32,12 +32,11 @@ private: Binary(const Binary &other) LLVM_DELETED_FUNCTION; unsigned int TypeID; - bool BufferOwned; protected: - MemoryBuffer *Data; + std::unique_ptr<MemoryBuffer> Data; - Binary(unsigned int Type, MemoryBuffer *Source, bool BufferOwned = true); + Binary(unsigned int Type, std::unique_ptr<MemoryBuffer> Source); enum { ID_Archive, @@ -79,6 +78,7 @@ public: virtual ~Binary(); StringRef getData() const; + MemoryBuffer *releaseBuffer() { return Data.release(); } StringRef getFileName() const; // Cast methods. @@ -128,7 +128,7 @@ public: /// @param Source The data to create the Binary from. Ownership is transferred /// to the Binary if successful. If an error is returned, /// Source is destroyed by createBinary before returning. -ErrorOr<Binary *> createBinary(MemoryBuffer *Source, +ErrorOr<Binary *> createBinary(std::unique_ptr<MemoryBuffer> &Source, LLVMContext *Context = nullptr); ErrorOr<Binary *> createBinary(StringRef Path); |