[PATCH] D40998: [driver][darwin] Take the OS version specified in "-target" as the target OS instead of inferring it from SDK / environment
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rC321099: [driver][darwin] Take the OS version specified in -target as the target (authored by arphaman, committed by ). Repository: rC Clang https://reviews.llvm.org/D40998 Files: lib/Driver/ToolChains/Darwin.cpp test/Driver/darwin-version.c test/Driver/objc-weak.m test/Driver/pic.c test/Driver/unavailable_aligned_allocation.cpp Index: test/Driver/objc-weak.m === --- test/Driver/objc-weak.m +++ test/Driver/objc-weak.m @@ -1,27 +1,27 @@ // Check miscellaneous Objective-C options. -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-arc -fobjc-weak 2>&1 | FileCheck %s --check-prefix ARC-WEAK -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fno-objc-weak -fobjc-weak -fobjc-arc 2>&1 | FileCheck %s --check-prefix ARC-WEAK +// RUN: %clang -target x86_64-apple-macosx10.7 -S -### %s -fobjc-arc -fobjc-weak 2>&1 | FileCheck %s --check-prefix ARC-WEAK +// RUN: %clang -target x86_64-apple-macosx10.7 -S -### %s -fno-objc-weak -fobjc-weak -fobjc-arc 2>&1 | FileCheck %s --check-prefix ARC-WEAK // ARC-WEAK: -fobjc-arc // ARC-WEAK: -fobjc-weak -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-arc -fno-objc-weak 2>&1 | FileCheck %s --check-prefix ARC-NO-WEAK -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-weak -fno-objc-weak -fobjc-arc 2>&1 | FileCheck %s --check-prefix ARC-NO-WEAK +// RUN: %clang -target x86_64-apple-macos10.7 -S -### %s -fobjc-arc -fno-objc-weak 2>&1 | FileCheck %s --check-prefix ARC-NO-WEAK +// RUN: %clang -target x86_64-apple-macos10.7 -S -### %s -fobjc-weak -fno-objc-weak -fobjc-arc 2>&1 | FileCheck %s --check-prefix ARC-NO-WEAK // ARC-NO-WEAK: -fobjc-arc // ARC-NO-WEAK: -fno-objc-weak -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.5 -S -### %s -fobjc-arc -fobjc-weak 2>&1 | FileCheck %s --check-prefix ARC-WEAK-NOTSUPPORTED -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.5 -S -### %s -fno-objc-weak -fobjc-weak -fobjc-arc 2>&1 | FileCheck %s --check-prefix ARC-WEAK-NOTSUPPORTED +// RUN: %clang -target x86_64-apple-macosx10.5 -S -### %s -fobjc-arc -fobjc-weak 2>&1 | FileCheck %s --check-prefix ARC-WEAK-NOTSUPPORTED +// RUN: %clang -target x86_64-apple-macosx10.5 -S -### %s -fno-objc-weak -fobjc-weak -fobjc-arc 2>&1 | FileCheck %s --check-prefix ARC-WEAK-NOTSUPPORTED // ARC-WEAK-NOTSUPPORTED: error: -fobjc-weak is not supported on the current deployment target -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fno-objc-weak -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK +// RUN: %clang -target x86_64-apple-macos10.7 -S -### %s -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK +// RUN: %clang -target x86_64-apple-macos10.7 -S -### %s -fno-objc-weak -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK // MRC-WEAK: -fobjc-weak -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fno-objc-weak 2>&1 | FileCheck %s --check-prefix MRC-NO-WEAK -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-weak -fno-objc-weak 2>&1 | FileCheck %s --check-prefix MRC-NO-WEAK +// RUN: %clang -target x86_64-apple-macosx10.7 -S -### %s -fno-objc-weak 2>&1 | FileCheck %s --check-prefix MRC-NO-WEAK +// RUN: %clang -target x86_64-apple-macosx10.7 -S -### %s -fobjc-weak -fno-objc-weak 2>&1 | FileCheck %s --check-prefix MRC-NO-WEAK // MRC-NO-WEAK: -fno-objc-weak -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.5 -S -### %s -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK-NOTSUPPORTED -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.5 -S -### %s -fno-objc-weak -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK-NOTSUPPORTED +// RUN: %clang -target x86_64-apple-macosx10.5 -S -### %s -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK-NOTSUPPORTED +// RUN: %clang -target x86_64-apple-macosx10.5 -S -### %s -fno-objc-weak -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK-NOTSUPPORTED // MRC-WEAK-NOTSUPPORTED: error: -fobjc-weak is not supported on the current deployment target Index: test/Driver/pic.c === --- test/Driver/pic.c +++ test/Driver/pic.c @@ -221,19 +221,19 @@ // // Checks for ARM+Apple+IOS including -fapple-kext, -mkernel, and iphoneos // version boundaries. -// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target
[PATCH] D40998: [driver][darwin] Take the OS version specified in "-target" as the target OS instead of inferring it from SDK / environment
bob.wilson accepted this revision. bob.wilson added a comment. LGTM Repository: rC Clang https://reviews.llvm.org/D40998 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40998: [driver][darwin] Take the OS version specified in "-target" as the target OS instead of inferring it from SDK / environment
arphaman updated this revision to Diff 126388. arphaman marked an inline comment as done. arphaman added a comment. Don't warn about the redundant environment variable Repository: rC Clang https://reviews.llvm.org/D40998 Files: lib/Driver/ToolChains/Darwin.cpp test/Driver/darwin-version.c test/Driver/objc-weak.m test/Driver/pic.c test/Driver/unavailable_aligned_allocation.cpp Index: test/Driver/unavailable_aligned_allocation.cpp === --- test/Driver/unavailable_aligned_allocation.cpp +++ test/Driver/unavailable_aligned_allocation.cpp @@ -10,15 +10,15 @@ // RUN: %clang -target thumbv7-apple-watchos3 -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.13 -mios-simulator-version-min=10 \ +// RUN: %clang -target x86_64-apple-darwin -mios-simulator-version-min=10 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.13 -mtvos-simulator-version-min=10 \ +// RUN: %clang -target x86_64-apple-darwin -mtvos-simulator-version-min=10 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.13 -mwatchos-simulator-version-min=3 \ +// RUN: %clang -target x86_64-apple-darwin -mwatchos-simulator-version-min=3 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // @@ -39,15 +39,15 @@ // RUN: %clang -target x86_64-unknown-linux-gnu -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.12 -mios-simulator-version-min=11 \ +// RUN: %clang -target x86_64-apple-darwin -mios-simulator-version-min=11 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.12 -mtvos-simulator-version-min=11 \ +// RUN: %clang -target x86_64-apple-darwin -mtvos-simulator-version-min=11 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.12 -mwatchos-simulator-version-min=4 \ +// RUN: %clang -target x86_64-apple-darwin -mwatchos-simulator-version-min=4 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // Index: test/Driver/pic.c === --- test/Driver/pic.c +++ test/Driver/pic.c @@ -221,19 +221,19 @@ // // Checks for ARM+Apple+IOS including -fapple-kext, -mkernel, and iphoneos // version boundaries. -// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target armv7-apple-ios6 -fapple-kext -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 -// RUN: %clang -c %s -target armv7-apple-ios -mkernel -miphoneos-version-min=6.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target armv7-apple-ios6 -mkernel -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 -// RUN: %clang -c %s -target arm64-apple-ios -mkernel -miphoneos-version-min=7.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target arm64-apple-ios7 -mkernel -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 -// RUN: %clang -x assembler -c %s -target arm64-apple-ios -mkernel -miphoneos-version-min=7.0.0 -no-integrated-as -### 2>&1 \ +// RUN: %clang -x assembler -c %s -target arm64-apple-ios7 -mkernel -no-integrated-as -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-STATIC -// RUN: %clang -c %s -target armv7k-apple-watchos -fapple-kext -mwatchos-version-min=1.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target armv7k-apple-watchos1 -fapple-kext -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 -// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=5.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target armv7-apple-ios5 -fapple-kext -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC -// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -static -### 2>&1 \ +// RUN: %clang -c %s -target armv7-apple-ios6 -fapple-kext -static -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC // RUN: %clang -c %s -target armv7-apple-unknown-macho -static -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC Index: test/Driver/objc-weak.m === --- test/Driver/objc-weak.m +++ test/Driver/objc-weak.m @@ -1,27 +1,27 @@ // Check miscellaneous Objective-C options. -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-arc -fobjc-weak 2>&1 | FileCheck %s --check-prefix ARC-WEAK -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fno-objc-weak -fobjc-weak -fobjc-arc 2>&1 | FileCheck %s --check-prefix ARC-WEAK +// RUN: %clang -target x86_64-apple-macosx10.7 -S -### %s
[PATCH] D40998: [driver][darwin] Take the OS version specified in "-target" as the target OS instead of inferring it from SDK / environment
bob.wilson requested changes to this revision. bob.wilson added inline comments. This revision now requires changes to proceed. Comment at: lib/Driver/ToolChains/Darwin.cpp:1518-1523 + // Warn about superfluous OS_DEPLOYMENT_TARGET environment variable. + Optional EnvTarget = + getDeploymentTargetFromEnvironmentVariables(getDriver(), getTriple()); + if (EnvTarget) +getDriver().Diag(clang::diag::warn_drv_unused_environment_variable) +<< EnvTarget->getAsString(Args, Opts); I don't think there should be a warning in this case. It is common (at least within Apple) to set the environment variable as a default but then override it for some cases. Warning would be really annoying, and for anyone using -Werror it will break their builds. Repository: rC Clang https://reviews.llvm.org/D40998 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40998: [driver][darwin] Take the OS version specified in "-target" as the target OS instead of inferring it from SDK / environment
arphaman updated this revision to Diff 126243. arphaman added a comment. I rewrote the patch on top of https://reviews.llvm.org/D41035 as suggested by Duncan. I also changed some of the semantics: - If `-target` is used with `Darwin` OS, then the OS will be determined using the old semantics. - If `-target` specifies a concrete OS (even without version), that OS is **always** used, no matter what other options/environment variables are given. The driver will warn about superfluous `-m-version-min` and environment variables in this case. Repository: rC Clang https://reviews.llvm.org/D40998 Files: include/clang/Basic/DiagnosticDriverKinds.td lib/Driver/ToolChains/Darwin.cpp test/Driver/darwin-version.c test/Driver/objc-weak.m test/Driver/pic.c test/Driver/unavailable_aligned_allocation.cpp Index: test/Driver/unavailable_aligned_allocation.cpp === --- test/Driver/unavailable_aligned_allocation.cpp +++ test/Driver/unavailable_aligned_allocation.cpp @@ -10,15 +10,15 @@ // RUN: %clang -target thumbv7-apple-watchos3 -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.13 -mios-simulator-version-min=10 \ +// RUN: %clang -target x86_64-apple-darwin -mios-simulator-version-min=10 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.13 -mtvos-simulator-version-min=10 \ +// RUN: %clang -target x86_64-apple-darwin -mtvos-simulator-version-min=10 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.13 -mwatchos-simulator-version-min=3 \ +// RUN: %clang -target x86_64-apple-darwin -mwatchos-simulator-version-min=3 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // @@ -39,15 +39,15 @@ // RUN: %clang -target x86_64-unknown-linux-gnu -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.12 -mios-simulator-version-min=11 \ +// RUN: %clang -target x86_64-apple-darwin -mios-simulator-version-min=11 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.12 -mtvos-simulator-version-min=11 \ +// RUN: %clang -target x86_64-apple-darwin -mtvos-simulator-version-min=11 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // -// RUN: %clang -target x86_64-apple-macosx10.12 -mwatchos-simulator-version-min=4 \ +// RUN: %clang -target x86_64-apple-darwin -mwatchos-simulator-version-min=4 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // Index: test/Driver/pic.c === --- test/Driver/pic.c +++ test/Driver/pic.c @@ -221,19 +221,19 @@ // // Checks for ARM+Apple+IOS including -fapple-kext, -mkernel, and iphoneos // version boundaries. -// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target armv7-apple-ios6 -fapple-kext -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 -// RUN: %clang -c %s -target armv7-apple-ios -mkernel -miphoneos-version-min=6.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target armv7-apple-ios6 -mkernel -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 -// RUN: %clang -c %s -target arm64-apple-ios -mkernel -miphoneos-version-min=7.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target arm64-apple-ios7 -mkernel -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 -// RUN: %clang -x assembler -c %s -target arm64-apple-ios -mkernel -miphoneos-version-min=7.0.0 -no-integrated-as -### 2>&1 \ +// RUN: %clang -x assembler -c %s -target arm64-apple-ios7 -mkernel -no-integrated-as -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-STATIC -// RUN: %clang -c %s -target armv7k-apple-watchos -fapple-kext -mwatchos-version-min=1.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target armv7k-apple-watchos1 -fapple-kext -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 -// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=5.0.0 -### 2>&1 \ +// RUN: %clang -c %s -target armv7-apple-ios5 -fapple-kext -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC -// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -static -### 2>&1 \ +// RUN: %clang -c %s -target armv7-apple-ios6 -fapple-kext -static -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC // RUN: %clang -c %s -target armv7-apple-unknown-macho -static -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC Index: test/Driver/objc-weak.m === --- test/Driver/objc-weak.m +++ test/Driver/objc-weak.m @@ -1,27 +1,27
[PATCH] D40998: [driver][darwin] Take the OS version specified in "-target" as the target OS instead of inferring it from SDK / environment
arphaman added a comment. Preparation refactoring patch: https://reviews.llvm.org/D41035 Repository: rC Clang https://reviews.llvm.org/D40998 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40998: [driver][darwin] Take the OS version specified in "-target" as the target OS instead of inferring it from SDK / environment
dexonsmith requested changes to this revision. dexonsmith added inline comments. This revision now requires changes to proceed. Comment at: lib/Driver/ToolChains/Darwin.cpp:1234-1276 +// The -target option specifies the deployment target when +// -m-version-min is not given and the OS version is present in the +// target. +if (Args.hasArg(options::OPT_target) && getTriple().getOSMajorVersion() && +getTriple().isOSDarwin()) { + unsigned Major, Minor, Micro; + auto RewriteVersionMinArg = [&](options::ID O) -> Arg * { This logic seems to be duplicated from the `-target` handling below. Perhaps this would be simpler if `-target` were processed first. I suggest the following refactoring in an NFC prep patch: - First, check for a `-target` option. If it exists, extract all the bits. - Then, handle the logic for `-arch`, `-m*-version-min`, and `-isysroot` (matching the current semantics, which I think are "override `-target`"). In a follow-up patch, change `-isysroot`/`SDKROOT` not to override a `-target`-specified environment (the semantic change from this patch). After the refactoring, I suspect this will be trivial. We should also warn/error when `-arch` disagrees with `-target`, and likely the same for `-m*-version-min`. I suspect these follow-ups will also be trivial. Comment at: lib/Driver/ToolChains/Darwin.cpp:1273 + default: +llvm_unreachable("invalid Os"); + } I'd spell this `"invalid OS"`. Repository: rC Clang https://reviews.llvm.org/D40998 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40998: [driver][darwin] Take the OS version specified in "-target" as the target OS instead of inferring it from SDK / environment
arphaman created this revision. Herald added a subscriber: javed.absar. The OS version is specified in `-target` should be used instead of the one in an environment variable / SDK name. rdar://35813850 Repository: rC Clang https://reviews.llvm.org/D40998 Files: lib/Driver/ToolChains/Darwin.cpp test/Driver/appletvos-version-min.c test/Driver/darwin-multiarch-arm.c test/Driver/darwin-stdlib.cpp test/Driver/darwin-version.c Index: test/Driver/darwin-version.c === --- test/Driver/darwin-version.c +++ test/Driver/darwin-version.c @@ -12,21 +12,25 @@ // CHECK-VERSION-IOS3: "armv6k-apple-ios3.0.0" // RUN: env IPHONEOS_DEPLOYMENT_TARGET=11.0 \ -// RUN: %clang -target armv7-apple-ios9.0 -c -### %s 2> %t.err +// RUN: %clang -target armv7-apple-ios -c -### %s 2> %t.err // RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-VERSION-IOS4 %s // CHECK-VERSION-IOS4: invalid iOS deployment version 'IPHONEOS_DEPLOYMENT_TARGET=11.0' +// RUN: %clang -target armv7-apple-ios11 -c -### %s 2> %t.err +// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-VERSION-IOS41 %s +// CHECK-VERSION-IOS41: invalid iOS deployment version 'ios11.0.0' + // RUN: %clang -target armv7-apple-ios9.0 -miphoneos-version-min=11.0 -c -### %s 2> %t.err // RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-VERSION-IOS5 %s // CHECK-VERSION-IOS5: invalid iOS deployment version '-miphoneos-version-min=11.0' // RUN: %clang -target i386-apple-darwin -mios-simulator-version-min=11.0 -c -### %s 2> %t.err // RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-VERSION-IOS6 %s // CHECK-VERSION-IOS6: invalid iOS deployment version '-mios-simulator-version-min=11.0' -// RUN: %clang -target armv7-apple-ios11.1 -c -### %s 2>&1 | \ +// RUN: %clang -target armv7-apple-ios10.99.99 -c -### %s 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s -// RUN: %clang -target armv7-apple-ios9 -Wno-missing-sysroot -isysroot SDKs/iPhoneOS11.0.sdk -c -### %s 2>&1 | \ +// RUN: %clang -target armv7-apple-ios -Wno-missing-sysroot -isysroot SDKs/iPhoneOS11.0.sdk -c -### %s 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s // CHECK-VERSION-IOS7: thumbv7-apple-ios10.99.99 @@ -98,33 +102,33 @@ // RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s // RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 IPHONEOS_DEPLOYMENT_TARGET=2.0 \ -// RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: %clang -target armv6-apple-darwin -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS2 %s // RUN: env MACOSX_DEPLOYMENT_TARGET=10.4.10 \ -// RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: %clang -target i386-apple-darwin -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-OSX49 %s // CHECK-VERSION-OSX49: "i386-apple-macosx10.4.10" // RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.3.1 \ -// RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: %clang -target armv6-apple-darwin -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS231 %s // CHECK-VERSION-IOS231: "armv6k-apple-ios2.3.1" // RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 TVOS_DEPLOYMENT_TARGET=8.3.1 \ -// RUN: %clang -target armv7-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: %clang -target armv7-apple-darwin -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-TVOS %s // CHECK-VERSION-TVOS: "thumbv7-apple-tvos8.3.1" // RUN: env TVOS_DEPLOYMENT_TARGET=8.3.1 \ -// RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: %clang -target i386-apple-darwin -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-TVOSSIM %s // CHECK-VERSION-TVOSSIM: "i386-apple-tvos8.3.1-simulator" // RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 WATCHOS_DEPLOYMENT_TARGET=2.0 \ -// RUN: %clang -target armv7-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: %clang -target armv7-apple-darwin -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOS %s // CHECK-VERSION-WATCHOS: "thumbv7-apple-watchos2.0.0" // RUN: env WATCHOS_DEPLOYMENT_TARGET=2.0 \ -// RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: %clang -target i386-apple-darwin -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOSSIM %s // CHECK-VERSION-WATCHOSSIM: "i386-apple-watchos2.0.0-simulator" @@ -139,3 +143,66 @@ // RUN: %clang -target x86_64-apple-watchos4.0 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOS-TARGET %s // CHECK-VERSION-WATCHOS-TARGET: "x86_64-apple-watchos4.0.0-simulator" + + +// Target can specify the OS version: + +// RUN: %clang -target x86_64-apple-darwin14 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-TMAC1 %s +// CHECK-VERSION-TMAC1: "x86_64-apple-macosx10.10.0" + +// RUN: %clang -target