diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-10-20 19:25:43 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-10-20 19:25:43 +0000 |
commit | 74782b066ecfb0ee05b34ef3a29e24d39c59c1bd (patch) | |
tree | ba1ef150d7f8f868cf1d12a2deb2826fc822f800 /lib/Driver/ToolChains.cpp | |
parent | f6a39b71a4d57ef339073277ca0cfe9376268274 (diff) |
Driver: If unable to find the gcc tool chain, try the next OS rev.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84656 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r-- | lib/Driver/ToolChains.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 6acbc19bea..a0fefcdfc1 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -54,7 +54,6 @@ DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple, 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 @@ DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple, 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; |