r253898 - Driver: fallback to the location of clang if no sysroot,
Martell Malone via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 23 10:59:48 PST 2015
Author: martell
Date: Mon Nov 23 12:59:48 2015
New Revision: 253898
URL: http://llvm.org/viewvc/llvm-project?rev=253898&view=rev
Log:
Driver: fallback to the location of clang if no sysroot,
hard coding /usr makes little sense for mingw-w64.
If we have portable toolchains having /usr breaks that.
If the clang we use is in /usr/bin or /usr/sbin etc this will
still detect as though it was hard coded to /usr
This makes the most sense going forward for mingw-w64 toolchains
on both linux and mac
Differential Revision: http://reviews.llvm.org/D14164
Modified:
cfe/trunk/lib/Driver/MinGWToolChain.cpp
Modified: cfe/trunk/lib/Driver/MinGWToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MinGWToolChain.cpp?rev=253898&r1=253897&r2=253898&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/MinGWToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MinGWToolChain.cpp Mon Nov 23 12:59:48 2015
@@ -66,24 +66,20 @@ MinGW::MinGW(const Driver &D, const llvm
: ToolChain(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.
+// On Windows if there is no sysroot we search for gcc on the PATH.
+
+if (getDriver().SysRoot.size())
+ Base = getDriver().SysRoot;
#ifdef LLVM_ON_WIN32
- if (getDriver().SysRoot.size())
- Base = getDriver().SysRoot;
- else if (llvm::ErrorOr<std::string> GPPName =
- llvm::sys::findProgramByName("gcc"))
- 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";
+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
+if (!Base.size())
+ Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
+
Base += llvm::sys::path::get_separator();
findGccLibDir();
// GccLibDir must precede Base/lib so that the
More information about the cfe-commits
mailing list