]> granicus.if.org Git - clang/commitdiff
Move the body of GCCInstallationDetector ctor into an init() function
authorRoman Divacky <rdivacky@freebsd.org>
Fri, 6 Dec 2013 18:32:18 +0000 (18:32 +0000)
committerRoman Divacky <rdivacky@freebsd.org>
Fri, 6 Dec 2013 18:32:18 +0000 (18:32 +0000)
and call it from its only user. The linux toolchain. This saves quite
a lot of directory searching on other platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196590 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains.cpp
lib/Driver/ToolChains.h

index bfc2acabe40dc453eee0f22898676c71c9b4ad9f..aa8cc566297a58f1e0b389237f73be502f97debc 100644 (file)
@@ -1008,7 +1008,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.
@@ -1017,9 +1017,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 BiarchVariantTriple =
       TargetTriple.isArch32Bit() ? TargetTriple.get64BitArchVariant()
                                  : TargetTriple.get32BitArchVariant();
@@ -1556,7 +1556,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);
@@ -2353,6 +2353,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();
 
index 0368458b4090a43d4d6ee20f6ff9581cddaefb6a..7c4d59fe9ab74889434fd5261f2d353dc9705507 100644 (file)
@@ -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.