[PATCH] D15006: Driver: Better detection of mingw-gcc
Martell Malone via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 25 21:28:42 PST 2015
martell updated the summary for this revision.
martell updated this revision to Diff 41208.
martell added a comment.
Removed the break that I didn't think was needed
Can be re-added ??
Will added testcases
http://reviews.llvm.org/D15006
Files:
lib/Driver/MinGWToolChain.cpp
Index: lib/Driver/MinGWToolChain.cpp
===================================================================
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -66,15 +66,20 @@
: ToolChain(D, Triple, Args) {
getProgramPaths().push_back(getDriver().getInstalledDir());
- // On Windows if there is no sysroot we search for gcc on the PATH.
+ llvm::SmallVector<llvm::SmallString<32>, 2> Gccs;
+ Gccs.emplace_back(getTriple().getArchName());
+ Gccs[0] += "-w64-mingw32-gcc";
+ Gccs.emplace_back("mingw32-gcc");
+
+ for (StringRef CandidateGcc : Gccs)
+ if (llvm::ErrorOr<std::string> GPPName =
+ llvm::sys::findProgramByName(CandidateGcc))
+ Base = llvm::sys::path::parent_path(
+ llvm::sys::path::parent_path(GPPName.get()));
+
if (getDriver().SysRoot.size())
- Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
- else if (llvm::ErrorOr<std::string> GPPName =
- llvm::sys::findProgramByName("gcc"))
- Base = llvm::sys::path::parent_path(
- llvm::sys::path::parent_path(GPPName.get()));
-#endif
+ Base = getDriver().SysRoot;
+
if (!Base.size())
Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15006.41208.patch
Type: text/x-patch
Size: 1208 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151126/7e60596c/attachment.bin>
More information about the cfe-commits
mailing list