diff options
-rw-r--r-- | lib/Driver/ToolChains.cpp | 8 | ||||
-rw-r--r-- | lib/Driver/ToolChains.h | 25 | ||||
-rw-r--r-- | test/Driver/darwin-iphone-defaults.m | 18 |
3 files changed, 29 insertions, 22 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 9e64c862c7..19f9012a42 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -34,13 +34,9 @@ Darwin::Darwin(const HostInfo &Host, const llvm::Triple& Triple, const unsigned (&_DarwinVersion)[3]) : ToolChain(Host, Triple), TargetInitialized(false) { - DarwinVersion[0] = _DarwinVersion[0]; - DarwinVersion[1] = _DarwinVersion[1]; - DarwinVersion[2] = _DarwinVersion[2]; - llvm::raw_string_ostream(MacosxVersionMin) - << "10." << std::max(0, (int)DarwinVersion[0] - 4) << '.' - << DarwinVersion[1]; + << "10." << std::max(0, (int)_DarwinVersion[0] - 4) << '.' + << _DarwinVersion[1]; } // FIXME: Can we tablegen this? diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h index e17546c982..e683c2d484 100644 --- a/lib/Driver/ToolChains.h +++ b/lib/Driver/ToolChains.h @@ -47,9 +47,6 @@ public: class VISIBILITY_HIDDEN Darwin : public ToolChain { mutable llvm::DenseMap<unsigned, Tool*> Tools; - /// 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 @@ -106,12 +103,6 @@ public: Res[2] = TargetVersion[2]; } - void getDarwinVersion(unsigned (&Res)[3]) const { - Res[0] = DarwinVersion[0]; - Res[1] = DarwinVersion[1]; - Res[2] = DarwinVersion[2]; - } - /// getDarwinArchName - Get the "Darwin" arch name for a particular compiler /// invocation. For example, Darwin treats different ARM variations as /// distinct architectures. @@ -160,18 +151,20 @@ public: virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const; virtual bool IsBlocksDefault() const { - // Blocks default to on for 10.6 (darwin10) and beyond. - return (DarwinVersion[0] > 9); + // Blocks default to on for OS X 10.6 and iPhoneOS 3.0 and beyond. + if (isTargetIPhoneOS()) + return !isIPhoneOSVersionLT(3); + else + return !isMacosxVersionLT(10, 6); } virtual bool IsObjCNonFragileABIDefault() const { - // Non-fragile ABI default to on for 10.5 (darwin9) and beyond on x86-64. - return (DarwinVersion[0] >= 9 && - getTriple().getArch() == llvm::Triple::x86_64); + // Non-fragile ABI default to on for iPhoneOS and x86-64. + return isTargetIPhoneOS() || getTriple().getArch() == llvm::Triple::x86_64; } virtual bool IsUnwindTablesDefault() const; virtual unsigned GetDefaultStackProtectorLevel() const { - // Stack protectors default to on for 10.6 (darwin10) and beyond. - return (DarwinVersion[0] > 9) ? 1 : 0; + // Stack protectors default to on for 10.6 and beyond. + return !isTargetIPhoneOS() && !isMacosxVersionLT(10, 6); } virtual const char *GetDefaultRelocationModel() const; virtual const char *GetForcedPicModel() const; diff --git a/test/Driver/darwin-iphone-defaults.m b/test/Driver/darwin-iphone-defaults.m new file mode 100644 index 0000000000..61bc44125a --- /dev/null +++ b/test/Driver/darwin-iphone-defaults.m @@ -0,0 +1,18 @@ +// RUN: %clang -ccc-host-triple i386-apple-darwin9 -arch armv7 -flto -S -o - %s | FileCheck %s + +// CHECK: @f0 +// CHECK-NOT: ssp +// CHECK: ) { +// CHECK: @__f0_block_invoke + +int f0() { + return ^(){ return 0; }(); +} + +@interface I0 +@property (assign) int p0; +@end + +@implementation I0 +@synthesize p0 = __sythesized_p0; +@end |