Driver/Darwin: Eliminate confusing IsIPhoneOS parameter -- this was actually

just indicating whether the default target should be iPhoneOS.

llvm-svn: 94638
This commit is contained in:
Daniel Dunbar 2010-01-27 00:56:44 +00:00
parent 15c8942baf
commit 7c870175eb
3 changed files with 19 additions and 38 deletions

View File

@ -146,10 +146,10 @@ ToolChain *DarwinHostInfo::CreateToolChain(const ArgList &Args,
// If we recognized the arch, match it to the toolchains we support. // If we recognized the arch, match it to the toolchains we support.
if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64) { if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64) {
// We still use the legacy DarwinGCC toolchain on X86. // We still use the legacy DarwinGCC toolchain on X86.
TC = new toolchains::DarwinGCC(*this, TCTriple, DarwinVersion, GCCVersion, TC = new toolchains::DarwinGCC(*this, TCTriple, DarwinVersion,
false); GCCVersion);
} else if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) } else if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb)
TC = new toolchains::DarwinClang(*this, TCTriple, DarwinVersion, true); TC = new toolchains::DarwinClang(*this, TCTriple, DarwinVersion);
else else
TC = new toolchains::Darwin_Generic_GCC(*this, TCTriple); TC = new toolchains::Darwin_Generic_GCC(*this, TCTriple);
} }

View File

