From: Simon Atanasyan Date: Wed, 3 Oct 2012 19:52:37 +0000 (+0000) Subject: Remove useless parameter "WantFile" from Driver::GetProgramPath(). X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b16488c9fbc5b1a846757c679de1761ff1486265;p=platform%2Fupstream%2Fllvm.git 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 --- diff --git a/clang/include/clang/Driver/Driver.h b/clang/include/clang/Driver/Driver.h index 0051365..f436e04 100644 --- a/clang/include/clang/Driver/Driver.h +++ b/clang/include/clang/Driver/Driver.h @@ -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. diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h index fbc0ac2..3295e72 100644 --- a/clang/include/clang/Driver/ToolChain.h +++ b/clang/include/clang/Driver/ToolChain.h @@ -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 diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 254c419..1897a63 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -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. diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 3d0dc62..6bcea58 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -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 {