From 2a8a2795ee8edb8120d10c3c2af397f429b13c57 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 19 Aug 2014 04:04:25 +0000 Subject: Make it explicit that ExecutionEngine takes ownership of the modules. llvm-svn: 215967 --- llvm/examples/ExceptionDemo/ExceptionDemo.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/examples/ExceptionDemo/ExceptionDemo.cpp') diff --git a/llvm/examples/ExceptionDemo/ExceptionDemo.cpp b/llvm/examples/ExceptionDemo/ExceptionDemo.cpp index 24e538c..21d290e 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 Owner = + llvm::make_unique("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); -- cgit v1.1