summaryrefslogtreecommitdiff
path: root/examples/ExceptionDemo
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-08-19 04:04:25 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-08-19 04:04:25 +0000
commit3f4ed32b4398eaf4fe0080d8001ba01e6c2f43c8 (patch)
tree961679644a48b563e0febf6499460ea12c247b95 /examples/ExceptionDemo
parent4d48c3f2a498d169af596871cd23ce7b6e961d43 (diff)
Make it explicit that ExecutionEngine takes ownership of the modules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215967 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples/ExceptionDemo')
-rw-r--r--examples/ExceptionDemo/ExceptionDemo.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/ExceptionDemo/ExceptionDemo.cpp b/examples/ExceptionDemo/ExceptionDemo.cpp
index 24e538cacf2..21d290e4356 100644
--- a/examples/ExceptionDemo/ExceptionDemo.cpp
+++ b/examples/ExceptionDemo/ExceptionDemo.cpp
@@ -1957,12 +1957,14 @@ int main(int argc, char *argv[]) {
llvm::IRBuilder<> theBuilder(context);
// Make the module, which holds all the code.
- llvm::Module *module = new llvm::Module("my cool jit", context);
+ std::unique_ptr<llvm::Module> Owner =
+ llvm::make_unique<llvm::Module>("my cool jit", context);
+ llvm::Module *module = Owner.get();
llvm::RTDyldMemoryManager *MemMgr = new llvm::SectionMemoryManager();
// Build engine with JIT
- llvm::EngineBuilder factory(module);
+ llvm::EngineBuilder factory(std::move(Owner));
factory.setEngineKind(llvm::EngineKind::JIT);
factory.setAllocateGVsWithCode(false);
factory.setTargetOptions(Opts);