llvm.org GIT mirror llvm / ed5d32e
Approved by Chris: $ svn merge -c 113123 https://llvm.org/svn/llvm-project/llvm/trunk --- Merging r113123 into '.': U examples/Fibonacci/fibonacci.cpp fit in 80 columns and don't crash on exit, fixes PR8080 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_28@113150 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 8 years ago
1 changed file(s) with 10 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
9595 LLVMContext Context;
9696
9797 // Create some module to put our function into it.
98 Module *M = new Module("test", Context);
98 OwningPtr M(new Module("test", Context));
9999
100100 // We are about to create the "fib" function:
101 Function *FibF = CreateFibFunction(M, Context);
101 Function *FibF = CreateFibFunction(M.get(), Context);
102102
103103 // Now we going to create JIT
104104 std::string errStr;
105 ExecutionEngine *EE = EngineBuilder(M).setErrorStr(&errStr).setEngineKind(EngineKind::JIT).create();
105 ExecutionEngine *EE =
106 EngineBuilder(M.get())
107 .setErrorStr(&errStr)
108 .setEngineKind(EngineKind::JIT)
109 .create();
106110
107111 if (!EE) {
108 errs() << argv[0] << ": Failed to construct ExecutionEngine: " << errStr << "\n";
112 errs() << argv[0] << ": Failed to construct ExecutionEngine: " << errStr
113 << "\n";
109114 return 1;
110115 }
111116
126131
127132 // import result of execution
128133 outs() << "Result: " << GV.IntVal << "\n";
134
129135 return 0;
130136 }