Pass a unique_ptr<MemoryBuffer> to the constructors in the Binary hierarchy.

Once the objects are constructed, they own the buffer. Passing a unique_ptr
makes that clear.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211595 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-06-24 13:56:32 +00:00
parent d3aaad2d26
commit 0d50598d71
21 changed files with 104 additions and 88 deletions

View File

@ -208,7 +208,7 @@ class ObjectFile : public SymbolicFile {
ObjectFile(const ObjectFile &other) LLVM_DELETED_FUNCTION;
protected:
ObjectFile(unsigned int Type, MemoryBuffer *Source);
ObjectFile(unsigned int Type, std::unique_ptr<MemoryBuffer> Source);
const uint8_t *base() const {
return reinterpret_cast<const uint8_t *>(Data->getBufferStart());
@ -347,7 +347,8 @@ public:
}
public:
static ErrorOr<ObjectFile *> createCOFFObjectFile(MemoryBuffer *Object);
static ErrorOr<ObjectFile *>
createCOFFObjectFile(std::unique_ptr<MemoryBuffer> Object);
static ErrorOr<ObjectFile *>
createELFObjectFile(std::unique_ptr<MemoryBuffer> &Object);
static ErrorOr<ObjectFile *>