Use new Triple::getMacOSXVersion function.
llvm-svn: 149439
This commit is contained in:
parent
aa30aff4f7
commit
a223401498
|
@ -52,42 +52,17 @@ Darwin::Darwin(const Driver &D, const llvm::Triple& Triple)
|
||||||
{
|
{
|
||||||
// Compute the initial Darwin version from the triple
|
// Compute the initial Darwin version from the triple
|
||||||
unsigned Major, Minor, Micro;
|
unsigned Major, Minor, Micro;
|
||||||
Triple.getOSVersion(Major, Minor, Micro);
|
if (!Triple.getMacOSXVersion(Major, Minor, Micro))
|
||||||
switch (Triple.getOS()) {
|
getDriver().Diag(diag::err_drv_invalid_darwin_version) <<
|
||||||
default: assert(0 && "unexpected OS for Darwin triple");
|
Triple.getOSName();
|
||||||
case llvm::Triple::Darwin:
|
llvm::raw_string_ostream(MacosxVersionMin)
|
||||||
// Default to darwin4, i.e., MacOSX 10.0.0.
|
<< Major << '.' << Minor << '.' << Micro;
|
||||||
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;
|
|
||||||
}
|
|
||||||
// FIXME: DarwinVersion is only used to find GCC's libexec directory.
|
// FIXME: DarwinVersion is only used to find GCC's libexec directory.
|
||||||
// It should be removed when we stop supporting that.
|
// It should be removed when we stop supporting that.
|
||||||
DarwinVersion[0] = Minor + 4;
|
DarwinVersion[0] = Minor + 4;
|
||||||
DarwinVersion[1] = Micro;
|
DarwinVersion[1] = Micro;
|
||||||
DarwinVersion[2] = 0;
|
DarwinVersion[2] = 0;
|
||||||
llvm::raw_string_ostream(MacosxVersionMin)
|
|
||||||
<< Major << '.' << Minor << '.' << Micro;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
types::ID Darwin::LookupTypeForExtension(const char *Ext) const {
|
types::ID Darwin::LookupTypeForExtension(const char *Ext) const {
|
||||||
|
|
Loading…
Reference in New Issue