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
This commit is contained in:
Bill Wendling 2010-09-06 09:08:13 +00:00
parent 390f711778
commit ed5d32e948

View File

@ -96,17 +96,22 @@ int main(int argc, char **argv) {
LLVMContext Context; LLVMContext Context;
// Create some module to put our function into it. // 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: // 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 // Now we going to create JIT
std::string errStr; 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) { if (!EE) {
errs() << argv[0] << ": Failed to construct ExecutionEngine: " << errStr << "\n"; errs() << argv[0] << ": Failed to construct ExecutionEngine: " << errStr
<< "\n";
return 1; return 1;
} }
@ -127,5 +132,6 @@ int main(int argc, char **argv) {
// import result of execution // import result of execution
outs() << "Result: " << GV.IntVal << "\n"; outs() << "Result: " << GV.IntVal << "\n";
return 0; return 0;
} }