Pass a std::unique_ptr<MemoryBuffer>& to getLazyBitcodeModule.

By taking a reference we can do the ownership transfer in one place instead of
expecting every caller to do it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216492 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-08-26 22:00:09 +00:00
parent 2292996e1a
commit fb1af0a48a
8 changed files with 22 additions and 22 deletions

View File

@@ -51,8 +51,11 @@ LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
LLVMModuleRef *OutM,
char **OutMessage) {
std::string Message;
std::unique_ptr<MemoryBuffer> Owner(unwrap(MemBuf));
ErrorOr<Module *> ModuleOrErr =
getLazyBitcodeModule(unwrap(MemBuf), *unwrap(ContextRef));
getLazyBitcodeModule(Owner, *unwrap(ContextRef));
Owner.release();
if (std::error_code EC = ModuleOrErr.getError()) {
*OutM = wrap((Module *)nullptr);