Remove useless parameter "WantFile" from Driver::GetProgramPath().

This parameter is useless because nowhere used explicitly and always
gets its default value - "false".

The patch reviewed by Rafael Espindola.

llvm-svn: 165149
This commit is contained in:
Simon Atanasyan 2012-10-03 19:52:37 +00:00
parent ac92066b0c
commit b16488c9fb
4 changed files with 10 additions and 20 deletions

View File

@ -335,13 +335,9 @@ public:
///
/// \param TC - The provided tool chain for additional information on
/// directories to search.
///
/// \param WantFile - False when searching for an executable file, otherwise
/// true. Defaults to false.
//
// FIXME: This should be in CompilationInfo.
std::string GetProgramPath(const char *Name, const ToolChain &TC,
bool WantFile = false) const;
std::string GetProgramPath(const char *Name, const ToolChain &TC) const;
/// HandleImmediateArgs - Handle any arguments which should be
/// treated before building actions or binding tools.

View File

@ -115,7 +115,7 @@ public:
// Helper methods
std::string GetFilePath(const char *Name) const;
std::string GetProgramPath(const char *Name, bool WantFile = false) const;
std::string GetProgramPath(const char *Name) const;
// Platform defaults information

View File

@ -1620,14 +1620,8 @@ std::string Driver::GetFilePath(const char *Name, const ToolChain &TC) const {
return Name;
}
static bool isPathExecutable(llvm::sys::Path &P, bool WantFile) {
bool Exists;
return (WantFile ? !llvm::sys::fs::exists(P.str(), Exists) && Exists
: P.canExecute());
}
std::string Driver::GetProgramPath(const char *Name, const ToolChain &TC,
bool WantFile) const {
std::string Driver::GetProgramPath(const char *Name,
const ToolChain &TC) const {
// FIXME: Needs a better variable than DefaultTargetTriple
std::string TargetSpecificExecutable(DefaultTargetTriple + "-" + Name);
// Respect a limited subset of the '-Bprefix' functionality in GCC by
@ -1636,10 +1630,10 @@ std::string Driver::GetProgramPath(const char *Name, const ToolChain &TC,
ie = PrefixDirs.end(); it != ie; ++it) {
llvm::sys::Path P(*it);
P.appendComponent(TargetSpecificExecutable);
if (isPathExecutable(P, WantFile)) return P.str();
if (P.canExecute()) return P.str();
P.eraseComponent();
P.appendComponent(Name);
if (isPathExecutable(P, WantFile)) return P.str();
if (P.canExecute()) return P.str();
}
const ToolChain::path_list &List = TC.getProgramPaths();
@ -1647,10 +1641,10 @@ std::string Driver::GetProgramPath(const char *Name, const ToolChain &TC,
it = List.begin(), ie = List.end(); it != ie; ++it) {
llvm::sys::Path P(*it);
P.appendComponent(TargetSpecificExecutable);
if (isPathExecutable(P, WantFile)) return P.str();
if (P.canExecute()) return P.str();
P.eraseComponent();
P.appendComponent(Name);
if (isPathExecutable(P, WantFile)) return P.str();
if (P.canExecute()) return P.str();
}
// If all else failed, search the path.

View File

@ -41,8 +41,8 @@ std::string ToolChain::GetFilePath(const char *Name) const {
}
std::string ToolChain::GetProgramPath(const char *Name, bool WantFile) const {
return D.GetProgramPath(Name, *this, WantFile);
std::string ToolChain::GetProgramPath(const char *Name) const {
return D.GetProgramPath(Name, *this);
}
types::ID ToolChain::LookupTypeForExtension(const char *Ext) const {