r189536 - Look for libstdc++ first on the clang install directory.

Rafael Espindola rafael.espindola at gmail.com
Wed Aug 28 16:17:47 PDT 2013


Author: rafael
Date: Wed Aug 28 18:17:47 2013
New Revision: 189536

URL: http://llvm.org/viewvc/llvm-project?rev=189536&view=rev
Log:
Look for libstdc++ first on the clang install directory.

When sysroot is not set, look for libstdc++ first on the clang install
directory. Before this change if clang was installed alongside a gcc with
the same version as the system one we would select the system libstdc++.

Unfortunately this is hard to test as only the non-sysroot case is changed.

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=189536&r1=189535&r2=189536&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Aug 28 18:17:47 2013
@@ -1021,9 +1021,18 @@ Generic_GCC::GCCInstallationDetector::GC
 
     Prefixes.push_back(GCCToolchainDir);
   } else {
-    Prefixes.push_back(D.SysRoot);
-    Prefixes.push_back(D.SysRoot + "/usr");
+    // If we have a SysRoot, try that first.
+    if (!D.SysRoot.empty()) {
+      Prefixes.push_back(D.SysRoot);
+      Prefixes.push_back(D.SysRoot + "/usr");
+    }
+
+    // Then look for gcc installed alongside clang.
     Prefixes.push_back(D.InstalledDir + "/..");
+
+    // And finally in /usr.
+    if (D.SysRoot.empty())
+      Prefixes.push_back("/usr");
   }
 
   // Loop over the various components which exist and select the best GCC





More information about the cfe-commits mailing list