]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/patches/patch-r259053-gcc-installation-detector.diff
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / patches / patch-r259053-gcc-installation-detector.diff
1 This patch eliminates the unnecessary search for various gcc installation
2 directories during each startup of clang.
3
4 Introduced here: http://svnweb.freebsd.org/changeset/base/259053
5
6 Index: tools/clang/lib/Driver/ToolChains.cpp
7 ===================================================================
8 --- tools/clang/lib/Driver/ToolChains.cpp
9 +++ tools/clang/lib/Driver/ToolChains.cpp
10 @@ -1014,7 +1014,7 @@ static StringRef getGCCToolchainDir(const ArgList
11    return GCC_INSTALL_PREFIX;
12  }
13  
14 -/// \brief Construct a GCCInstallationDetector from the driver.
15 +/// \brief Initialize a GCCInstallationDetector from the driver.
16  ///
17  /// This performs all of the autodetection and sets up the various paths.
18  /// Once constructed, a GCCInstallationDetector is essentially immutable.
19 @@ -1023,9 +1023,9 @@ static StringRef getGCCToolchainDir(const ArgList
20  /// should instead pull the target out of the driver. This is currently
21  /// necessary because the driver doesn't store the final version of the target
22  /// triple.
23 -Generic_GCC::GCCInstallationDetector::GCCInstallationDetector(
24 -    const Driver &D, const llvm::Triple &TargetTriple, const ArgList &Args)
25 -    : IsValid(false), D(D) {
26 +void
27 +Generic_GCC::GCCInstallationDetector::init(
28 +    const llvm::Triple &TargetTriple, const ArgList &Args) {
29    llvm::Triple BiarchVariantTriple =
30        TargetTriple.isArch32Bit() ? TargetTriple.get64BitArchVariant()
31                                   : TargetTriple.get32BitArchVariant();
32 @@ -1565,7 +1565,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLib
33  
34  Generic_GCC::Generic_GCC(const Driver &D, const llvm::Triple& Triple,
35                           const ArgList &Args)
36 -  : ToolChain(D, Triple, Args), GCCInstallation(getDriver(), Triple, Args) {
37 +  : ToolChain(D, Triple, Args), GCCInstallation(getDriver()) {
38    getProgramPaths().push_back(getDriver().getInstalledDir());
39    if (getDriver().getInstalledDir() != getDriver().Dir)
40      getProgramPaths().push_back(getDriver().Dir);
41 @@ -2361,6 +2361,7 @@ static StringRef getMultilibDir(const llvm::Triple
42  
43  Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
44    : Generic_ELF(D, Triple, Args) {
45 +  GCCInstallation.init(Triple, Args);
46    llvm::Triple::ArchType Arch = Triple.getArch();
47    std::string SysRoot = computeSysRoot();
48  
49 Index: tools/clang/lib/Driver/ToolChains.h
50 ===================================================================
51 --- tools/clang/lib/Driver/ToolChains.h
52 +++ tools/clang/lib/Driver/ToolChains.h
53 @@ -92,8 +92,8 @@ class LLVM_LIBRARY_VISIBILITY Generic_GCC : public
54      std::set<std::string> CandidateGCCInstallPaths;
55  
56    public:
57 -    GCCInstallationDetector(const Driver &D, const llvm::Triple &TargetTriple,
58 -                            const llvm::opt::ArgList &Args);
59 +    GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {}
60 +    void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args);
61  
62      /// \brief Check whether we detected a valid GCC install.
63      bool isValid() const { return IsValid; }