diff options
-rw-r--r-- | llvm/lib/CompilerDriver/Action.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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()) { |