r196590 - Move the body of GCCInstallationDetector ctor into an init() function
Roman Divacky
rdivacky at freebsd.org
Fri Dec 6 10:32:18 PST 2013
Author: rdivacky
Date: Fri Dec 6 12:32:18 2013
New Revision: 196590
URL: http://llvm.org/viewvc/llvm-project?rev=196590&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=196590&r1=196589&r2=196590&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Dec 6 12:32:18 2013
@@ -1008,7 +1008,7 @@ static StringRef getGCCToolchainDir(cons
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.
@@ -1017,9 +1017,9 @@ static StringRef getGCCToolchainDir(cons
/// 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 BiarchVariantTriple =
TargetTriple.isArch32Bit() ? TargetTriple.get64BitArchVariant()
: TargetTriple.get32BitArchVariant();
@@ -1556,7 +1556,7 @@ void Generic_GCC::GCCInstallationDetecto
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);
@@ -2353,6 +2353,7 @@ static StringRef getMultilibDir(const ll
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();
Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=196590&r1=196589&r2=196590&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Dec 6 12:32:18 2013
@@ -91,7 +91,8 @@ protected:
std::set<std::string> CandidateGCCInstallPaths;
public:
- GCCInstallationDetector(const Driver &D, const llvm::Triple &TargetTriple,
+ GCCInstallationDetector() : IsValid(false) {}
+ void init(const Driver &D, const llvm::Triple &TargetTriple,
const llvm::opt::ArgList &Args);
/// \brief Check whether we detected a valid GCC install.
More information about the cfe-commits
mailing list