From 2e60ca964ccb6a8531559238b28658e1aa4b0d75 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 24 Jun 2014 13:56:32 +0000 Subject: Pass a unique_ptr to the constructors in the Binary hierarchy. Once the objects are constructed, they own the buffer. Passing a unique_ptr makes that clear. llvm-svn: 211595 --- llvm/lib/Object/ObjectFile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Object/ObjectFile.cpp') diff --git a/llvm/lib/Object/ObjectFile.cpp b/llvm/lib/Object/ObjectFile.cpp index ee2680e6ba0..591ed28262e 100644 --- a/llvm/lib/Object/ObjectFile.cpp +++ b/llvm/lib/Object/ObjectFile.cpp @@ -23,8 +23,8 @@ using namespace object; void ObjectFile::anchor() { } -ObjectFile::ObjectFile(unsigned int Type, MemoryBuffer *Source) - : SymbolicFile(Type, Source) {} +ObjectFile::ObjectFile(unsigned int Type, std::unique_ptr Source) + : SymbolicFile(Type, std::move(Source)) {} std::error_code ObjectFile::printSymbolName(raw_ostream &OS, DataRefImpl Symb) const { @@ -77,7 +77,7 @@ ObjectFile::createObjectFile(std::unique_ptr &Object, case sys::fs::file_magic::coff_object: case sys::fs::file_magic::coff_import_library: case sys::fs::file_magic::pecoff_executable: - return createCOFFObjectFile(Object.release()); + return createCOFFObjectFile(std::move(Object)); } llvm_unreachable("Unexpected Object File Type"); } -- cgit v1.2.3