mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
`AvailabilityRange` is now being used as a currency type in more of the compiler, and some of those uses are in permanent `ASTContext` allocations. The class wraps the `VersionRange` utility, which is itself a wrapper around `llvm::VersionTuple` with some additional storage for representing sentinel values. Even though the two sentinel values can be be represented with just a single bit of additional storage on top of the 16 bytes required to represent `VersionTuple`, because of alignment requirements the sentinel values end up bloating the layout of `VersionRange` by many bytes. To make `AvailabilityRange` and `VersionRange` more efficient to store, we can instead reserve two unlikely `llvm::VersionTuple` bit patterns as the sentinel values instead. The values chosen are the same ones LLVM uses to represent version tuple tombstones and empty keys in a `DenseMap`.
45 lines
2.0 KiB
Swift
45 lines
2.0 KiB
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
@available(macOS, introduced: 2147483646) // expected-warning {{'2147483646' is not a supported version number}}
|
|
func funcIntroducedInMacOS2147483646() { }
|
|
|
|
@available(macOS 2147483646, *) // expected-warning {{'2147483646' is not a supported version number}}
|
|
func funcIntroducedInMacOS2147483646Short() { }
|
|
|
|
@available(macOS, deprecated: 2147483646) // expected-warning {{'2147483646' is not a supported version number}}
|
|
func funcDeprecatedInMacOS2147483646() { }
|
|
|
|
@available(macOS, obsoleted: 2147483646) // expected-warning {{'2147483646' is not a supported version number}}
|
|
func funcObsoletedInMacOS2147483646() { }
|
|
|
|
@available(macOS, introduced: 2147483647) // expected-warning {{'2147483647' is not a supported version number}}
|
|
func funcIntroducedInMacOS2147483647() { }
|
|
|
|
@available(macOS 2147483647, *) // expected-warning {{'2147483647' is not a supported version number}}
|
|
func funcIntroducedInMacOS2147483647Short() { }
|
|
|
|
@available(macOS, deprecated: 2147483647) // expected-warning {{'2147483647' is not a supported version number}}
|
|
func funcDeprecatedInMacOS2147483647() { }
|
|
|
|
@available(macOS, obsoleted: 2147483647) // expected-warning {{'2147483647' is not a supported version number}}
|
|
func funcObsoletedInMacOS2147483647() { }
|
|
|
|
@available(swift, introduced: 2147483646) // expected-warning {{'2147483646' is not a supported version number}}
|
|
func funcIntroducedInSwift2147483646() { }
|
|
|
|
func useExtremeVersions() {
|
|
if #available(macOS 2147483646, *) { // expected-warning {{'2147483646' is not a supported version number}}
|
|
funcIntroducedInMacOS2147483646()
|
|
funcIntroducedInMacOS2147483646Short()
|
|
funcDeprecatedInMacOS2147483646()
|
|
funcObsoletedInMacOS2147483646()
|
|
}
|
|
if #available(macOS 2147483647, *) { // expected-warning {{'2147483647' is not a supported version number}}
|
|
funcIntroducedInMacOS2147483647()
|
|
funcIntroducedInMacOS2147483647Short()
|
|
funcDeprecatedInMacOS2147483647()
|
|
funcObsoletedInMacOS2147483647()
|
|
}
|
|
funcIntroducedInSwift2147483646()
|
|
}
|