llvmc: Fix tool finding logic.
authorMikhail Glushenkov <foldr@codedgers.com>
Tue, 2 Nov 2010 20:47:41 +0000 (20:47 +0000)
committerMikhail Glushenkov <foldr@codedgers.com>
Tue, 2 Nov 2010 20:47:41 +0000 (20:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118056 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CompilerDriver/Action.cpp

index 3503bd39db2714a6b8b6d39be5d15f6c353681e0..54b55d0d42f45765decbe839a0ff28ddae14ba5f 100644 (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()) {