Check for (unlikely) errors from FindExecutable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-10-29 16:18:26 +00:00
parent 62a5ff573b
commit cc11df0ee6

View File

@ -143,11 +143,18 @@ bool BugDriver::runPasses(Module *Program,
InFile.os().clear_error();
return 1;
}
sys::Path tool = FindExecutable("opt", getToolName(), (void*)"opt");
if (tool.empty()) {
errs() << "Cannot find `opt' in executable directory!\n";
return 1;
}
// Ok, everything that could go wrong before running opt is done.
InFile.keep();
// setup the child process' arguments
SmallVector<const char*, 8> Args;
sys::Path tool = FindExecutable("opt", getToolName(), (void*)"opt");
std::string Opt = tool.str();
if (UseValgrind) {
Args.push_back("valgrind");