@ -31,8 +31,8 @@ using namespace clang::driver::toolchains;
/// Darwin - Darwin tool chain for i386 and x86_64. /// Darwin - Darwin tool chain for i386 and x86_64.
Darwin::Darwin(const HostInfo &Host, const llvm::Triple& Triple, Darwin::Darwin(const HostInfo &Host, const llvm::Triple& Triple,
const unsigned (&_DarwinVersion)[3], bool _IsIPhoneOS) const unsigned (&_DarwinVersion)[3])
: ToolChain(Host, Triple), TargetInitialized(false), IsIPhoneOS(_IsIPhoneOS) : ToolChain(Host, Triple), TargetInitialized(false)
{ {
DarwinVersion[0] = _DarwinVersion[0]; DarwinVersion[0] = _DarwinVersion[0];
DarwinVersion[1] = _DarwinVersion[1]; DarwinVersion[1] = _DarwinVersion[1];
@ -41,9 +41,6 @@ Darwin::Darwin(const HostInfo &Host, const llvm::Triple& Triple,
llvm::raw_string_ostream(MacosxVersionMin) llvm::raw_string_ostream(MacosxVersionMin)
<< "10." << std::max(0, (int)DarwinVersion[0] - 4) << '.' << "10." << std::max(0, (int)DarwinVersion[0] - 4) << '.'
<< DarwinVersion[1]; << DarwinVersion[1];
// FIXME: Lift default up.
IPhoneOSVersionMin = "3.0";
} }
// FIXME: Can we tablegen this? // FIXME: Can we tablegen this?
@ -111,8 +108,8 @@ llvm::StringRef Darwin::getDarwinArchName(const ArgList &Args) const {
DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple, DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple,
const unsigned (&DarwinVersion)[3], const unsigned (&DarwinVersion)[3],
const unsigned (&_GCCVersion)[3], bool IsIPhoneOS) const unsigned (&_GCCVersion)[3])
: Darwin(Host, Triple, DarwinVersion, IsIPhoneOS) : Darwin(Host, Triple, DarwinVersion)
{ {
GCCVersion[0] = _GCCVersion[0]; GCCVersion[0] = _GCCVersion[0];
GCCVersion[1] = _GCCVersion[1]; GCCVersion[1] = _GCCVersion[1];
@ -289,9 +286,8 @@ void DarwinGCC::AddLinkRuntimeLibArgs(const ArgList &Args,
} }
DarwinClang::DarwinClang(const HostInfo &Host, const llvm::Triple& Triple, DarwinClang::DarwinClang(const HostInfo &Host, const llvm::Triple& Triple,
const unsigned (&DarwinVersion)[3], const unsigned (&DarwinVersion)[3])
bool IsIPhoneOS) : Darwin(Host, Triple, DarwinVersion)
: Darwin(Host, Triple, DarwinVersion, IsIPhoneOS)
{ {
// We expect 'as', 'ld', etc. to be adjacent to our install dir. // We expect 'as', 'ld', etc. to be adjacent to our install dir.
getProgramPaths().push_back(getDriver().Dir); getProgramPaths().push_back(getDriver().Dir);
@ -424,13 +420,13 @@ DerivedArgList *Darwin::TranslateArgs(InputArgList &Args,
iPhoneVersion = DAL->MakeJoinedArg(0, O, iPhoneOSTarget); iPhoneVersion = DAL->MakeJoinedArg(0, O, iPhoneOSTarget);
DAL->append(iPhoneVersion); DAL->append(iPhoneVersion);
} else { } else {
// Otherwise, choose the default version based on the toolchain. // Otherwise, choose a default platform based on the tool chain.
//
// FIXME: This is confusing it should be more explicit what the default // FIXME: Don't hardcode default here.
// target is. if (getTriple().getArch() == llvm::Triple::arm ||
if (isIPhoneOS()) { getTriple().getArch() == llvm::Triple::thumb) {
const Option *O = Opts.getOption(options::OPT_miphoneos_version_min_EQ); const Option *O = Opts.getOption(options::OPT_miphoneos_version_min_EQ);
iPhoneVersion = DAL->MakeJoinedArg(0, O, IPhoneOSVersionMin) ; iPhoneVersion = DAL->MakeJoinedArg(0, O, "3.0");
DAL->append(iPhoneVersion); DAL->append(iPhoneVersion);
} else { } else {
const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ); const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);

View File

@ -63,26 +63,13 @@ class VISIBILITY_HIDDEN Darwin : public ToolChain {
/// The OS version we are targetting. /// The OS version we are targetting.
mutable unsigned TargetVersion[3]; mutable unsigned TargetVersion[3];
/// Whether this is this an iPhoneOS toolchain.
//
// FIXME: This should go away, such differences should be completely
// determined by the target triple.
//
// FIXME: It is also broken, we need to distinguish the "default target" from
// the actual target. The -m...-version-min strings and deployment targets can
// change this.
bool IsIPhoneOS;
/// The default macosx-version-min of this tool chain; empty until /// The default macosx-version-min of this tool chain; empty until
/// initialized. /// initialized.
std::string MacosxVersionMin; std::string MacosxVersionMin;
/// The default iphoneos-version-min of this tool chain.
std::string IPhoneOSVersionMin;
public: public:
Darwin(const HostInfo &Host, const llvm::Triple& Triple, Darwin(const HostInfo &Host, const llvm::Triple& Triple,
const unsigned (&DarwinVersion)[3], bool IsIPhoneOS); const unsigned (&DarwinVersion)[3]);
~Darwin(); ~Darwin();
/// @name Darwin Specific Toolchain API /// @name Darwin Specific Toolchain API
@ -167,8 +154,6 @@ public:
virtual void AddLinkRuntimeLibArgs(const ArgList &Args, virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
ArgStringList &CmdArgs) const = 0; ArgStringList &CmdArgs) const = 0;
bool isIPhoneOS() const { return IsIPhoneOS; }
/// } /// }
/// @name ToolChain Implementation /// @name ToolChain Implementation
/// { /// {
@ -204,7 +189,7 @@ public:
class VISIBILITY_HIDDEN DarwinClang : public Darwin { class VISIBILITY_HIDDEN DarwinClang : public Darwin {
public: public:
DarwinClang(const HostInfo &Host, const llvm::Triple& Triple, DarwinClang(const HostInfo &Host, const llvm::Triple& Triple,
const unsigned (&DarwinVersion)[3], bool IsIPhoneOS); const unsigned (&DarwinVersion)[3]);
/// @name Darwin ToolChain Implementation /// @name Darwin ToolChain Implementation
/// { /// {
@ -228,8 +213,8 @@ class VISIBILITY_HIDDEN DarwinGCC : public Darwin {
public: public:
DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple, DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple,
const unsigned (&DarwinVersion)[3], const unsigned (&GCCVersion)[3], const unsigned (&DarwinVersion)[3],
bool IsIPhoneOS); const unsigned (&GCCVersion)[3]);
/// @name Darwin ToolChain Implementation /// @name Darwin ToolChain Implementation
/// { /// {