summaryrefslogtreecommitdiff
path: root/tools/bugpoint
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-10-29 16:18:26 +0000
committerDan Gohman <gohman@apple.com>2010-10-29 16:18:26 +0000
commitcc11df0ee6011b3f21fd97d68e1e87bb4ad20185 (patch)
tree7665a7caf09d9609d3c2a36887fdcffb459b4599 /tools/bugpoint
parent62a5ff573b2d72d7a51c4aebd0def311ecbc746d (diff)
Check for (unlikely) errors from FindExecutable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint')
-rw-r--r--tools/bugpoint/OptimizerDriver.cpp9
1 files changed, 8 insertions, 1 deletions
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<const char*, 8> Args;
- sys::Path tool = FindExecutable("opt", getToolName(), (void*)"opt");
std::string Opt = tool.str();
if (UseValgrind) {
Args.push_back("valgrind");