docs: Tweak wording.
[oota-llvm.git] / examples / Fibonacci / fibonacci.cpp
index 077cdd0f5d6816aba26c3e3b5327fe5b64321004..a7bbf8c7268421f361aa4664e1f794e4e9f4dc71 100644 (file)
@@ -28,7 +28,6 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Constants.h"
 #include "llvm/Instructions.h"
-#include "llvm/ModuleProvider.h"
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/ExecutionEngine/JIT.h"
 #include "llvm/ExecutionEngine/Interpreter.h"
@@ -97,17 +96,22 @@ int main(int argc, char **argv) {
   LLVMContext Context;
   
   // Create some module to put our function into it.
-  Module *M = new Module("test", Context);
+  OwningPtr<Module> M(new Module("test", Context));
 
   // We are about to create the "fib" function:
-  Function *FibF = CreateFibFunction(M, Context);
+  Function *FibF = CreateFibFunction(M.get(), Context);
 
   // Now we going to create JIT
   std::string errStr;
-  ExecutionEngine *EE = EngineBuilder(M).setErrorStr(&errStr).setEngineKind(EngineKind::JIT).create();
+  ExecutionEngine *EE =
+    EngineBuilder(M.get())
+    .setErrorStr(&errStr)
+    .setEngineKind(EngineKind::JIT)
+    .create();
 
   if (!EE) {
-    errs() << argv[0] << ": Failed to construct ExecutionEngine: " << errStr << "\n";
+    errs() << argv[0] << ": Failed to construct ExecutionEngine: " << errStr
+           << "\n";
     return 1;
   }
 
@@ -128,5 +132,6 @@ int main(int argc, char **argv) {
 
   // import result of execution
   outs() << "Result: " << GV.IntVal << "\n";
+  
   return 0;
 }