diff options
author | Dan Gohman <gohman@apple.com> | 2010-10-29 16:18:26 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-10-29 16:18:26 +0000 |
commit | cc11df0ee6011b3f21fd97d68e1e87bb4ad20185 (patch) | |
tree | 7665a7caf09d9609d3c2a36887fdcffb459b4599 | |
parent | 62a5ff573b2d72d7a51c4aebd0def311ecbc746d (diff) | |
download | external_llvm-cc11df0ee6011b3f21fd97d68e1e87bb4ad20185.zip external_llvm-cc11df0ee6011b3f21fd97d68e1e87bb4ad20185.tar.gz external_llvm-cc11df0ee6011b3f21fd97d68e1e87bb4ad20185.tar.bz2 |
Check for (unlikely) errors from FindExecutable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117658 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/bugpoint/OptimizerDriver.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index 131bc99..178b1ff 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<const char*, 8> Args; - sys::Path tool = FindExecutable("opt", getToolName(), (void*)"opt"); std::string Opt = tool.str(); if (UseValgrind) { Args.push_back("valgrind"); |