From: Bob Wilson Date: Tue, 31 Jan 2012 22:43:59 +0000 (+0000) Subject: Use new Triple::getMacOSXVersion function. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4c5ffb32e89da30479da49b87abf560c81e4c210;p=clang Use new Triple::getMacOSXVersion function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149439 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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 {