Skip to content

Update master branch for Xcode 12 beta #32502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update master to build with Xcode 12 beta
  • Loading branch information
shahmishal committed Jun 22, 2020
commit 272c466e47507c4c6359f30ab8c9ceea5e7c216d
3 changes: 3 additions & 0 deletions benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,11 @@ function (swift_benchmark_compile_archopts)
"-m${triple_platform}-version-min=${ver}"
"-lobjc"
"-L${SWIFT_LIBRARY_PATH}/${BENCH_COMPILE_ARCHOPTS_PLATFORM}"
"-L${sdk}/usr/lib/swift"
"-Xlinker" "-rpath"
"-Xlinker" "${SWIFT_LINK_RPATH}"
"-Xlinker" "-rpath"
"-Xlinker" "/usr/lib/swift"
${bench_library_objects}
${bench_driver_objects}
${ld64_add_ast_path_opts}
Expand Down
2 changes: 2 additions & 0 deletions stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,8 @@ function(_add_swift_target_library_single target name)
list(APPEND library_search_directories "$ENV{SDKROOT}/usr/lib/swift")
endif()

list(APPEND library_search_directories "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/usr/lib/swift")

# Add variant-specific flags.
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
set(build_type "${SWIFT_STDLIB_BUILD_TYPE}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bits = self_type.bits

def Availability(bits):
if bits == 16:
return '@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)'
return '@available(macOS 10.16, iOS 14.0, tvOS 14.0, watchOS 7.0, *)'
return ''
}%

Expand Down
17 changes: 17 additions & 0 deletions stdlib/public/core/Availability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,20 @@ public func _stdlib_isOSVersionAtLeast(
return false._value
#endif
}

#if os(macOS)
// This is a magic entry point known to the compiler. It is called in
// generated code for API availability checking.
@_semantics("availability.osversion")
@_effects(readnone)
public func _stdlib_isOSVersionAtLeastOrVariantVersionAtLeast(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide some explanation for re-introducing this entry point?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is important for distinguishing which version number to use (macOS or iOS) for Apple Silicon Macs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanding on this: this is an entry point that macOS binaries assume is present in the Standard Library. Having it here ensures that this version of the Standard Library remains compatible with such binaries -- including the overlays that are now part of their corresponding framework.

Copy link
Contributor

@gribozavr gribozavr Jun 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanding on this: this is an entry point that macOS binaries assume is present in the Standard Library.

In other words, are you saying that removing this entry point in the past was a mistake because it was already committed to the stable ABI? But why only macOS and not other platforms?

_ major: Builtin.Word,
_ minor: Builtin.Word,
_ patch: Builtin.Word,
_ variantMajor: Builtin.Word,
_ variantMinor: Builtin.Word,
_ variantPatch: Builtin.Word
) -> Builtin.Int1 {
return _stdlib_isOSVersionAtLeast(major, minor, patch)
}
#endif
2 changes: 1 addition & 1 deletion stdlib/public/core/CTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public typealias CLong = Int
public typealias CLongLong = Int64

/// The C '_Float16' type.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public typealias CFloat16 = Float16

