From: Dan Gohman Date: Fri, 29 Oct 2010 16:18:26 +0000 (+0000) Subject: Check for (unlikely) errors from FindExecutable. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cc11df0ee6011b3f21fd97d68e1e87bb4ad20185;p=oota-llvm.git Check for (unlikely) errors from FindExecutable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117658 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index 131bc997b16..178b1ff3ed1 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -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 Args; - sys::Path tool = FindExecutable("opt", getToolName(), (void*)"opt"); std::string Opt = tool.str(); if (UseValgrind) { Args.push_back("valgrind");