summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-08-26 22:00:09 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-08-26 22:00:09 +0000
commite2c1d77fb41fd580d11c56cb1082eb505cfa1f18 (patch)
tree7bddf1234caf42b4bc4499106253242978683e38 /llvm/unittests/ExecutionEngine/JIT/JITTest.cpp
parent0056256b5595e8d8d3af2c927749092825454faf (diff)
downloadbcm5719-llvm-e2c1d77fb41fd580d11c56cb1082eb505cfa1f18.tar.gz
bcm5719-llvm-e2c1d77fb41fd580d11c56cb1082eb505cfa1f18.zip
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. llvm-svn: 216492
Diffstat (limited to 'llvm/unittests/ExecutionEngine/JIT/JITTest.cpp')
-rw-r--r--llvm/unittests/ExecutionEngine/JIT/JITTest.cpp5
1 files changed, 2 insertions, 3 deletions
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<MemoryBuffer> BitcodeBuffer(
+ MemoryBuffer::getMemBuffer(Bitcode, "Bitcode for test"));
ErrorOr<Module*> ModuleOrErr = getLazyBitcodeModule(BitcodeBuffer, Context);
if (std::error_code EC = ModuleOrErr.getError()) {
ADD_FAILURE() << EC.message();
- delete BitcodeBuffer;
return nullptr;
}
std::unique_ptr<Module> Owner(ModuleOrErr.get());
OpenPOWER on IntegriCloud