[cfe-commits] r67806 - in /cfe/trunk: include/clang/Driver/Driver.h include/clang/Driver/ToolChain.h lib/Driver/Driver.cpp lib/Driver/ToolChain.cpp
Mike Stump
mrs at apple.com
Thu Mar 26 17:40:20 PDT 2009
Author: mrs
Date: Thu Mar 26 19:40:20 2009
New Revision: 67806
URL: http://llvm.org/viewvc/llvm-project?rev=67806&view=rev
Log:
Fix searching for gcc, we only want executable files.
Modified:
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=67806&r1=67805&r2=67806&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Thu Mar 26 19:40:20 2009
@@ -178,8 +178,12 @@
///
/// \arg TC - The provided tool chain for additional information on
/// directories to search.
+ ///
+ /// \arg WantFile - False when searching for an executable file, otherwise
+ /// true. Defaults to false.
// FIXME: This should be in CompilationInfo.
- llvm::sys::Path GetProgramPath(const char *Name, const ToolChain &TC) const;
+ llvm::sys::Path GetProgramPath(const char *Name, const ToolChain &TC,
+ bool WantFile = false) const;
/// HandleImmediateArgs - Handle any arguments which should be
/// treated before building actions or binding tools.
Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=67806&r1=67805&r2=67806&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Thu Mar 26 19:40:20 2009
@@ -72,7 +72,8 @@
// Helper methods
llvm::sys::Path GetFilePath(const Compilation &C, const char *Name) const;
- llvm::sys::Path GetProgramPath(const Compilation &C, const char *Name) const;
+ llvm::sys::Path GetProgramPath(const Compilation &C, const char *Name,
+ bool WantFile = false) const;
// Platform defaults information
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=67806&r1=67805&r2=67806&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Mar 26 19:40:20 2009
@@ -294,7 +294,7 @@
}
if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
- llvm::outs() << GetProgramPath("libgcc.a", TC).toString() << "\n";
+ llvm::outs() << GetProgramPath("libgcc.a", TC, true).toString() << "\n";
return false;
}
@@ -925,13 +925,14 @@
}
llvm::sys::Path Driver::GetProgramPath(const char *Name,
- const ToolChain &TC) const {
+ const ToolChain &TC,
+ bool WantFile) const {
const ToolChain::path_list &List = TC.getProgramPaths();
for (ToolChain::path_list::const_iterator
it = List.begin(), ie = List.end(); it != ie; ++it) {
llvm::sys::Path P(*it);
P.appendComponent(Name);
- if (P.exists())
+ if (WantFile ? P.exists() : P.canExecute())
return P;
}
Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=67806&r1=67805&r2=67806&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Thu Mar 26 19:40:20 2009
@@ -30,6 +30,7 @@
}
llvm::sys::Path ToolChain::GetProgramPath(const Compilation &C,
- const char *Name) const {
- return Host.getDriver().GetProgramPath(Name, *this);
+ const char *Name,
+ bool WantFile) const {
+ return Host.getDriver().GetProgramPath(Name, *this, WantFile);
}
More information about the cfe-commits
mailing list