Make it explicit that ExecutionEngine takes ownership of the modules.
[oota-llvm.git] / examples / Fibonacci / fibonacci.cpp
index ba8e95342fa538afd18625ea4a4426a193af6bf9..fd9b456494539cf3882506a845592658f07213d7 100644 (file)
@@ -96,15 +96,16 @@ int main(int argc, char **argv) {
   LLVMContext Context;
 
   // Create some module to put our function into it.
-  std::unique_ptr<Module> M(new Module("test", Context));
+  std::unique_ptr<Module> Owner(new Module("test", Context));
+  Module *M = Owner.get();
 
   // We are about to create the "fib" function:
-  Function *FibF = CreateFibFunction(M.get(), Context);
+  Function *FibF = CreateFibFunction(M, Context);
 
   // Now we going to create JIT
   std::string errStr;
   ExecutionEngine *EE =
-    EngineBuilder(M.get())
+    EngineBuilder(std::move(Owner))
     .setErrorStr(&errStr)
     .setEngineKind(EngineKind::JIT)
     .create();