[cfe-commits] r130592 - in /cfe/trunk/lib/Driver: ToolChains.cpp ToolChains.h
Daniel Dunbar
daniel at zuster.org
Fri Apr 29 21:18:16 PDT 2011
Author: ddunbar
Date: Fri Apr 29 23:18:16 2011
New Revision: 130592
URL: http://llvm.org/viewvc/llvm-project?rev=130592&view=rev
Log:
Driver/Darwin: Change Darwin toolchain to explicitly track is-ios-sim bit, and
update -mios-simulator-version-min to set it.
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=130592&r1=130591&r2=130592&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Apr 29 23:18:16 2011
@@ -477,7 +477,17 @@
<< Version->getAsString(Args);
}
- setTarget(/*isIPhoneOS=*/ !OSXVersion, Major, Minor, Micro);
+ bool IsIOSSim = bool(iOSSimVersion);
+
+ // In GCC, the simulator historically was treated as being OS X in some
+ // contexts, like determining the link logic, despite generally being called
+ // with an iOS deployment target. For compatibility, we detect the
+ // simulator as iOS + x86, and treat it differently in a few contexts.
+ if (iOSVersion && (getTriple().getArch() == llvm::Triple::x86 ||
+ getTriple().getArch() == llvm::Triple::x86_64))
+ IsIOSSim = true;
+
+ setTarget(/*IsIPhoneOS=*/ !OSXVersion, Major, Minor, Micro, IsIOSSim);
}
void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=130592&r1=130591&r2=130592&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Apr 29 23:18:16 2011
@@ -60,6 +60,9 @@
/// Whether we are targeting iPhoneOS target.
mutable bool TargetIsIPhoneOS;
+ /// Whether we are targeting the iPhoneOS simulator target.
+ mutable bool TargetIsIPhoneOSSimulator;
+
/// The OS version we are targeting.
mutable unsigned TargetVersion[3];
@@ -81,18 +84,22 @@
// 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 {
+ void setTarget(bool IsIPhoneOS, unsigned Major, unsigned Minor,
+ unsigned Micro, bool IsIOSSim) const {
+ assert((!IsIOSSim || IsIPhoneOS) && "Unexpected deployment target!");
+
// 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 &&
+ if (TargetInitialized && TargetIsIPhoneOS == IsIPhoneOS &&
+ TargetIsIPhoneOSSimulator == IsIOSSim &&
TargetVersion[0] == Major && TargetVersion[1] == Minor &&
TargetVersion[2] == Micro)
return;
assert(!TargetInitialized && "Target already initialized!");
TargetInitialized = true;
- TargetIsIPhoneOS = isIPhoneOS;
+ TargetIsIPhoneOS = IsIPhoneOS;
+ TargetIsIPhoneOSSimulator = IsIOSSim;
TargetVersion[0] = Major;
TargetVersion[1] = Minor;
TargetVersion[2] = Micro;
@@ -104,13 +111,8 @@
}
bool isTargetIOSSimulator() const {
- // In GCC, the simulator historically was treated as being OS X in some
- // contexts, like determining the link logic, despite generally being called
- // with an iOS deployment target. For compatibility, we detect the
- // simulator is iOS + x86, and treat it differently in a few contexts.
- return isTargetIPhoneOS() &&
- (getTriple().getArch() == llvm::Triple::x86 ||
- getTriple().getArch() == llvm::Triple::x86_64);
+ assert(TargetInitialized && "Target not initialized!");
+ return TargetIsIPhoneOSSimulator;
}
bool isTargetInitialized() const { return TargetInitialized; }
More information about the cfe-commits
mailing list