From cc11df0ee6011b3f21fd97d68e1e87bb4ad20185 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 29 Oct 2010 16:18:26 +0000 Subject: Check for (unlikely) errors from FindExecutable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117658 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/OptimizerDriver.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tools') 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 Args; - sys::Path tool = FindExecutable("opt", getToolName(), (void*)"opt"); std::string Opt = tool.str(); if (UseValgrind) { Args.push_back("valgrind"); -- cgit v1.1