Skip to content

Commit d764db0

Browse files
committed
[Apple Silicon] Add support for triple and availability canonicalization
1 parent 0c5dc54 commit d764db0

27 files changed

+356
-18
lines changed

include/swift/AST/AvailabilitySpec.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,33 @@ class PlatformVersionConstraintAvailabilitySpec : public AvailabilitySpec {
6868
SourceLoc PlatformLoc;
6969

7070
llvm::VersionTuple Version;
71+
72+
// For macOS Big Sur, we we canonicalize 10.16 to 11.0 for compile-time
73+
// checking since clang canonicalizes availability markup. However, to
74+
// support Beta versions of macOS Big Sur where the OS
75+
// reports 10.16 at run time, we need to compare against 10.16,
76+
//
77+
// This means for:
78+
//
79+
// if #available(macOS 10.16, *) { ... }
80+
//
81+
// we need to keep around both a canonical version for use in compile-time
82+
// checks and an uncanonicalized version for the version to actually codegen
83+
// with.
84+
llvm::VersionTuple RuntimeVersion;
85+
7186
SourceRange VersionSrcRange;
7287

7388
public:
7489
PlatformVersionConstraintAvailabilitySpec(PlatformKind Platform,
7590
SourceLoc PlatformLoc,
7691
llvm::VersionTuple Version,
92+
llvm::VersionTuple RuntimeVersion,
7793
SourceRange VersionSrcRange)
7894
: AvailabilitySpec(AvailabilitySpecKind::PlatformVersionConstraint),
7995
Platform(Platform),
8096
PlatformLoc(PlatformLoc), Version(Version),
97+
RuntimeVersion(RuntimeVersion),
8198
VersionSrcRange(VersionSrcRange) {}
8299

83100
/// The required platform.
@@ -93,6 +110,11 @@ class PlatformVersionConstraintAvailabilitySpec : public AvailabilitySpec {
93110
llvm::VersionTuple getVersion() const { return Version; }
94111
SourceRange getVersionSrcRange() const { return VersionSrcRange; }
95112

113+
// The version to be used in codegen for version comparisons at run time.
114+
// This is required to support beta versions of macOS Big Sur that
115+
// report 10.16 at run time.
116+
llvm::VersionTuple getRuntimeVersion() const { return RuntimeVersion; }
117+
96118
SourceRange getSourceRange() const;
97119

98120
void print(raw_ostream &OS, unsigned Indent) const;

include/swift/AST/PlatformKind.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "swift/Basic/LLVM.h"
2121
#include "swift/Config.h"
2222
#include "llvm/ADT/StringRef.h"
23+
#include "llvm/Support/VersionTuple.h"
2324

2425
namespace swift {
2526

@@ -65,6 +66,9 @@ PlatformKind targetPlatform(LangOptions &LangOpts);
6566
/// an explicit attribute for the child.
6667
bool inheritsAvailabilityFromPlatform(PlatformKind Child, PlatformKind Parent);
6768

69+
llvm::VersionTuple canonicalizePlatformVersion(
70+
PlatformKind platform, const llvm::VersionTuple &version);
71+
6872
} // end namespace swift
6973

7074
#endif

lib/AST/Availability.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ AvailabilityContext ASTContext::getSwiftFutureAvailability() {
375375

376376
if (target.isMacOSX() ) {
377377
return AvailabilityContext(
378-
VersionRange::allGTE(llvm::VersionTuple(10, 99, 0)));
378+
VersionRange::allGTE(llvm::VersionTuple(99, 99, 0)));
379379
} else if (target.isiOS()) {
380380
return AvailabilityContext(
381381
VersionRange::allGTE(llvm::VersionTuple(99, 0, 0)));

lib/AST/PlatformKind.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "llvm/ADT/StringSwitch.h"
2121
#include "llvm/Support/ErrorHandling.h"
2222

23+
2324
using namespace swift;
2425

2526
StringRef swift::platformString(PlatformKind platform) {
@@ -155,3 +156,17 @@ bool swift::inheritsAvailabilityFromPlatform(PlatformKind Child,
155156

156157
return false;
157158
}
159+
160+
llvm::VersionTuple swift::canonicalizePlatformVersion(
161+
PlatformKind platform, const llvm::VersionTuple &version) {
162+
163+
// Canonicalize macOS version for macOS Big Sur to great
164+
// 10.16 as 11.0.
165+
if (platform == PlatformKind::OSX ||
166+
platform == PlatformKind::OSXApplicationExtension) {
167+
return llvm::Triple::getCanonicalVersionForOS(llvm::Triple::MacOSX,
168+
version);
169+
}
170+
171+
return version;
172+
}

lib/Basic/Platform.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ swift::getSwiftRuntimeCompatibilityVersionForTarget(
399399
return llvm::VersionTuple(5, 2);
400400
}
401401
}
402+
} else if (Major == 11) {
403+
return llvm::VersionTuple(5, 3);
402404
}
403405
} else if (Triple.isiOS()) { // includes tvOS
404406
Triple.getiOSVersion(Major, Minor, Micro);

lib/Driver/DarwinToolChains.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "ToolChains.h"
1414

1515
#include "swift/AST/DiagnosticsDriver.h"
16+
#include "swift/AST/PlatformKind.h"
1617
#include "swift/Basic/Dwarf.h"
1718
#include "swift/Basic/LLVM.h"
1819
#include "swift/Basic/Platform.h"
@@ -613,9 +614,12 @@ toolchains::Darwin::addDeploymentTargetArgs(ArgStringList &Arguments,
613614

614615
// The first deployment of arm64 for macOS is version 10.16;
615616
if (triple.isAArch64() && major <= 10 && minor < 16) {
616-
major = 10;
617-
minor = 16;
618-
micro = 0;
617+
llvm::VersionTuple firstMacARM64e(10, 16, 0);
618+
firstMacARM64e = canonicalizePlatformVersion(PlatformKind::OSX,
619+
firstMacARM64e);
620+
major = firstMacARM64e.getMajor();
621+
minor = firstMacARM64e.getMinor().getValueOr(0);
622+
micro = firstMacARM64e.getSubminor().getValueOr(0);
619623
}
620624

621625
// Temporary hack: adjust macOS version passed to the linker from

lib/Parse/ParseDecl.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,20 @@ ParserResult<AvailableAttr> Parser::parseExtendedAvailabilitySpecList(
575575
return nullptr;
576576
}
577577

578+
if (PlatformKind) {
579+
if (!Introduced.empty())
580+
Introduced.Version =
581+
canonicalizePlatformVersion(*PlatformKind, Introduced.Version);
582+
583+
if (!Deprecated.empty())
584+
Deprecated.Version =
585+
canonicalizePlatformVersion(*PlatformKind, Deprecated.Version);
586+
587+
if (!Obsoleted.empty())
588+
Obsoleted.Version =
589+
canonicalizePlatformVersion(*PlatformKind, Obsoleted.Version);
590+
}
591+
578592
auto Attr = new (Context)
579593
AvailableAttr(AtLoc, SourceRange(AttrLoc, Tok.getLoc()),
580594
PlatformKind.getValue(),
@@ -1962,6 +1976,8 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
19621976
continue;
19631977
}
19641978

1979+
Version = canonicalizePlatformVersion(Platform, Version);
1980+
19651981
Attributes.add(new (Context)
19661982
AvailableAttr(AtLoc, AttrRange,
19671983
Platform,

lib/Parse/ParseExpr.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3815,6 +3815,11 @@ Parser::parsePlatformVersionConstraintSpec() {
38153815
// Register the platform name as a keyword token.
38163816
TokReceiver->registerTokenKindChange(PlatformLoc, tok::contextual_keyword);
38173817

3818+
// Keep the original version around for run-time checks to support
3819+
// macOS Big Sur betas that report 10.16 at
3820+
// at run time.
3821+
llvm::VersionTuple RuntimeVersion = Version;
3822+
Version = canonicalizePlatformVersion(*Platform, Version);
38183823
return makeParserResult(new (Context) PlatformVersionConstraintAvailabilitySpec(
3819-
Platform.getValue(), PlatformLoc, Version, VersionRange));
3824+
Platform.getValue(), PlatformLoc, Version, RuntimeVersion, VersionRange));
38203825
}

lib/Sema/DerivedConformanceRawRepresentable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ struct RuntimeVersionCheck {
198198
// platformSpec = "\(attr.platform) \(attr.introduced)"
199199
auto platformSpec = new (C) PlatformVersionConstraintAvailabilitySpec(
200200
Platform, SourceLoc(),
201-
Version, SourceLoc()
201+
Version, Version, SourceLoc()
202202
);
203203

204204
// otherSpec = "*"

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ class TypeRefinementContextBuilder : private ASTWalker {
453453
continue;
454454
}
455455

456-
AvailabilityContext NewConstraint = contextForSpec(Spec);
457-
Query->setAvailableRange(NewConstraint.getOSVersion());
456+
AvailabilityContext NewConstraint = contextForSpec(Spec, false);
457+
Query->setAvailableRange(contextForSpec(Spec, true).getOSVersion());
458458

459459
// When compiling zippered for macCatalyst, we need to collect both
460460
// a macOS version (the target version) and an iOS/macCatalyst version
@@ -464,7 +464,8 @@ class TypeRefinementContextBuilder : private ASTWalker {
464464
if (Context.LangOpts.TargetVariant) {
465465
AvailabilitySpec *VariantSpec =
466466
bestActiveSpecForQuery(Query, /*ForTargetVariant*/ true);
467-
VersionRange VariantRange = contextForSpec(VariantSpec).getOSVersion();
467+
VersionRange VariantRange =
468+
contextForSpec(VariantSpec, true).getOSVersion();
468469
Query->setVariantAvailableRange(VariantRange);
469470
}
470471

@@ -594,13 +595,19 @@ class TypeRefinementContextBuilder : private ASTWalker {
594595
}
595596

596597
/// Return the availability context for the given spec.
597-
AvailabilityContext contextForSpec(AvailabilitySpec *Spec) {
598+
AvailabilityContext contextForSpec(AvailabilitySpec *Spec,
599+
bool GetRuntimeContext) {
598600
if (isa<OtherPlatformAvailabilitySpec>(Spec)) {
599601
return AvailabilityContext::alwaysAvailable();
600602
}
601603

602604
auto *VersionSpec = cast<PlatformVersionConstraintAvailabilitySpec>(Spec);
603-
return AvailabilityContext(VersionRange::allGTE(VersionSpec->getVersion()));
605+
606+
llvm::VersionTuple Version = (GetRuntimeContext ?
607+
VersionSpec->getRuntimeVersion() :
608+
VersionSpec->getVersion());
609+
610+
return AvailabilityContext(VersionRange::allGTE(Version));
604611
}
605612

606613
Expr *walkToExprPost(Expr *E) override {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
__attribute__((availability(macosx,introduced=10.16)))
2+
void FunctionIntroducedIn10_16();
3+
4+
__attribute__((availability(macosx,introduced=11.0)))
5+
void FunctionIntroducedIn11_0();
6+
7+
__attribute__((availability(macosx_app_extension,introduced=10.16)))
8+
void FunctionIntroducedIn10_16AppExt();
9+
10+
__attribute__((availability(macosx_app_extension,introduced=11.0)))
11+
void FunctionIntroducedIn11_0AppExt();

test/ClangImporter/Inputs/custom-modules/module.map

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ module BlocksReturningBool {
221221
header "BlocksReturningBool.h"
222222
}
223223

224+
module MacOSVersionCanonicalization {
225+
header "MacOSVersionCanonicalization.h"
226+
}
227+
224228
module Warnings1 { header "Warnings1.h" }
225229
module Warnings2 { header "Warnings2.h" }
226230
module Warnings3 { header "Warnings3.h" }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules -target x86_64-apple-macosx10.15 %s
2+
3+
// REQUIRES: OS=macosx
4+
5+
import MacOSVersionCanonicalization
6+
7+
FunctionIntroducedIn10_16()
8+
// expected-error@-1 {{'FunctionIntroducedIn10_16()' is only available in macOS 11.0 or newer}}
9+
// expected-note@-2 {{add 'if #available' version check}}
10+
11+
FunctionIntroducedIn11_0()
12+
// expected-error@-1 {{'FunctionIntroducedIn11_0()' is only available in macOS 11.0 or newer}}
13+
// expected-note@-2 {{add 'if #available' version check}}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules -target x86_64-apple-macosx10.15 -application-extension %s
2+
3+
// REQUIRES: OS=macosx
4+
5+
import MacOSVersionCanonicalization
6+
7+
FunctionIntroducedIn10_16AppExt()
8+
// expected-error@-1 {{'FunctionIntroducedIn10_16AppExt()' is only available in application extensions for macOS 11.0 or newer}}
9+
// expected-note@-2 {{add 'if #available' version check}}
10+
11+
FunctionIntroducedIn11_0AppExt()
12+
// expected-error@-1 {{'FunctionIntroducedIn11_0AppExt()' is only available in application extensions for macOS 11.0 or newer}}
13+
// expected-note@-2 {{add 'if #available' version check}}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -typecheck %s -enable-library-evolution -emit-module-interface-path %t/Module.swiftinterface -experimental-skip-non-inlinable-function-bodies
3+
// RUN: %FileCheck %s --check-prefixes CHECK < %t/Module.swiftinterface
4+
5+
// REQUIRES: OS=macosx
6+
7+
@available(macOS 10.16, *)
8+
public func introduced10_16() { }
9+
// CHECK: @available(OSX 11.0, *)
10+
// CHECK-NEXT: public func introduced10_16()
11+
12+
13+
@available(OSX 11.0, *)
14+
public func introduced11_0() { }
15+
// CHECK-NEXT: @available(OSX 11.0, *)
16+
// CHECK-NEXT: public func introduced11_0()
17+
18+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %empty-directory(%t)
2+
//
3+
//
4+
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -swift-version 4 -typecheck -verify %s -F %S/Inputs/mock-sdk -enable-objc-interop -disable-objc-attr-requires-foundation-module
5+
//
6+
// RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -swift-version 4 -skip-deinit=false -print-ast-typechecked -source-filename %s -F %S/Inputs/mock-sdk -function-definitions=false -prefer-type-repr=false -print-implicit-attrs=true -enable-objc-interop -disable-objc-attr-requires-foundation-module > %t.printed.txt
7+
// RUN: %FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
8+
9+
10+
// FIXME: rdar://problem/19648117 Needs splitting objc parts out
11+
// REQUIRES: objc_interop
12+
13+
@available(iOS 10.16, OSX 10.16, *)
14+
func introduced10_16() {}
15+
// PASS_COMMON: {{^}}@available(iOS 10.16, OSX 11.0, *){{$}}
16+
// PASS_COMMON-NEXT: {{^}}func introduced10_16(){{$}}

test/IRGen/conditional_conformances_gettypemetdatabyname.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
// RUN: %target-swift-frontend -disable-generic-metadata-prespecialization -target %target-cpu-apple-macosx10.99 -emit-ir %S/../Inputs/conditional_conformance_basic_conformances.swift | %FileCheck %S/../Inputs/conditional_conformance_basic_conformances.swift --check-prefix=TYPEBYNAME
2-
// RUN: %target-swift-frontend -prespecialize-generic-metadata -target %target-cpu-apple-macosx10.99 -emit-ir %S/../Inputs/conditional_conformance_basic_conformances.swift | %FileCheck %S/../Inputs/conditional_conformance_basic_conformances.swift --check-prefix=TYPEBYNAME_PRESPECIALIZED
1+
// RUN: %target-swift-frontend -disable-generic-metadata-prespecialization -target %target-cpu-apple-macosx10.15.4 -emit-ir %S/../Inputs/conditional_conformance_basic_conformances.swift | %FileCheck %S/../Inputs/conditional_conformance_basic_conformances.swift --check-prefix=TYPEBYNAME
2+
// RUN: %target-swift-frontend -prespecialize-generic-metadata -target %target-cpu-apple-macosx99.99 -emit-ir %S/../Inputs/conditional_conformance_basic_conformances.swift | %FileCheck %S/../Inputs/conditional_conformance_basic_conformances.swift --check-prefix=TYPEBYNAME_PRESPECIALIZED
3+
// RUN: %target-swift-frontend -target %target-cpu-apple-macosx10.15.4 -emit-ir %S/../Inputs/conditional_conformance_basic_conformances.swift | %FileCheck %S/../Inputs/conditional_conformance_basic_conformances.swift --check-prefix=CHECK --check-prefix=CHECK-STABLE-ABI-TRUE
4+
35

46
// Too many pointer-sized integers in the IR
57
// REQUIRES: PTRSIZE=64

test/IRGen/generic_metatypes_future.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
// RUN: %swift -prespecialize-generic-metadata -module-name generic_metatypes -target x86_64-apple-macosx10.99 -emit-ir -disable-legacy-type-info -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 -DINT=i64 %s
2+
// RUN: %swift -prespecialize-generic-metadata -module-name generic_metatypes -target x86_64-apple-macosx50.99 -emit-ir -disable-legacy-type-info -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 -DINT=i64 %s
33
// RUN: %swift -prespecialize-generic-metadata -module-name generic_metatypes -target x86_64-apple-ios99.0 -emit-ir -disable-legacy-type-info -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 -DINT=i64 %s
44
// RUN: %swift -prespecialize-generic-metadata -module-name generic_metatypes -target x86_64-apple-tvos99.0 -emit-ir -disable-legacy-type-info -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 -DINT=i64 %s
55
// RUN: %swift -prespecialize-generic-metadata -module-name generic_metatypes -target i386-apple-watchos9.99 -emit-ir -disable-legacy-type-info -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 -DINT=i32 %s

test/IRGen/osx-targets.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// RUN: %swift %s -emit-ir | %FileCheck %s
2-
// RUN: %swift -target %target-cpu-apple-macosx10.51 %s -emit-ir | %FileCheck -check-prefix=CHECK-SPECIFIC %s
3-
// RUN: %swift -target %target-cpu-apple-darwin55 %s -emit-ir | %FileCheck -check-prefix=CHECK-SPECIFIC %s
2+
// RUN: %swift -target %target-cpu-apple-macosx10.51 %s -emit-ir | %FileCheck -check-prefix=CHECK-SPECIFIC-MAC-10-X %s
3+
// RUN: %swift -target %target-cpu-apple-darwin55 %s -emit-ir | %FileCheck -check-prefix=CHECK-DARWIN-OVER-11 %s
44

55
// REQUIRES: OS=macosx
66

77
// CHECK: target triple = "{{.*}}-apple-macosx10.
8-
// CHECK-SPECIFIC: target triple = "{{.*}}-apple-macosx10.51.0"
8+
// CHECK-SPECIFIC-MAC-10-X: target triple = "{{.*}}-apple-macosx10.51.0"
9+
// CHECK-DARWIN-OVER-11: target triple = "{{.*}}-apple-macosx46.0.0"
910

1011
public func anchor() {}
1112
anchor()
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t %s -disable-objc-attr-requires-foundation-module
3+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/availability_macosx_canonical_versions.swiftmodule -typecheck -emit-objc-header-path %t/availability.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
4+
// RUN: %FileCheck %s < %t/availability.h
5+
// RUN: %check-in-clang %t/availability.h
6+
7+
// REQUIRES: objc_interop
8+
9+
// CHECK-LABEL: @interface Availability{{$}}
10+
// CHECK-NEXT: - (void)alwaysAvailable;
11+
// CHECK-NEXT: - (void)introducedOn10_16
12+
// CHECK-DAG: SWIFT_AVAILABILITY(macos,introduced=11.0)
13+
// CHECK-DAG: SWIFT_AVAILABILITY(ios,introduced=10.16)
14+
15+
@objc class Availability {
16+
@objc func alwaysAvailable() {}
17+
@available(macOS 10.16, *)
18+
@available(iOS, introduced: 10.16)
19+
@objc func introducedOn10_16() {}
20+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %target-swift-emit-silgen %s -target x86_64-apple-macosx10.52 -target-variant x86_64-apple-ios50.0-macabi | %FileCheck %s
2+
// RUN: %target-swift-emit-silgen %s -target x86_64-apple-ios50.0-macabi -target-variant x86_64-apple-macosx10.52 | %FileCheck %s
3+
4+
5+
// REQUIRES: maccatalyst_support
6+
7+
// CHECK-LABEL: sil{{.+}}@main{{.*}} {
8+
9+
10+
// Test for the runtime non-canonical version hack for canonical macOS versioning.
11+
// This will eventually change to be the correctly canonicalized version.
12+
13+
// CHECK: [[MACOS_MAJOR:%.*]] = integer_literal $Builtin.Word, 10
14+
// CHECK: [[MACOS_MINOR:%.*]] = integer_literal $Builtin.Word, 16
15+
// CHECK: [[MACOS_PATCH:%.*]] = integer_literal $Builtin.Word, 0
16+
// CHECK: [[IOS_MAJOR:%.*]] = integer_literal $Builtin.Word, 51
17+
// CHECK: [[IOS_MINOR:%.*]] = integer_literal $Builtin.Word, 1
18+
// CHECK: [[IOS_PATCH:%.*]] = integer_literal $Builtin.Word, 2
19+
// CHECK: [[FUNC:%.*]] = function_ref @$ss042_stdlib_isOSVersionAtLeastOrVariantVersiondE0yBi1_Bw_BwBwBwBwBwtF : $@convention(thin) (Builtin.Word, Builtin.Word, Builtin.Word, Builtin.Word, Builtin.Word, Builtin.Word) -> Builtin.Int1
20+
// CHECK: [[QUERY_RESULT:%.*]] = apply [[FUNC]]([[MACOS_MAJOR]], [[MACOS_MINOR]], [[MACOS_PATCH]], [[IOS_MAJOR]], [[IOS_MINOR]], [[IOS_PATCH]]) : $@convention(thin) (Builtin.Word, Builtin.Word, Builtin.Word, Builtin.Word, Builtin.Word, Builtin.Word) -> Builtin.Int1
21+
if #available(OSX 10.16, iOS 51.1.2, *) {
22+
}

0 commit comments

Comments
 (0)