summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvmc
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
commit9db0eccc4237e325fff4d159daa4b1000ff8b00c (patch)
tree1fc58620fafe7854cd35a96acc8a85d4583ad88c /llvm/tools/llvmc
parent61a31c9fe2d83e129c9f5884acd01bb534cb427c (diff)
downloadbcm5719-llvm-9db0eccc4237e325fff4d159daa4b1000ff8b00c.tar.gz
bcm5719-llvm-9db0eccc4237e325fff4d159daa4b1000ff8b00c.zip
Conform to the documented interface by null terminating argument lists!
llvm-svn: 20167
Diffstat (limited to 'llvm/tools/llvmc')
-rw-r--r--llvm/tools/llvmc/CompilerDriver.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/tools/llvmc/CompilerDriver.cpp b/llvm/tools/llvmc/CompilerDriver.cpp
index 6846fbc62e8..6d609c52aa6 100644
--- a/llvm/tools/llvmc/CompilerDriver.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud