From 0ddd57451ea9eeabd963645f8e9b199b6a702dd5 Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Tue, 2 Nov 2010 20:47:41 +0000 Subject: llvmc: Fix tool finding logic. llvm-svn: 118056 --- llvm/lib/CompilerDriver/Action.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'llvm/lib/CompilerDriver') diff --git a/llvm/lib/CompilerDriver/Action.cpp b/llvm/lib/CompilerDriver/Action.cpp index 3503bd39db2..54b55d0d42f 100644 --- a/llvm/lib/CompilerDriver/Action.cpp +++ b/llvm/lib/CompilerDriver/Action.cpp @@ -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()) { -- cgit v1.2.3