Lift getMacosxVersionMin out into Darwin ToolChain.

llvm-svn: 82210
This commit is contained in:
Daniel Dunbar 2009-09-18 08:14:46 +00:00
parent 4c30b89def
commit 510d8a8dd8
3 changed files with 20 additions and 13 deletions

View File

@ -154,6 +154,21 @@ void Darwin::AddLinkSearchPathArgs(const ArgList &Args,
"/../../.."));
}
void Darwin::getMacosxVersionMin(const ArgList &Args,
unsigned (&Res)[3]) const {
if (Arg *A = Args.getLastArg(options::OPT_mmacosx_version_min_EQ)) {
bool HadExtra;
if (!Driver::GetReleaseVersion(A->getValue(Args), Res[0], Res[1], Res[2],
HadExtra) ||
HadExtra) {
const Driver &D = getHost().getDriver();
D.Diag(clang::diag::err_drv_invalid_version_number)
<< A->getAsString(Args);
}
} else
return getMacosxVersion(Res);
}
DerivedArgList *Darwin::TranslateArgs(InputArgList &Args,
const char *BoundArch) const {
DerivedArgList *DAL = new DerivedArgList(Args, false);

View File

@ -91,6 +91,10 @@ public:
Res[2] = DarwinVersion[1];
}
/// getMacosxVersionMin - Get the effective -mmacosx-version-min, which is
/// either the -mmacosx-version-min, or the current version if unspecified.
void getMacosxVersionMin(const ArgList &Args, unsigned (&Res)[3]) const;
const char *getMacosxVersionStr() const {
return MacosxVersionMin.c_str();
}

View File

@ -1929,19 +1929,7 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(Output.getFilename());
unsigned MacosxVersionMin[3];
if (Arg *A = Args.getLastArg(options::OPT_mmacosx_version_min_EQ)) {
bool HadExtra;
if (!Driver::GetReleaseVersion(A->getValue(Args), MacosxVersionMin[0],
MacosxVersionMin[1], MacosxVersionMin[2],
HadExtra) ||
HadExtra) {
const Driver &D = getToolChain().getHost().getDriver();
D.Diag(clang::diag::err_drv_invalid_version_number)
<< A->getAsString(Args);
}
} else {
getDarwinToolChain().getMacosxVersion(MacosxVersionMin);
}
getDarwinToolChain().getMacosxVersionMin(Args, MacosxVersionMin);
if (!Args.hasArg(options::OPT_A) &&
!Args.hasArg(options::OPT_nostdlib) &&