llvmc: Fix tool finding logic.

llvm-svn: 118056
This commit is contained in:
Mikhail Glushenkov 2010-11-02 20:47:41 +00:00
parent 9f20daf3b4
commit 0ddd57451e
1 changed files with 8 additions and 8 deletions

View File

@ -53,18 +53,18 @@ namespace {
#endif
}
int ExecuteProgram (const std::string& name,
const StrVector& args) {
int ExecuteProgram (const std::string& name, const StrVector& args) {
sys::Path prog(name);
if (!prog.isAbsolute())
if (!prog.isAbsolute()) {
prog = FindExecutable(name, ProgramName, (void *)(intptr_t)&Main);
if (prog.isEmpty()) {
prog = sys::Program::FindProgramByName(name);
if (prog.isEmpty()) {
PrintError("Can't find program '" + name + "'");
return -1;
if (!prog.canExecute()) {
prog = sys::Program::FindProgramByName(name);
if (prog.isEmpty()) {
PrintError("Can't find program '" + name + "'");
return -1;
}
}
}
if (!prog.canExecute()) {