[llvm-commits] [llvm] r112803 - /llvm/trunk/lib/Support/SystemUtils.cpp

Dan Gohman gohman at apple.com
Thu Sep 2 09:52:35 PDT 2010


On Sep 1, 2010, at 8:46 PM, NAKAMURA Takumi wrote:

> Author: chapuni
> Date: Wed Sep  1 22:46:04 2010
> New Revision: 112803
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=112803&view=rev
> Log:
> llvm::FindExecutable(): Retrieve the name with suffix.exe, if available.
> 
> bugpoint uses it.
> 
> Modified:
>    llvm/trunk/lib/Support/SystemUtils.cpp
> 
> Modified: llvm/trunk/lib/Support/SystemUtils.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SystemUtils.cpp?rev=112803&r1=112802&r2=112803&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Support/SystemUtils.cpp (original)
> +++ llvm/trunk/lib/Support/SystemUtils.cpp Wed Sep  1 22:46:04 2010
> @@ -49,6 +49,10 @@
>     Result.appendComponent(ExeName);
>     if (Result.canExecute())
>       return Result;
> +    // Expect to retrieve the pathname with suffix .exe.
> +    Result = sys::Program::FindProgramByName(Result.str());
> +    if (!Result.empty())
> +      return Result;
>   }


Hello,

This changes the semantics of llvm::FindExecutable, which didn't previously
look through PATH. I think searching PATH is subtle and dangerous here,
because it's not uncommon to have older versions of LLVM tools installed
somewhere, and it can be very confusing and frustrating to figure out
what's going on when the system is silently falling back to some older
program that it happened to be able to find.

Is it possible to explicitly add the suffix before the canExecute() test?

Dan





More information about the llvm-commits mailing list