2015-02-05 02:10:38 +08:00
|
|
|
// RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX %s
|
2015-03-17 19:55:43 +08:00
|
|
|
// CHECK-VERSION-OSX: "armv6k-apple-macosx10.5.0"
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=2.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS2 %s
|
2015-03-17 19:55:43 +08:00
|
|
|
// CHECK-VERSION-IOS2: "armv6k-apple-ios2.0.0"
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=2.2 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS22 %s
|
2015-03-17 19:55:43 +08:00
|
|
|
// CHECK-VERSION-IOS22: "armv6k-apple-ios2.2.0"
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=3.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS3 %s
|
2015-03-17 19:55:43 +08:00
|
|
|
// CHECK-VERSION-IOS3: "armv6k-apple-ios3.0.0"
|
2017-07-01 08:57:52 +08:00
|
|
|
|
|
|
|
// RUN: env IPHONEOS_DEPLOYMENT_TARGET=11.0 \
|
2017-12-20 03:05:04 +08:00
|
|
|
// RUN: %clang -target armv7-apple-darwin -c -### %s 2> %t.err
|
2017-07-01 08:57:52 +08:00
|
|
|
// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-VERSION-IOS4 %s
|
|
|
|
// CHECK-VERSION-IOS4: invalid iOS deployment version 'IPHONEOS_DEPLOYMENT_TARGET=11.0'
|
|
|
|
|
2017-12-20 03:05:04 +08:00
|
|
|
// RUN: %clang -target armv7-apple-ios11.0 -c -### %s 2> %t.err
|
|
|
|
// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-VERSION-IOS41 %s
|
Let unaliased Args track which Alias they were created from, and use that in Arg::getAsString() for diagnostics
With this, `clang-cl /source-charset:utf-16 test.cc` now prints `invalid
value 'utf-16' in '/source-charset:utf-16'` instead of `invalid value
'utf-16' in '-finput-charset=utf-16'` before, and several other clang-cl
flags produce much less confusing output as well.
Fixes PR29106.
Since an arg and its alias can have different arg types (joined vs not)
and different values (because of AliasArgs<>), I chose to give the Alias
its own Arg object. For convenience, I just store the alias directly in
the unaliased arg – there aren't many arg objects at runtime, so that
seems ok.
Finally, I changed Arg::getAsString() to use the alias's representation
if it's present – that function was already documented as being the
suitable function for diagnostics, and most callers already used it for
diagnostics.
Implementation-wise, Arg::accept() previously used to parse things as
the unaliased option. The core of that switch is now extracted into a
new function acceptInternal() which parses as the _aliased_ option, and
the previously-intermingled unaliasing is now done as an explicit step
afterwards.
(This also changes one place in lld that didn't use getAsString() for
diagnostics, so that that one place now also prints the flag as the user
wrote it, not as it looks after it went through unaliasing.)
Differential Revision: https://reviews.llvm.org/D64253
llvm-svn: 365413
2019-07-09 08:34:08 +08:00
|
|
|
// CHECK-VERSION-IOS41: invalid iOS deployment version '-target armv7-apple-ios11.0'
|
2017-12-20 03:05:04 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target armv7-apple-darwin -miphoneos-version-min=11.0 -c -### %s 2> %t.err
|
2017-07-01 08:57:52 +08:00
|
|
|
// 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 | \
|
2017-12-20 03:05:04 +08:00
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS71 %s
|
|
|
|
// CHECK-VERSION-IOS71: invalid iOS deployment version
|
|
|
|
// RUN: %clang -target armv7-apple-darwin -Wno-missing-sysroot -isysroot SDKs/iPhoneOS11.0.sdk -c -### %s 2>&1 | \
|
2017-08-01 06:19:34 +08:00
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS7 %s
|
2017-07-01 08:57:52 +08:00
|
|
|
// CHECK-VERSION-IOS7: thumbv7-apple-ios10.99.99
|
|
|
|
|
|
|
|
// RUN: env IPHONEOS_DEPLOYMENT_TARGET=11.0 \
|
2017-12-20 03:05:04 +08:00
|
|
|
// RUN: %clang -target arm64-apple-darwin -c -### %s 2>&1 | \
|
2017-07-01 08:57:52 +08:00
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS8 %s
|
|
|
|
// CHECK-VERSION-IOS8: arm64-apple-ios11.0.0
|
|
|
|
|
|
|
|
// RUN: %clang -target arm64-apple-ios11.0 -miphoneos-version-min=11.0 -c -### %s 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS9 %s
|
|
|
|
// CHECK-VERSION-IOS9: arm64-apple-ios11.0.0
|
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-darwin -mios-simulator-version-min=11.0 -c -### %s 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS10 %s
|
2017-12-08 03:04:10 +08:00
|
|
|
// CHECK-VERSION-IOS10: x86_64-apple-ios11.0.0-simulator
|
2017-07-01 08:57:52 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target arm64-apple-ios11.1 -c -### %s 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS11 %s
|
|
|
|
// CHECK-VERSION-IOS11: arm64-apple-ios11.1.0
|
2017-08-01 03:16:40 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target armv7-apple-ios9.0 -miphoneos-version-min=11.0 -c -Wno-invalid-ios-deployment-target -### %s 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS12 %s
|
2017-12-20 03:05:04 +08:00
|
|
|
// CHECK-VERSION-IOS12: thumbv7-apple-ios9.0.0
|
2017-07-01 08:57:52 +08:00
|
|
|
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: %clang -target i686-apple-darwin8 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX4 %s
|
|
|
|
// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.4 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX4 %s
|
2021-04-27 05:56:56 +08:00
|
|
|
// CHECK-VERSION-OSX4: "i686-apple-macosx10.4.0"
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: %clang -target i686-apple-darwin9 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s
|
|
|
|
// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.5 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s
|
2021-04-27 05:56:56 +08:00
|
|
|
// CHECK-VERSION-OSX5: "i686-apple-macosx10.5.0"
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: %clang -target i686-apple-darwin10 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX6 %s
|
|
|
|
// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.6 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX6 %s
|
2021-04-27 05:56:56 +08:00
|
|
|
// CHECK-VERSION-OSX6: "i686-apple-macosx10.6.0"
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: %clang -target x86_64-apple-darwin14 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX10 %s
|
2017-12-20 03:05:04 +08:00
|
|
|
// RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.10 -c %s -### 2>&1 | \
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX10 %s
|
2017-12-20 03:05:04 +08:00
|
|
|
// RUN: %clang -target x86_64-apple-darwin -mmacos-version-min=10.10 -c %s -### 2>&1 | \
|
2017-05-05 22:52:48 +08:00
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX10 %s
|
2015-02-05 02:10:38 +08:00
|
|
|
// CHECK-VERSION-OSX10: "x86_64-apple-macosx10.10.0"
|
2017-12-20 03:05:04 +08:00
|
|
|
// RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min= -c %s -### 2>&1 | \
|
2015-04-07 09:03:35 +08:00
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-MISSING %s
|
2017-12-20 03:05:04 +08:00
|
|
|
// RUN: %clang -target x86_64-apple-darwin -mmacos-version-min= -c %s -### 2>&1 | \
|
2017-05-05 22:52:48 +08:00
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-MISSING %s
|
2015-04-07 09:03:35 +08:00
|
|
|
// CHECK-VERSION-MISSING: invalid version number
|
2015-10-31 00:30:27 +08:00
|
|
|
// RUN: %clang -target armv7k-apple-darwin -mwatchos-version-min=2.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOS20 %s
|
|
|
|
// RUN: %clang -target armv7-apple-darwin -mtvos-version-min=8.3 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TVOS83 %s
|
|
|
|
// CHECK-VERSION-TVOS83: "thumbv7-apple-tvos8.3.0"
|
|
|
|
// RUN: %clang -target i386-apple-darwin -mtvos-simulator-version-min=8.3 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TVSIM83 %s
|
2017-12-08 03:04:10 +08:00
|
|
|
// CHECK-VERSION-TVSIM83: "i386-apple-tvos8.3.0-simulator"
|
2015-11-03 05:14:48 +08:00
|
|
|
// RUN: %clang -target armv7k-apple-darwin -mwatchos-version-min=2.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOS20 %s
|
2015-10-31 00:30:27 +08:00
|
|
|
// CHECK-VERSION-WATCHOS20: "thumbv7k-apple-watchos2.0.0"
|
|
|
|
// RUN: %clang -target i386-apple-darwin -mwatchos-simulator-version-min=2.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHSIM20 %s
|
2017-12-08 03:04:10 +08:00
|
|
|
// CHECK-VERSION-WATCHSIM20: "i386-apple-watchos2.0.0-simulator"
|
2009-04-11 05:00:07 +08:00
|
|
|
|
2015-02-05 02:10:38 +08:00
|
|
|
// Check environment variable gets interpreted correctly
|
2015-10-31 00:30:27 +08:00
|
|
|
// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 IPHONEOS_DEPLOYMENT_TARGET=2.0 \
|
2021-04-27 05:56:56 +08:00
|
|
|
// RUN: %clang -target i686-apple-darwin9 -c %s -### 2>&1 | \
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s
|
2015-10-31 00:30:27 +08:00
|
|
|
// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 IPHONEOS_DEPLOYMENT_TARGET=2.0 \
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS2 %s
|
2011-04-22 05:27:33 +08:00
|
|
|
|
|
|
|
// RUN: env MACOSX_DEPLOYMENT_TARGET=10.4.10 \
|
2015-02-05 02:10:38 +08:00
|
|
|
// RUN: %clang -target i386-apple-darwin9 -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: FileCheck --check-prefix=CHECK-VERSION-IOS231 %s
|
2015-03-17 19:55:43 +08:00
|
|
|
// CHECK-VERSION-IOS231: "armv6k-apple-ios2.3.1"
|
2015-10-31 00:30:27 +08:00
|
|
|
|
|
|
|
// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 TVOS_DEPLOYMENT_TARGET=8.3.1 \
|
|
|
|
// RUN: %clang -target armv7-apple-darwin9 -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: FileCheck --check-prefix=CHECK-VERSION-TVOSSIM %s
|
2017-12-08 03:04:10 +08:00
|
|
|
// CHECK-VERSION-TVOSSIM: "i386-apple-tvos8.3.1-simulator"
|
2015-10-31 00:30:27 +08:00
|
|
|
|
|
|
|
// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 WATCHOS_DEPLOYMENT_TARGET=2.0 \
|
|
|
|
// RUN: %clang -target armv7-apple-darwin9 -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: FileCheck --check-prefix=CHECK-VERSION-WATCHOSSIM %s
|
2017-12-08 03:04:10 +08:00
|
|
|
// CHECK-VERSION-WATCHOSSIM: "i386-apple-watchos2.0.0-simulator"
|
2017-07-14 08:21:32 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-ios11.0.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS-TARGET %s
|
2017-12-08 03:04:10 +08:00
|
|
|
// CHECK-VERSION-IOS-TARGET: "x86_64-apple-ios11.0.0-simulator"
|
2017-07-14 08:21:32 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-tvos11.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TVOS-TARGET %s
|
2017-12-08 03:04:10 +08:00
|
|
|
// CHECK-VERSION-TVOS-TARGET: "x86_64-apple-tvos11.0.0-simulator"
|
2017-07-14 08:21:32 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-watchos4.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOS-TARGET %s
|
2017-12-08 03:04:10 +08:00
|
|
|
// CHECK-VERSION-WATCHOS-TARGET: "x86_64-apple-watchos4.0.0-simulator"
|
2017-12-09 10:27:11 +08:00
|
|
|
|
|
|
|
// RUN: env MACOSX_DEPLOYMENT_TARGET=1000.1000 \
|
2017-12-09 10:56:48 +08:00
|
|
|
// RUN: %clang -target x86_64-apple-darwin -c %s -### 2>&1 | \
|
2017-12-09 10:27:11 +08:00
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-INVALID-ENV %s
|
|
|
|
// CHECK-VERSION-INVALID-ENV: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=1000.1000'
|
2017-12-20 03:05:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Target can specify the OS version:
|
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-macos10.11.2 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TMAC2 %s
|
|
|
|
// CHECK-VERSION-TMAC2: "x86_64-apple-macosx10.11.2"
|
|
|
|
|
|
|
|
// RUN: %clang -target arm64-apple-ios11.1 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TIOS1 %s
|
|
|
|
// CHECK-VERSION-TIOS1: "arm64-apple-ios11.1.0"
|
|
|
|
|
|
|
|
// RUN: %clang -target arm64-apple-tvos10.3 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TTVOS1 %s
|
|
|
|
// CHECK-VERSION-TTVOS1: "arm64-apple-tvos10.3.0"
|
|
|
|
|
|
|
|
// RUN: %clang -target armv7k-apple-watchos4.1 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TWATCHOS1 %s
|
|
|
|
// CHECK-VERSION-TWATCHOS1: "thumbv7k-apple-watchos4.1.0"
|
|
|
|
|
|
|
|
// "darwin" always back to the -m<os>version-min and environment:
|
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-darwin14 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TDARWIN-FALL1 %s
|
|
|
|
// CHECK-VERSION-TDARWIN-FALL1: "x86_64-apple-macosx10.10.0"
|
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-darwin14 -miphoneos-version-min=10.1 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TDARWIN-FALL2 %s
|
|
|
|
// CHECK-VERSION-TDARWIN-FALL2: "x86_64-apple-ios10.1.0-simulator"
|
|
|
|
|
|
|
|
// RUN: env IPHONEOS_DEPLOYMENT_TARGET=9.1 \
|
|
|
|
// RUN: %clang -target arm64-apple-darwin14 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TDARWIN-FALL3 %s
|
|
|
|
// CHECK-VERSION-TDARWIN-FALL3: "arm64-apple-ios9.1.0"
|
|
|
|
|
|
|
|
// RUN: %clang -target arm64-apple-darwin14 -isysroot SDKs/iPhoneOS11.0.sdk -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TDARWIN-FALL4 %s
|
|
|
|
// CHECK-VERSION-TDARWIN-FALL4: "arm64-apple-ios11.0.0"
|
|
|
|
|
|
|
|
// RUN: %clang -target unknown-apple-darwin12 -arch armv7 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TDARWIN-FALL5 %s
|
|
|
|
// CHECK-VERSION-TDARWIN-FALL5: "thumbv7-apple-ios5.0.0"
|
|
|
|
|
|
|
|
// Warn about -m<os>-version-min when it's used with target:
|
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-macos10.11.2 -mmacos-version-min=10.6 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TNO-OSV1 %s
|
Let unaliased Args track which Alias they were created from, and use that in Arg::getAsString() for diagnostics
With this, `clang-cl /source-charset:utf-16 test.cc` now prints `invalid
value 'utf-16' in '/source-charset:utf-16'` instead of `invalid value
'utf-16' in '-finput-charset=utf-16'` before, and several other clang-cl
flags produce much less confusing output as well.
Fixes PR29106.
Since an arg and its alias can have different arg types (joined vs not)
and different values (because of AliasArgs<>), I chose to give the Alias
its own Arg object. For convenience, I just store the alias directly in
the unaliased arg – there aren't many arg objects at runtime, so that
seems ok.
Finally, I changed Arg::getAsString() to use the alias's representation
if it's present – that function was already documented as being the
suitable function for diagnostics, and most callers already used it for
diagnostics.
Implementation-wise, Arg::accept() previously used to parse things as
the unaliased option. The core of that switch is now extracted into a
new function acceptInternal() which parses as the _aliased_ option, and
the previously-intermingled unaliasing is now done as an explicit step
afterwards.
(This also changes one place in lld that didn't use getAsString() for
diagnostics, so that that one place now also prints the flag as the user
wrote it, not as it looks after it went through unaliasing.)
Differential Revision: https://reviews.llvm.org/D64253
llvm-svn: 365413
2019-07-09 08:34:08 +08:00
|
|
|
// CHECK-VERSION-TNO-OSV1: overriding '-mmacos-version-min=10.6' option with '-target x86_64-apple-macos10.11.2'
|
2017-12-20 03:05:04 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-macos -miphoneos-version-min=9.1 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TNO-OSV2 %s
|
Let unaliased Args track which Alias they were created from, and use that in Arg::getAsString() for diagnostics
With this, `clang-cl /source-charset:utf-16 test.cc` now prints `invalid
value 'utf-16' in '/source-charset:utf-16'` instead of `invalid value
'utf-16' in '-finput-charset=utf-16'` before, and several other clang-cl
flags produce much less confusing output as well.
Fixes PR29106.
Since an arg and its alias can have different arg types (joined vs not)
and different values (because of AliasArgs<>), I chose to give the Alias
its own Arg object. For convenience, I just store the alias directly in
the unaliased arg – there aren't many arg objects at runtime, so that
seems ok.
Finally, I changed Arg::getAsString() to use the alias's representation
if it's present – that function was already documented as being the
suitable function for diagnostics, and most callers already used it for
diagnostics.
Implementation-wise, Arg::accept() previously used to parse things as
the unaliased option. The core of that switch is now extracted into a
new function acceptInternal() which parses as the _aliased_ option, and
the previously-intermingled unaliasing is now done as an explicit step
afterwards.
(This also changes one place in lld that didn't use getAsString() for
diagnostics, so that that one place now also prints the flag as the user
wrote it, not as it looks after it went through unaliasing.)
Differential Revision: https://reviews.llvm.org/D64253
llvm-svn: 365413
2019-07-09 08:34:08 +08:00
|
|
|
// CHECK-VERSION-TNO-OSV2: overriding '-miphoneos-version-min=9.1' option with '-target x86_64-apple-macos'
|
2017-12-20 10:31:30 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-ios -miphonesimulator-version-min=10.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TNO-OSV3 %s
|
2017-12-30 01:42:40 +08:00
|
|
|
// CHECK-VERSION-TNO-OSV3: "x86_64-apple-ios10.0.0-simulator"
|
|
|
|
// CHECK-VERSION-TNO-OSV3-NOT: overriding '-mios-simulator-version-min
|
2017-12-20 10:31:30 +08:00
|
|
|
// CHECK-VERSION-TNO-OSV3-NOT: argument unused during compilation
|
|
|
|
|
|
|
|
// RUN: %clang -target arm64-apple-ios10.1.0 -miphoneos-version-min=10.1.0.1 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TNO-OSV4 %s
|
Let unaliased Args track which Alias they were created from, and use that in Arg::getAsString() for diagnostics
With this, `clang-cl /source-charset:utf-16 test.cc` now prints `invalid
value 'utf-16' in '/source-charset:utf-16'` instead of `invalid value
'utf-16' in '-finput-charset=utf-16'` before, and several other clang-cl
flags produce much less confusing output as well.
Fixes PR29106.
Since an arg and its alias can have different arg types (joined vs not)
and different values (because of AliasArgs<>), I chose to give the Alias
its own Arg object. For convenience, I just store the alias directly in
the unaliased arg – there aren't many arg objects at runtime, so that
seems ok.
Finally, I changed Arg::getAsString() to use the alias's representation
if it's present – that function was already documented as being the
suitable function for diagnostics, and most callers already used it for
diagnostics.
Implementation-wise, Arg::accept() previously used to parse things as
the unaliased option. The core of that switch is now extracted into a
new function acceptInternal() which parses as the _aliased_ option, and
the previously-intermingled unaliasing is now done as an explicit step
afterwards.
(This also changes one place in lld that didn't use getAsString() for
diagnostics, so that that one place now also prints the flag as the user
wrote it, not as it looks after it went through unaliasing.)
Differential Revision: https://reviews.llvm.org/D64253
llvm-svn: 365413
2019-07-09 08:34:08 +08:00
|
|
|
// CHECK-VERSION-TNO-OSV4: overriding '-miphoneos-version-min=10.1.0.1' option with '-target arm64-apple-ios10.1.0'
|
2017-12-20 10:31:30 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-macos10.6 -mmacos-version-min=10.6 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TNO-SAME %s
|
|
|
|
// CHECK-VERSION-TNO-SAME-NOT: overriding
|
|
|
|
// CHECK-VERSION-TNO-SAME-NOT: argument unused during compilation
|
2017-12-20 03:05:04 +08:00
|
|
|
|
2018-04-06 23:14:32 +08:00
|
|
|
// Target with OS version is not overridden by -m<os>-version-min variables:
|
2017-12-20 03:05:04 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-macos10.11.2 -mmacos-version-min=10.6 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TIGNORE-OSV1 %s
|
|
|
|
// CHECK-VERSION-TIGNORE-OSV1: "x86_64-apple-macosx10.11.2"
|
|
|
|
|
|
|
|
// RUN: %clang -target arm64-apple-ios11.0 -mios-version-min=9.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TIGNORE-OSV2 %s
|
|
|
|
// CHECK-VERSION-TIGNORE-OSV2: "arm64-apple-ios11.0.0"
|
|
|
|
|
|
|
|
// RUN: %clang -target arm64-apple-tvos11.0 -mtvos-version-min=9.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TIGNORE-OSV3 %s
|
|
|
|
// CHECK-VERSION-TIGNORE-OSV3: "arm64-apple-tvos11.0.0"
|
|
|
|
|
|
|
|
// RUN: %clang -target armv7k-apple-watchos3 -mwatchos-version-min=4 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TIGNORE-OSV4 %s
|
|
|
|
// CHECK-VERSION-TIGNORE-OSV4: "thumbv7k-apple-watchos3.0.0"
|
|
|
|
|
2018-04-06 23:14:32 +08:00
|
|
|
// Target without OS version includes the OS given by -m<os>-version-min arguments:
|
2017-12-30 01:42:40 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-macos -mmacos-version-min=10.11 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-USE-OS-ARG1 %s
|
|
|
|
// CHECK-VERSION-USE-OS-ARG1: "x86_64-apple-macosx10.11.0"
|
|
|
|
|
|
|
|
// RUN: %clang -target arm64-apple-ios -mios-version-min=9.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-USE-OS-ARG2 %s
|
|
|
|
// CHECK-VERSION-USE-OS-ARG2: "arm64-apple-ios9.0.0"
|
|
|
|
|
|
|
|
// RUN: %clang -target arm64-apple-tvos -mtvos-version-min=10.0 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-USE-OS-ARG3 %s
|
|
|
|
// CHECK-VERSION-USE-OS-ARG3: "arm64-apple-tvos10.0.0"
|
|
|
|
|
|
|
|
// RUN: %clang -target armv7k-apple-watchos -mwatchos-version-min=4 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-USE-OS-ARG4 %s
|
|
|
|
// CHECK-VERSION-USE-OS-ARG4: "thumbv7k-apple-watchos4.0.0"
|
|
|
|
|
2018-04-06 23:14:32 +08:00
|
|
|
// Target with OS version is not overridden by environment variables:
|
2017-12-20 03:05:04 +08:00
|
|
|
|
|
|
|
// RUN: env MACOSX_DEPLOYMENT_TARGET=10.1 \
|
|
|
|
// RUN: %clang -target i386-apple-macos10.5 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TMACOS-CMD %s
|
|
|
|
// CHECK-VERSION-TMACOS-CMD: "i386-apple-macosx10.5.0"
|
|
|
|
|
|
|
|
// RUN: env IPHONEOS_DEPLOYMENT_TARGET=10.1 \
|
|
|
|
// RUN: %clang -target arm64-apple-ios11 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TIOS-CMD %s
|
|
|
|
// CHECK-VERSION-TIOS-CMD: "arm64-apple-ios11.0.0"
|
|
|
|
|
|
|
|
// RUN: env TVOS_DEPLOYMENT_TARGET=8.3.1 \
|
|
|
|
// RUN: %clang -target arm64-apple-tvos9 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TTVOS-CMD %s
|
|
|
|
// CHECK-VERSION-TTVOS-CMD: "arm64-apple-tvos9.0.0"
|
|
|
|
|
|
|
|
// RUN: env WATCHOS_DEPLOYMENT_TARGET=2 \
|
|
|
|
// RUN: %clang -target armv7k-apple-watchos3 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TWATCHOS-CMD %s
|
|
|
|
// CHECK-VERSION-TWATCHOS-CMD: "thumbv7k-apple-watchos3.0.0"
|
|
|
|
|
2018-04-06 23:14:32 +08:00
|
|
|
// Target with OS version is not overridden by the SDK:
|
2017-12-20 03:05:04 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target armv7-apple-ios9 -Wno-missing-sysroot -isysroot SDKs/iPhoneOS11.0.sdk -c -### %s 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TIOS-SDK %s
|
|
|
|
// CHECK-VERSION-TIOS-SDK: thumbv7-apple-ios9
|
|
|
|
|
|
|
|
// RUN: %clang -target armv7k-apple-watchos4 -Wno-missing-sysroot -isysroot SDKs/WatchOS3.0.sdk -c -### %s 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TWATCHOS-SDK %s
|
|
|
|
// CHECK-VERSION-TWATCHOS-SDK: thumbv7k-apple-watchos4
|
|
|
|
|
|
|
|
// RUN: %clang -target armv7-apple-tvos9 -Wno-missing-sysroot -isysroot SDKs/AppleTVOS11.0.sdk -c -### %s 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TTVOS-SDK %s
|
|
|
|
// CHECK-VERSION-TTVOS-SDK: thumbv7-apple-tvos9
|
|
|
|
|
2018-04-06 23:14:32 +08:00
|
|
|
// Target with OS version is not overridden by arch:
|
2017-12-20 03:05:04 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target uknown-apple-macos10.11.2 -arch=armv7k -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TIGNORE-ARCH1 %s
|
|
|
|
// CHECK-VERSION-TIGNORE-ARCH1: "unknown-apple-macosx10.11.2"
|
2017-12-20 03:56:14 +08:00
|
|
|
|
|
|
|
// Target can be used to specify the environment:
|
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-ios11-simulator -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TENV-SIM1 %s
|
|
|
|
// CHECK-VERSION-TENV-SIM1: "x86_64-apple-ios11.0.0-simulator"
|
|
|
|
|
|
|
|
// RUN: %clang -target armv7k-apple-ios10.1-simulator -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-VERSION-TENV-SIM2 %s
|
|
|
|
// CHECK-VERSION-TENV-SIM2: "thumbv7k-apple-ios10.1.0-simulator"
|
2020-06-24 05:42:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-apple-macos11 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-MACOS11 %s
|
|
|
|
// RUN: %clang -target x86_64-apple-darwin20 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-MACOS11 %s
|
|
|
|
// RUN: %clang -target x86_64-apple-darwin -mmacos-version-min=11 -c %s -### 2>&1 | \
|
|
|
|
// RUN: FileCheck --check-prefix=CHECK-MACOS11 %s
|
|
|
|
|
|
|
|
// CHECK-MACOS11: "x86_64-apple-macosx11.0.0"
|