diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-01-27 00:56:25 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-01-27 00:56:25 +0000 |
commit | 2603137cb91e1d143b36fb71a72189884fbde5b5 (patch) | |
tree | e4b64c60fbac08e45783b5c1803af9ca8de22f68 /lib/Driver/ToolChains.h | |
parent | 13e635c55eb23f736d38abf9c954801bd6482db4 (diff) |
Driver/Darwin: Track target platform more explicitly in tool chain, eventually
this should just be part of the tool chain itself once we have eliminated
argument translation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94635 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.h')
-rw-r--r-- | lib/Driver/ToolChains.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h index 82fdf825d0..b6cdacac30 100644 --- a/lib/Driver/ToolChains.h +++ b/lib/Driver/ToolChains.h @@ -50,6 +50,19 @@ class VISIBILITY_HIDDEN Darwin : public ToolChain { /// Darwin version of tool chain. unsigned DarwinVersion[3]; + /// Whether the information on the target has been initialized. + // + // FIXME: This should be eliminated. What we want to do is make this part of + // the "default target for arguments" selection process, once we get out of + // the argument translation business. + mutable bool TargetInitialized; + + /// Whether we are targetting iPhoneOS target. + mutable bool TargetIsIPhoneOS; + + /// The OS version we are targetting. + mutable unsigned TargetVersion[3]; + /// Whether this is this an iPhoneOS toolchain. // // FIXME: This should go away, such differences should be completely @@ -75,6 +88,37 @@ public: /// @name Darwin Specific Toolchain API /// { + // FIXME: Eliminate these ...Target functions and derive separate tool chains + // for these targets and put version in constructor. + void setTarget(bool isIPhoneOS, unsigned Major, unsigned Minor, + unsigned Micro) const { + // FIXME: For now, allow reinitialization as long as values don't + // change. This will go away when we move away from argument translation. + if (TargetInitialized && TargetIsIPhoneOS == isIPhoneOS && + TargetVersion[0] == Major && TargetVersion[1] == Minor && + TargetVersion[2] == Micro) + return; + + assert(!TargetInitialized && "Target already initialized!"); + TargetInitialized = true; + TargetIsIPhoneOS = isIPhoneOS; + TargetVersion[0] = Major; + TargetVersion[1] = Minor; + TargetVersion[2] = Micro; + } + + bool isTargetIPhoneOS() const { + assert(TargetInitialized && "Target not initialized!"); + return TargetIsIPhoneOS; + } + + void getTargetVersion(unsigned (&Res)[3]) const { + assert(TargetInitialized && "Target not initialized!"); + Res[0] = TargetVersion[0]; + Res[1] = TargetVersion[1]; + Res[2] = TargetVersion[2]; + } + void getDarwinVersion(unsigned (&Res)[3]) const { Res[0] = DarwinVersion[0]; Res[1] = DarwinVersion[1]; |