aboutsummaryrefslogtreecommitdiff
path: root/tools/llvmc/CompilerDriver.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-13 23:10:45 +0000
committerChris Lattner <sabre@nondot.org>2005-02-13 23:10:45 +0000
commit7456e3ce3874ed99807a1394011c4b0c6e2ecaa0 (patch)
tree7377143158b818527bc7bc080e6121ba5f56eb48 /tools/llvmc/CompilerDriver.cpp
parented5fa58a07d0383c239ab98d532f8f6047fbb215 (diff)
Conform to the documented interface by null terminating argument lists!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20167 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc/CompilerDriver.cpp')
-rw-r--r--tools/llvmc/CompilerDriver.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/llvmc/CompilerDriver.cpp b/tools/llvmc/CompilerDriver.cpp
index 6846fbc62e..6d609c52aa 100644
--- a/tools/llvmc/CompilerDriver.cpp
+++ b/tools/llvmc/CompilerDriver.cpp
@@ -394,22 +394,20 @@ private:
// Invoke the program
const char** Args = (const char**)
- alloca(sizeof(const char*)*action->args.size());
- for (unsigned i = 0; i != action->args.size(); ++i) {
+ alloca(sizeof(const char*)*(action->args.size()+1));
+ for (unsigned i = 0; i != action->args.size(); ++i)
Args[i] = action->args[i].c_str();
- }
+ Args[action->args.size()] = 0; // null terminate list.
if (isSet(TIME_ACTIONS_FLAG)) {
Timer timer(action->program.toString());
timer.startTimer();
- int resultCode =
- sys::Program::ExecuteAndWait(action->program,Args);
+ int resultCode = sys::Program::ExecuteAndWait(action->program, Args);
timer.stopTimer();
timer.print(timer,std::cerr);
return resultCode == 0;
}
else
- return 0 ==
- sys::Program::ExecuteAndWait(action->program, Args);
+ return 0 == sys::Program::ExecuteAndWait(action->program, Args);
}
return true;
}