diff options
author | Simon Atanasyan <satanasyan@mips.com> | 2012-10-31 12:01:53 +0000 |
---|---|---|
committer | Simon Atanasyan <satanasyan@mips.com> | 2012-10-31 12:01:53 +0000 |
commit | e01575447635fae1365fc94a8dbb82b31e86ab09 (patch) | |
tree | 89f9aca0f5293f65a6c9540b7f6fb11cc498f562 /lib/Driver/Driver.cpp | |
parent | 986af6fe3842dd08ce6d6e2a2e3dbec1d58cc15d (diff) |
Extend -Bprefix functionality and make it closer to gcc. If the "prefix"
is not a directory, Driver::GetProgramPath() routine does not try to append
the program name as a "path component" to it. It just joins the "prefix" with
the program name and checks the resulting path existence.
The patch reviewed by Rafael Espindola.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167114 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index eeb59e854d..d71e731f39 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1591,12 +1591,19 @@ std::string Driver::GetProgramPath(const char *Name, // attempting to use this prefix when looking for program paths. for (Driver::prefix_list::const_iterator it = PrefixDirs.begin(), ie = PrefixDirs.end(); it != ie; ++it) { - llvm::sys::Path P(*it); - P.appendComponent(TargetSpecificExecutable); - if (P.canExecute()) return P.str(); - P.eraseComponent(); - P.appendComponent(Name); - if (P.canExecute()) return P.str(); + bool IsDirectory; + if (!llvm::sys::fs::is_directory(*it, IsDirectory) && IsDirectory) { + llvm::sys::Path P(*it); + P.appendComponent(TargetSpecificExecutable); + if (P.canExecute()) return P.str(); + P.eraseComponent(); + P.appendComponent(Name); + if (P.canExecute()) return P.str(); + } + else { + llvm::sys::Path P(*it + Name); + if (P.canExecute()) return P.str(); + } } const ToolChain::path_list &List = TC.getProgramPaths(); |