aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2012-01-31 22:43:59 +0000
committerBob Wilson <bob.wilson@apple.com>2012-01-31 22:43:59 +0000
commit4c5ffb32e89da30479da49b87abf560c81e4c210 (patch)
treefd8aa15fda3374e4889f9d7b3de4020d03b0823c /lib/Driver/ToolChains.cpp
parent9c7aed308aa701e0ba573c04ebe8d17a4c1486c4 (diff)
Use new Triple::getMacOSXVersion function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149439 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r--lib/Driver/ToolChains.cpp37
1 files changed, 6 insertions, 31 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 9cc29cd545..fda72ed584 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -52,42 +52,17 @@ Darwin::Darwin(const Driver &D, const llvm::Triple& Triple)
{
// Compute the initial Darwin version from the triple
unsigned Major, Minor, Micro;
- Triple.getOSVersion(Major, Minor, Micro);
- switch (Triple.getOS()) {
- default: assert(0 && "unexpected OS for Darwin triple");
- case llvm::Triple::Darwin:
- // Default to darwin4, i.e., MacOSX 10.0.0.
- if (Major == 0)
- Major = 4;
- if (Major < 4)
- getDriver().Diag(diag::err_drv_invalid_darwin_version) <<
- Triple.getOSName();
- Micro = 0;
- Minor = Major - 4;
- Major = 10;
- break;
- case llvm::Triple::MacOSX:
- // Default to MacOSX 10.
- if (Major == 0)
- Major = 10;
- if (Major != 10)
- getDriver().Diag(diag::err_drv_invalid_darwin_version) <<
- Triple.getOSName();
- break;
- case llvm::Triple::IOS:
- // Ignore the version from the triple.
- Major = 10;
- Minor = 0;
- Micro = 0;
- break;
- }
+ if (!Triple.getMacOSXVersion(Major, Minor, Micro))
+ getDriver().Diag(diag::err_drv_invalid_darwin_version) <<
+ Triple.getOSName();
+ llvm::raw_string_ostream(MacosxVersionMin)
+ << Major << '.' << Minor << '.' << Micro;
+
// FIXME: DarwinVersion is only used to find GCC's libexec directory.
// It should be removed when we stop supporting that.
DarwinVersion[0] = Minor + 4;
DarwinVersion[1] = Micro;
DarwinVersion[2] = 0;
- llvm::raw_string_ostream(MacosxVersionMin)
- << Major << '.' << Minor << '.' << Micro;
}
types::ID Darwin::LookupTypeForExtension(const char *Ext) const {