From a69e6701a4179dfa321c16a78853284a3fed51e6 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 24 Aug 2010 17:44:07 +0000 Subject: [PATCH] Apply "Win32's Hybrid path separator in argv[0] should be accepted to bugpoint", patch by NAKAMURA Takumi! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111929 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/OptimizerDriver.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index 6d37761bcde..8f5ab722f02 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -27,6 +27,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Support/FileUtilities.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/SystemUtils.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/System/Path.h" @@ -150,16 +151,8 @@ bool BugDriver::runPasses(Module *Program, // setup the child process' arguments SmallVector Args; - std::string Opt; - llvm::StringRef TN(ToolName); - if (TN.find('/') == llvm::StringRef::npos) { - Opt = "opt"; - } else { - std::pair P = TN.rsplit('/'); - Opt = P.first.str() + "/" + "opt"; - } - - sys::Path tool = sys::Program::FindProgramByName(Opt); + sys::Path tool = FindExecutable("opt", getToolName(), (void*)"opt"); + std::string Opt = tool.str(); if (UseValgrind) { Args.push_back("valgrind"); Args.push_back("--error-exitcode=1"); -- 2.34.1