diff options
author | dim <dim@FreeBSD.org> | 2013-12-07 00:05:45 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-07 00:05:45 +0000 |
commit | 553f713863e06db13e30699129b501901c7ad3de (patch) | |
tree | a133d66da6bd34688eb33bb2c2f85f020b60fb3c /contrib/llvm | |
parent | 375701af535b3f5ba45cbb8a432ef0a6cab17b4b (diff) | |
download | FreeBSD-src-553f713863e06db13e30699129b501901c7ad3de.zip FreeBSD-src-553f713863e06db13e30699129b501901c7ad3de.tar.gz |
Pull in r196590 from upstream clang trunk (by rdivacky):
Move the body of GCCInstallationDetector ctor into an init() function
and call it from its only user. The linux toolchain. This saves quite
a lot of directory searching on other platforms.
See http://docs.freebsd.org/cgi/mid.cgi?51E6FAF5.3080802 for the
original discussion. With this fix, the search for gcc installations is
completely eliminated on FreeBSD.
Reported by: Kurt Lidl <lidl@pix.net>
MFC after: 3 days
Diffstat (limited to 'contrib/llvm')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp | 13 | ||||
-rw-r--r-- | contrib/llvm/tools/clang/lib/Driver/ToolChains.h | 3 |
2 files changed, 8 insertions, 8 deletions
diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp b/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp index d8d580b..dbb69ac 100644 --- a/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp +++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp @@ -991,7 +991,7 @@ static StringRef getGCCToolchainDir(const ArgList &Args) { return GCC_INSTALL_PREFIX; } -/// \brief Construct a GCCInstallationDetector from the driver. +/// \brief Initialize a GCCInstallationDetector from the driver. /// /// This performs all of the autodetection and sets up the various paths. /// Once constructed, a GCCInstallationDetector is essentially immutable. @@ -1000,11 +1000,9 @@ static StringRef getGCCToolchainDir(const ArgList &Args) { /// should instead pull the target out of the driver. This is currently /// necessary because the driver doesn't store the final version of the target /// triple. -Generic_GCC::GCCInstallationDetector::GCCInstallationDetector( - const Driver &D, - const llvm::Triple &TargetTriple, - const ArgList &Args) - : IsValid(false) { +void +Generic_GCC::GCCInstallationDetector::init( + const Driver &D, const llvm::Triple &TargetTriple, const ArgList &Args) { llvm::Triple MultiarchTriple = TargetTriple.isArch32Bit() ? TargetTriple.get64BitArchVariant() : TargetTriple.get32BitArchVariant(); @@ -1448,7 +1446,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( Generic_GCC::Generic_GCC(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) - : ToolChain(D, Triple, Args), GCCInstallation(getDriver(), Triple, Args) { + : ToolChain(D, Triple, Args), GCCInstallation() { getProgramPaths().push_back(getDriver().getInstalledDir()); if (getDriver().getInstalledDir() != getDriver().Dir) getProgramPaths().push_back(getDriver().Dir); @@ -2243,6 +2241,7 @@ static StringRef getMultilibDir(const llvm::Triple &Triple, Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : Generic_ELF(D, Triple, Args) { + GCCInstallation.init(D, Triple, Args); llvm::Triple::ArchType Arch = Triple.getArch(); std::string SysRoot = computeSysRoot(Args); diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChains.h b/contrib/llvm/tools/clang/lib/Driver/ToolChains.h index 2b140c1..50145e7 100644 --- a/contrib/llvm/tools/clang/lib/Driver/ToolChains.h +++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains.h @@ -78,7 +78,8 @@ protected: GCCVersion Version; public: - GCCInstallationDetector(const Driver &D, const llvm::Triple &TargetTriple, + GCCInstallationDetector() : IsValid(false) {} + void init(const Driver &D, const llvm::Triple &TargetTriple, const ArgList &Args); /// \brief Check whether we detected a valid GCC install. |