[cfe-commits] r84656 - /cfe/trunk/lib/Driver/ToolChains.cpp

Daniel Dunbar daniel at zuster.org
Tue Oct 20 12:25:43 PDT 2009


Author: ddunbar
Date: Tue Oct 20 14:25:43 2009
New Revision: 84656

URL: http://llvm.org/viewvc/llvm-project?rev=84656&view=rev
Log:
Driver: If unable to find the gcc tool chain, try the next OS rev.

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=84656&r1=84655&r2=84656&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Oct 20 14:25:43 2009
@@ -54,7 +54,6 @@
   GCCVersion[2] = _GCCVersion[2];
 
   // Set up the tool chain paths to match gcc.
-
   ToolChainDir = "i686-apple-darwin";
   ToolChainDir += llvm::utostr(DarwinVersion[0]);
   ToolChainDir += "/";
@@ -64,6 +63,24 @@
   ToolChainDir += '.';
   ToolChainDir += llvm::utostr(GCCVersion[2]);
 
+  // Try the next major version if that tool chain dir is invalid.
+  if (!llvm::sys::Path(ToolChainDir).exists()) {
+    std::string Next = "i686-apple-darwin";
+    Next += llvm::utostr(DarwinVersion[0] + 1);
+    Next += "/";
+    Next += llvm::utostr(GCCVersion[0]);
+    Next += '.';
+    Next += llvm::utostr(GCCVersion[1]);
+    Next += '.';
+    Next += llvm::utostr(GCCVersion[2]);
+
+    // Use that if it exists, otherwise hope the user isn't linking.
+    //
+    // FIXME: Drop dependency on gcc's tool chain.
+    if (llvm::sys::Path(Next).exists())
+      ToolChainDir = Next;
+  }
+
   std::string Path;
   if (getArchName() == "x86_64") {
     Path = getHost().getDriver().Dir;





More information about the cfe-commits mailing list