summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit2a8a2795ee8edb8120d10c3c2af397f429b13c57 (patch)
treef77e8ceaf358640f215dc0207854cb9d00975e08 /llvm/examples/ExceptionDemo
parent687744d0114c46529def899ee6c67428cbdf3d92 (diff)
downloadbcm5719-llvm-2a8a2795ee8edb8120d10c3c2af397f429b13c57.tar.gz
bcm5719-llvm-2a8a2795ee8edb8120d10c3c2af397f429b13c57.zip
Make it explicit that ExecutionEngine takes ownership of the modules.
llvm-svn: 215967
Diffstat (limited to 'llvm/examples/ExceptionDemo')
-rw-r--r--llvm/examples/ExceptionDemo/ExceptionDemo.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/examples/ExceptionDemo/ExceptionDemo.cpp b/llvm/examples/ExceptionDemo/ExceptionDemo.cpp
index 24e538cacf2..21d290e4356 100644
--- a/llvm/examples/ExceptionDemo/ExceptionDemo.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud