Pass a std::unique_ptr& to the create??? methods is lib/Object.
This makes the buffer ownership on error conditions very natural. The buffer
is only moved out of the argument if an object is constructed that now
owns the buffer.
llvm-svn: 211546
diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp
index 21c4c96..74fdfef 100644
--- a/llvm/tools/llvm-objdump/MachODump.cpp
+++ b/llvm/tools/llvm-objdump/MachODump.cpp
@@ -203,7 +203,7 @@
}
std::unique_ptr<MachOObjectFile> MachOOF(static_cast<MachOObjectFile *>(
- ObjectFile::createMachOObjectFile(Buff.release()).get()));
+ ObjectFile::createMachOObjectFile(Buff).get()));
DisassembleInputMachO2(Filename, MachOOF.get());
}
@@ -293,7 +293,7 @@
errs() << "llvm-objdump: " << Filename << ": " << ec.message() << '\n';
return;
}
- DbgObj = ObjectFile::createMachOObjectFile(Buf.release()).get();
+ DbgObj = ObjectFile::createMachOObjectFile(Buf).get();
}
// Setup the DIContext