From e2c1d77fb41fd580d11c56cb1082eb505cfa1f18 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 26 Aug 2014 22:00:09 +0000 Subject: Pass a std::unique_ptr& to getLazyBitcodeModule. By taking a reference we can do the ownership transfer in one place instead of expecting every caller to do it. llvm-svn: 216492 --- llvm/unittests/ExecutionEngine/JIT/JITTest.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'llvm/unittests/ExecutionEngine') diff --git a/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp b/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp index 4ba54b1d486..55b86125776 100644 --- a/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp +++ b/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp @@ -632,12 +632,11 @@ std::string AssembleToBitcode(LLVMContext &Context, const char *Assembly) { ExecutionEngine *getJITFromBitcode( LLVMContext &Context, const std::string &Bitcode, Module *&M) { // c_str() is null-terminated like MemoryBuffer::getMemBuffer requires. - MemoryBuffer *BitcodeBuffer = - MemoryBuffer::getMemBuffer(Bitcode, "Bitcode for test"); + std::unique_ptr BitcodeBuffer( + MemoryBuffer::getMemBuffer(Bitcode, "Bitcode for test")); ErrorOr ModuleOrErr = getLazyBitcodeModule(BitcodeBuffer, Context); if (std::error_code EC = ModuleOrErr.getError()) { ADD_FAILURE() << EC.message(); - delete BitcodeBuffer; return nullptr; } std::unique_ptr Owner(ModuleOrErr.get()); -- cgit v1.2.3