r300555 - Driver: Better detection of mingw-gcc

Martell Malone via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 18 07:56:53 PDT 2017


Yes I do :)
I updated https://reviews.llvm.org/D15005 with a comment incase anyone goes
there.
I also updated https://reviews.llvm.org/D15006 (the correct link) to point
to the commit revision.

Thanks for pointing that out Alex

On Tue, Apr 18, 2017 at 3:49 PM, Alex L <arphaman at gmail.com> wrote:

> I think you've got the wrong Phabricator link in the commit log.
>
> On 18 April 2017 at 15:27, Martell Malone via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: martell
>> Date: Tue Apr 18 09:27:36 2017
>> New Revision: 300555
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=300555&view=rev
>> Log:
>> Driver: Better detection of mingw-gcc
>>
>> Stop blindly searching for "gcc.exe" on windows.
>> Stop assuming "/usr" on unix, fixes cross compiling.
>>
>> Reviewers: mati865, yaron.keren
>>
>> Subscribers: ismail, rnk
>>
>> Differential revision: https://reviews.llvm.org/D15005
>>
>> Modified:
>>     cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>>     cfe/trunk/lib/Driver/ToolChains/MinGW.h
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>> lChains/MinGW.cpp?rev=300555&r1=300554&r2=300555&view=diff
>> ============================================================
>> ==================
>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Apr 18 09:27:36 2017
>> @@ -285,28 +285,30 @@ void toolchains::MinGW::findGccLibDir()
>>    }
>>  }
>>
>> +llvm::ErrorOr<std::string> toolchains::MinGW::findGcc() {
>> +  llvm::SmallVector<llvm::SmallString<32>, 2> Gccs;
>> +  Gccs.emplace_back(getTriple().getArchName());
>> +  Gccs[0] += "-w64-mingw32-gcc";
>> +  Gccs.emplace_back("mingw32-gcc");
>> +  // Please do not add "gcc" here
>> +  for (StringRef CandidateGcc : Gccs)
>> +    if (llvm::ErrorOr<std::string> GPPName =
>> llvm::sys::findProgramByName(CandidateGcc))
>> +      return GPPName;
>> +  return make_error_code(std::errc::no_such_file_or_directory);
>> +}
>> +
>>  toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple,
>>                           const ArgList &Args)
>>      : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) {
>>    getProgramPaths().push_back(getDriver().getInstalledDir());
>>
>> -// In Windows there aren't any standard install locations, we search
>> -// for gcc on the PATH. In Linux the base is always /usr.
>> -#ifdef LLVM_ON_WIN32
>>    if (getDriver().SysRoot.size())
>>      Base = getDriver().SysRoot;
>> -  else if (llvm::ErrorOr<std::string> GPPName =
>> -               llvm::sys::findProgramByName("gcc"))
>> +  else if (llvm::ErrorOr<std::string> GPPName = findGcc())
>>      Base = llvm::sys::path::parent_path(
>>          llvm::sys::path::parent_path(GPPName.get()));
>>    else
>>      Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
>> -#else
>> -  if (getDriver().SysRoot.size())
>> -    Base = getDriver().SysRoot;
>> -  else
>> -    Base = "/usr";
>> -#endif
>>
>>    Base += llvm::sys::path::get_separator();
>>    findGccLibDir();
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>> lChains/MinGW.h?rev=300555&r1=300554&r2=300555&view=diff
>> ============================================================
>> ==================
>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original)
>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Tue Apr 18 09:27:36 2017
>> @@ -93,6 +93,7 @@ private:
>>    mutable std::unique_ptr<tools::gcc::Preprocessor> Preprocessor;
>>    mutable std::unique_ptr<tools::gcc::Compiler> Compiler;
>>    void findGccLibDir();
>> +  llvm::ErrorOr<std::string> findGcc();
>>  };
>>
>>  } // end namespace toolchains
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170418/5d5978ae/attachment.html>


More information about the cfe-commits mailing list