/// The C 'float' type.
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4730,7 +4730,7 @@ extension RawRepresentable where RawValue == Float, Self: Decodable {
}
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension Float16: Codable {
/// Creates a new instance by decoding from the given decoder.
///
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/CollectionAlgorithms.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ extension Collection {
/// returns `true`.
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public func subranges(where predicate: (Element) throws -> Bool) rethrows
-> RangeSet<Index>
{
Expand Down Expand Up @@ -267,7 +267,7 @@ extension Collection where Element: Equatable {
/// `element`.
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public func subranges(of element: Element) -> RangeSet<Index> {
subranges(where: { $0 == element })
}
Expand Down
20 changes: 10 additions & 10 deletions stdlib/public/core/DiscontiguousSlice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/// A collection wrapper that provides access to the elements of a collection,
/// indexed by a set of indices.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
@frozen
public struct DiscontiguousSlice<Base: Collection> {
/// The collection that the indexed collection wraps.
Expand All @@ -22,7 +22,7 @@ public struct DiscontiguousSlice<Base: Collection> {
public var subranges: RangeSet<Base.Index>
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension DiscontiguousSlice {
/// A position in an `DiscontiguousSlice`.
@frozen
Expand All @@ -39,10 +39,10 @@ extension DiscontiguousSlice {
}
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension DiscontiguousSlice.Index: Hashable where Base.Index: Hashable {}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension DiscontiguousSlice: Collection {
public typealias SubSequence = Self

Expand Down Expand Up @@ -83,7 +83,7 @@ extension DiscontiguousSlice: Collection {
}
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension DiscontiguousSlice {
public var count: Int {
var c = 0
Expand All @@ -102,7 +102,7 @@ extension DiscontiguousSlice {
}
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension DiscontiguousSlice: BidirectionalCollection
where Base: BidirectionalCollection
{
Expand All @@ -122,7 +122,7 @@ extension DiscontiguousSlice: BidirectionalCollection
}
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension DiscontiguousSlice: MutableCollection where Base: MutableCollection {
public subscript(i: Index) -> Base.Element {
get {
Expand All @@ -145,7 +145,7 @@ extension Collection {
/// - Returns: A collection of the elements at the positions in `subranges`.
///
/// - Complexity: O(1)
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public subscript(subranges: RangeSet<Index>) -> DiscontiguousSlice<Self> {
DiscontiguousSlice(base: self, subranges: subranges)
}
Expand All @@ -162,7 +162,7 @@ extension MutableCollection {
/// - Complexity: O(1) to access the elements, O(*m*) to mutate the
/// elements at the positions in `subranges`, where *m* is the number of
/// elements indicated by `subranges`.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public subscript(subranges: RangeSet<Index>) -> DiscontiguousSlice<Self> {
get {
DiscontiguousSlice(base: self, subranges: subranges)
Expand Down Expand Up @@ -196,7 +196,7 @@ extension Collection {
/// - Returns: A collection of the elements that are not in `subranges`.
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public func removingSubranges(
_ subranges: RangeSet<Index>
) -> DiscontiguousSlice<Self> {
Expand Down
6 changes: 3 additions & 3 deletions stdlib/public/core/FloatingPointParsing.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal func _isspace_clocale(_ u: UTF16.CodeUnit) -> Bool {

//===--- Parsing ----------------------------------------------------------===//
%if bits == 16:
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
%end
extension ${Self}: LosslessStringConvertible {
/// Creates a new instance from the given string.
Expand Down Expand Up @@ -134,7 +134,7 @@ extension ${Self}: LosslessStringConvertible {
%if bits == 16:
self.init(Substring(text))
%else:
if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) {
if #available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *) {
self.init(Substring(text))
} else {
self = 0.0
Expand Down Expand Up @@ -164,7 +164,7 @@ extension ${Self}: LosslessStringConvertible {
// In particular, we still have to export
// _swift_stdlib_strtoXYZ_clocale()
// as ABI to support old compiled code that still requires it.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public init?(_ text: Substring) {
self = 0.0
let success = withUnsafeMutablePointer(to: &self) { p -> Bool in
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/FloatingPointTypes.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RawSignificand = 'UInt' + str(SignificandSize)

def Availability(bits):
if bits == 16:
return '@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)'
return '@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)'
return ''

if Self == 'Float16':
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/IntegerTypes.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ public struct ${Self}
/// `source` must be representable in this type after rounding toward
/// zero.
% if FloatType == 'Float16':
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
% end
@_transparent
public init(_ source: ${FloatType}) {
Expand Down Expand Up @@ -1182,7 +1182,7 @@ public struct ${Self}
///
/// - Parameter source: A floating-point value to convert to an integer.
% if FloatType == 'Float16':
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
% end
@_transparent
public init?(exactly source: ${FloatType}) {
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/Misc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ func _typeName(_ type: Any.Type, qualified: Bool = true) -> String {
UnsafeBufferPointer(start: stringPtr, count: count)).0
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
@_silgen_name("swift_getMangledTypeName")
public func _getMangledTypeName(_ type: Any.Type)
-> (UnsafePointer<UInt8>, Int)

/// Returns the mangled name for a given type.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public // SPI
func _mangledTypeName(_ type: Any.Type) -> String? {
let (stringPtr, count) = _getMangledTypeName(type)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/MutableCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ extension MutableCollection {
/// - Returns: The new bounds of the moved elements.
///
/// - Complexity: O(*n* log *n*) where *n* is the length of the collection.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
@discardableResult
public mutating func moveSubranges(
_ subranges: RangeSet<Index>, to insertionPoint: Index
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/RangeReplaceableCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ extension RangeReplaceableCollection {
/// - Parameter subranges: The indices of the elements to remove.
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public mutating func removeSubranges(_ subranges: RangeSet<Index>) {
guard !subranges.isEmpty else {
return
Expand Down Expand Up @@ -1188,7 +1188,7 @@ extension MutableCollection where Self: RangeReplaceableCollection {
/// - Parameter subranges: The indices of the elements to remove.
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public mutating func removeSubranges(_ subranges: RangeSet<Index>) {
guard let firstRange = subranges.ranges.first else {
return
Expand Down
14 changes: 7 additions & 7 deletions stdlib/public/core/RangeSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
///
/// numbers.moveSubranges(negativeSubranges, to: 0)
/// // numbers == [-5, -3, -9, 10, 12, 14, 15]
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public struct RangeSet<Bound: Comparable> {
internal var _ranges = _RangeSetStorage<Bound>()

Expand Down Expand Up @@ -238,15 +238,15 @@ public struct RangeSet<Bound: Comparable> {
}
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension RangeSet: Equatable {}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension RangeSet: Hashable where Bound: Hashable {}

// MARK: - Range Collection

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension RangeSet {
/// A collection of the ranges that make up a range set.
public struct Ranges: RandomAccessCollection {
Expand All @@ -271,7 +271,7 @@ extension RangeSet {

// MARK: - Collection APIs

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension RangeSet {
/// Creates a new range set containing ranges that contain only the
/// specified indices in the given collection.
Expand Down Expand Up @@ -365,7 +365,7 @@ extension RangeSet {

// These methods only depend on the ranges that comprise the range set, so
// we can provide them even when we can't provide `SetAlgebra` conformance.
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension RangeSet {
/// Adds the contents of the given range set to this range set.
///
Expand Down Expand Up @@ -549,7 +549,7 @@ extension RangeSet {
}
}

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
extension RangeSet: CustomStringConvertible {
public var description: String {
let rangesDescription = _ranges
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/Runtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ internal func _float16ToStringImpl(
_ debug: Bool
) -> Int

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
internal func _float16ToString(
_ value: Float16,
debug: Bool
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/SIMDVectorTypes.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ extension ${Self}: SIMDScalar {

%for (Self, bits) in [('Float16',16), ('Float',32), ('Double',64)]:
%if bits == 16:
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
%end
extension ${Self} : SIMDScalar {

Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ extension String {
/// memory with room for `capacity` UTF-8 code units, initializes
/// that memory, and returns the number of initialized elements.
@inline(__always)
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public init(
unsafeUninitializedCapacity capacity: Int,
initializingUTF8With initializer: (
Expand Down
2 changes: 1 addition & 1 deletion test/ClangImporter/cfuncs_parse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func test_powl() {
}
#endif

@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
@available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
func test_f16() {
var x = Float16.zero
f16ptrfunc(&x)
Expand Down
2 changes: 1 addition & 1 deletion test/Driver/verbose.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-linux-gnu -v %s 2>&1 | %FileCheck %s -check-prefix=VERBOSE_CLANG
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-windows-msvc -v %s 2>&1 | %FileCheck %s -check-prefix=VERBOSE_CLANG

// VERBOSE_CLANG: clang{{.*}} -v -o
// VERBOSE_CLANG: clang{{.*}} -v {{.*}}-o
1 change: 1 addition & 0 deletions test/IRGen/class_update_callback_without_fixed_layout.sil
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// RUN: %target-swift-frontend -I %t -emit-ir -enable-library-evolution -O %s -target %target-pre-stable-abi-triple

// REQUIRES: objc_interop
// UNSUPPORTED: OS=iosmac
// UNSUPPORTED: CPU=arm64e

// With the old deployment target, these classes use the 'singleton' metadata
Expand Down
1 change: 1 addition & 0 deletions test/IRGen/eager-class-initialization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir -target %target-pre-stable-abi-triple | %FileCheck %s -DINT=i%target-ptrsize --check-prefix=CHECK --check-prefix=CHECK-OLD

// REQUIRES: objc_interop
// UNSUPPORTED: OS=iosmac
// UNSUPPORTED: CPU=arm64e

// See also eager-class-initialization-stable-abi.swift, for the stable ABI
Expand Down
6 changes: 5 additions & 1 deletion test/Interpreter/SDK/autolinking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ if global() != 42 {

let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: -2)
if dlsym(RTLD_DEFAULT, "global") == nil {
print(String(cString: dlerror()))
if let err = dlerror() {
print(String(cString: err))
} else {
print("Unknown dlsym error")
}
exit(EXIT_FAILURE)
}
#endif
Loading