summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-05 23:09:30 +0000
committerChris Lattner <sabre@nondot.org>2010-09-05 23:09:30 +0000
commit03d1063d3208378b2bf7c15f0ea0e90ff4defa87 (patch)
tree72f3f472b4d51fd1ab85648c1931f0b6182d9c74 /examples
parent979b0618192cd99058a7a21c04341c47801dd688 (diff)
fit in 80 columns and don't crash on exit, fixes PR8080
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113123 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r--examples/Fibonacci/fibonacci.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp
index 353e17380c..a7bbf8c726 100644
--- a/examples/Fibonacci/fibonacci.cpp
+++ b/examples/Fibonacci/fibonacci.cpp
@@ -96,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;
}
@@ -127,5 +132,6 @@ int main(int argc, char **argv) {
// import result of execution
outs() << "Result: " << GV.IntVal << "\n";
+
return 0;
}