X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=tools%2Fllvmc%2FCompilerDriver.cpp;h=1a316c84390bbb471b9f35ede6495096a50257f1;hb=c30088f9612c949b047884deab045e2421690691;hp=f0f686886b806d5130c856d3eb0295cb7836e027;hpb=f6358c75eb393ae579aace88a1152f39b2a924f4;p=oota-llvm.git diff --git a/tools/llvmc/CompilerDriver.cpp b/tools/llvmc/CompilerDriver.cpp index f0f686886b8..1a316c84390 100644 --- a/tools/llvmc/CompilerDriver.cpp +++ b/tools/llvmc/CompilerDriver.cpp @@ -21,6 +21,7 @@ #include "llvm/ADT/SetVector.h" #include "llvm/ADT/StringExtras.h" #include +#include "llvm/Config/alloca.h" using namespace llvm; @@ -393,22 +394,21 @@ 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()+2)); + Args[0] = action->program.toString().c_str(); + for (unsigned i = 1; 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; }