From: Daniel Dunbar Date: Thu, 15 Jul 2010 16:18:06 +0000 (+0000) Subject: Driver/Darwin: Resolve deployment target defaulting to be more predictable; X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2bb38d0d93e56617f93091a92b2e6396c0cd0dcd;p=clang Driver/Darwin: Resolve deployment target defaulting to be more predictable; assume we are targetting OS X unless an explicit option is given. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108426 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 78763397ee..a78d1536fa 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -469,19 +469,10 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args, iPhoneVersion = DAL->MakeJoinedArg(0, O, iPhoneOSTarget); DAL->append(iPhoneVersion); } else { - // Otherwise, choose a default platform based on the tool chain. - // - // FIXME: Don't hardcode default here. - if (getTriple().getArch() == llvm::Triple::arm || - getTriple().getArch() == llvm::Triple::thumb) { - const Option *O = Opts.getOption(options::OPT_miphoneos_version_min_EQ); - iPhoneVersion = DAL->MakeJoinedArg(0, O, "3.0"); - DAL->append(iPhoneVersion); - } else { - const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ); - OSXVersion = DAL->MakeJoinedArg(0, O, MacosxVersionMin); - DAL->append(OSXVersion); - } + // Otherwise, assume we are targeting OS X. + const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ); + OSXVersion = DAL->MakeJoinedArg(0, O, MacosxVersionMin); + DAL->append(OSXVersion); } } diff --git a/test/Driver/darwin-iphone-defaults.m b/test/Driver/darwin-iphone-defaults.m index 97ac4a42a5..62a9403900 100644 --- a/test/Driver/darwin-iphone-defaults.m +++ b/test/Driver/darwin-iphone-defaults.m @@ -1,4 +1,4 @@ -// RUN: %clang -ccc-host-triple i386-apple-darwin9 -arch armv7 -flto -S -o - %s | FileCheck %s +// RUN: %clang -ccc-host-triple i386-apple-darwin9 -miphoneos-version-min=3.0 -arch armv7 -flto -S -o - %s | FileCheck %s // CHECK: @f0 // CHECK-NOT: ssp diff --git a/test/Frontend/darwin-version.c b/test/Frontend/darwin-version.c index 1c866ee096..151d3a9f47 100644 --- a/test/Frontend/darwin-version.c +++ b/test/Frontend/darwin-version.c @@ -1,4 +1,7 @@ // RUN: %clang -ccc-host-triple armv6-apple-darwin9 -dM -E -o %t %s +// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | count 0 +// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1 +// RUN: %clang -ccc-host-triple armv6-apple-darwin9 -miphoneos-version-min=3.0 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '30000' | count 1 // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | count 0 // RUN: %clang -ccc-host-triple armv6-apple-darwin9 -miphoneos-version-min=2.0 -dM -E -o %t %s