Skip to content

Commit fd55109

Browse files
authored
Merge pull request #17001 from apple/swift-4.2-xcode-10-beta-1
Update 4.2 to build with Xcode 10 beta 1, OS X 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs.
2 parents a2bd556 + 2311c34 commit fd55109

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+6404
-159
lines changed

apinotes/os.apinotes

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Typedefs:
66
Availability: nonswift
77
- Name: os_log_t
88
Availability: nonswift
9+
- Name: os_signpost_type_t
10+
SwiftName: OSSignpostType
911
Classes:
1012
- Name: OS_os_log
1113
SwiftName: OSLog
@@ -20,10 +22,22 @@ Enumerators:
2022
SwiftPrivate: true
2123
- Name: OS_LOG_TYPE_FAULT
2224
SwiftPrivate: true
25+
- Name: OS_SIGNPOST_INTERVAL_BEGIN
26+
SwiftPrivate: true
27+
- Name: OS_SIGNPOST_INTERVAL_END
28+
SwiftPrivate: true
29+
- Name: OS_SIGNPOST_EVENT
30+
SwiftPrivate: true
2331
Functions:
2432
- Name: _os_log_impl
2533
Availability: nonswift
2634
AvailabilityMsg: 'Use os_log'
35+
- Name: _os_log_error_impl
36+
Availability: nonswift
37+
AvailabilityMsg: 'Use os_log'
38+
- Name: _os_log_fault_impl
39+
Availability: nonswift
40+
AvailabilityMsg: 'Use os_log'
2741
- Name: _os_log_sensitive_deprecated
2842
Availability: nonswift
2943
- Name: _os_trace_with_buffer
@@ -40,3 +54,14 @@ Functions:
4054
NullabilityOfRet: N
4155
- Name: os_log_is_debug_enabled
4256
Availability: nonswift
57+
- Name: os_signpost_enabled
58+
SwiftPrivate: true
59+
- Name: os_signpost_id_generate
60+
SwiftPrivate: true
61+
NullabilityOfRet: O
62+
- Name: os_signpost_id_make_with_pointer
63+
SwiftPrivate: true
64+
NullabilityOfRet: O
65+
- Name: _os_signpost_emit_with_name_impl
66+
Availability: nonswift
67+
AvailabilityMsg: 'Use os_signpost'

lib/Driver/Driver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,14 +1195,14 @@ static bool isSDKTooOld(StringRef sdkPath, clang::VersionTuple minVersion,
11951195
/// the given target.
11961196
static bool isSDKTooOld(StringRef sdkPath, const llvm::Triple &target) {
11971197
if (target.isMacOSX()) {
1198-
return isSDKTooOld(sdkPath, clang::VersionTuple(10, 13), "OSX");
1198+
return isSDKTooOld(sdkPath, clang::VersionTuple(10, 14), "OSX");
11991199

12001200
} else if (target.isiOS()) {
12011201
// Includes both iOS and TVOS.
1202-
return isSDKTooOld(sdkPath, clang::VersionTuple(11, 0), "Simulator", "OS");
1202+
return isSDKTooOld(sdkPath, clang::VersionTuple(12, 0), "Simulator", "OS");
12031203

12041204
} else if (target.isWatchOS()) {
1205-
return isSDKTooOld(sdkPath, clang::VersionTuple(4, 0), "Simulator", "OS");
1205+
return isSDKTooOld(sdkPath, clang::VersionTuple(5, 0), "Simulator", "OS");
12061206

12071207
} else {
12081208
return false;

stdlib/public/SDK/ARKit/ARKit.swift

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,41 @@ extension ARCamera {
7373
return .limited(reason)
7474
}
7575
}
76+
77+
@available(iOS, introduced: 12.0)
78+
@nonobjc
79+
public func unprojectPoint(
80+
_ point: CGPoint,
81+
ontoPlane planeTransform: simd_float4x4,
82+
orientation: UIInterfaceOrientation,
83+
viewportSize: CGSize
84+
) -> simd_float3? {
85+
let result = __unprojectPoint(
86+
point,
87+
ontoPlaneWithTransform: planeTransform,
88+
orientation: orientation,
89+
viewportSize: viewportSize)
90+
if result.x.isNaN || result.y.isNaN || result.z.isNaN {
91+
return nil
92+
}
93+
94+
return result
95+
}
96+
}
97+
98+
@available(iOS, introduced: 12.0)
99+
extension ARSCNView {
100+
@nonobjc public func unprojectPoint(
101+
_ point: CGPoint, ontoPlane planeTransform: simd_float4x4
102+
) -> simd_float3? {
103+
let result = __unprojectPoint(
104+
point, ontoPlaneWithTransform: planeTransform)
105+
if result.x.isNaN || result.y.isNaN || result.z.isNaN {
106+
return nil
107+
}
108+
109+
return result
110+
}
76111
}
77112

78113
@available(iOS, introduced: 11.0)

stdlib/public/SDK/AVFoundation/AVError.swift

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,35 @@ import Foundation
1616

1717
extension AVError {
1818
/// The device name.
19-
public var device: String? {
20-
return userInfo[AVErrorDeviceKey] as? String
19+
#if os(tvOS)
20+
@available(*, unavailable)
21+
public var device: String? { return nil }
22+
#else
23+
@available(swift, obsoleted: 4.2, message: "Use `device: AVCaptureDevice?` instead")
24+
public var device: String? { return nil }
25+
26+
@available(swift, introduced: 4.2)
27+
public var device: AVCaptureDevice? {
28+
return userInfo[AVErrorDeviceKey] as? AVCaptureDevice
2129
}
30+
#endif
2231

2332
/// The time.
2433
public var time: CMTime? {
25-
return userInfo[AVErrorTimeKey] as? CMTime
34+
if let time = userInfo[AVErrorTimeKey] as? CMTime {
35+
return time
36+
}
37+
else if let timeDictionary = userInfo[AVErrorTimeKey] {
38+
return CMTimeMakeFromDictionary((timeDictionary as! CFDictionary))
39+
}
40+
else {
41+
return nil
42+
}
2643
}
2744

2845
/// The file size.
2946
public var fileSize: Int64? {
30-
return (userInfo[AVErrorFileSizeKey] as? NSNumber)?.int64Value
47+
return userInfo[AVErrorFileSizeKey] as? Int64
3148
}
3249

3350
/// The process ID number.
@@ -41,13 +58,39 @@ extension AVError {
4158
}
4259

4360
/// The media type.
44-
public var mediaType: String? {
45-
return userInfo[AVErrorMediaTypeKey] as? String
61+
public var mediaType: AVMediaType? {
62+
return userInfo[AVErrorMediaTypeKey] as? AVMediaType
4663
}
4764

4865
/// The media subtypes.
4966
public var mediaSubtypes: [Int]? {
5067
return userInfo[AVErrorMediaSubTypeKey] as? [Int]
5168
}
52-
}
5369

70+
/// The presentation time stamp.
71+
@available(swift, introduced: 4.2)
72+
@available(macOS, introduced: 10.10)
73+
@available(iOS, introduced: 8.0)
74+
@available(tvOS, introduced: 9.0)
75+
public var presentationTimeStamp: CMTime? {
76+
return userInfo[AVErrorPresentationTimeStampKey] as? CMTime
77+
}
78+
79+
/// The persistent track ID.
80+
@available(swift, introduced: 4.2)
81+
@available(macOS, introduced: 10.10)
82+
@available(iOS, introduced: 8.0)
83+
@available(tvOS, introduced: 9.0)
84+
public var persistentTrackID: CMPersistentTrackID? {
85+
return userInfo[AVErrorPersistentTrackIDKey] as? CMPersistentTrackID
86+
}
87+
88+
/// The file type.
89+
@available(swift, introduced: 4.2)
90+
@available(macOS, introduced: 10.10)
91+
@available(iOS, introduced: 8.0)
92+
@available(tvOS, introduced: 9.0)
93+
public var fileType: AVFileType? {
94+
return userInfo[AVErrorFileTypeKey] as? AVFileType
95+
}
96+
}

stdlib/public/SDK/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if(SWIFT_BUILD_STATIC_SDK_OVERLAY)
88
list(APPEND SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES STATIC)
99
endif()
1010

11-
set(all_overlays "Accelerate;AppKit;ARKit;AssetsLibrary;AVFoundation;CallKit;CloudKit;Contacts;CoreAudio;CoreData;CoreFoundation;CoreGraphics;CoreImage;CoreLocation;CoreMedia;CryptoTokenKit;Dispatch;Foundation;GameplayKit;GLKit;HomeKit;IOKit;Intents;MapKit;MediaPlayer;Metal;MetalKit;ModelIO;ObjectiveC;OpenCL;os;Photos;QuartzCore;SafariServices;SceneKit;simd;SpriteKit;UIKit;Vision;WatchKit;XCTest;XPC")
11+
set(all_overlays "Accelerate;AppKit;ARKit;AssetsLibrary;AVFoundation;CallKit;CloudKit;Contacts;CoreAudio;CoreData;CoreFoundation;CoreGraphics;CoreImage;CoreLocation;CoreMedia;CryptoTokenKit;Dispatch;Foundation;GameplayKit;GLKit;HomeKit;IOKit;Intents;MapKit;MediaPlayer;Metal;MetalKit;ModelIO;NaturalLanguage;Network;ObjectiveC;OpenCL;os;Photos;QuartzCore;SafariServices;SceneKit;simd;SpriteKit;UIKit;Vision;WatchKit;XCTest;XPC")
1212

1313
if(DEFINED SWIFT_OVERLAY_TARGETS)
1414
set(overlays_to_build ${SWIFT_OVERLAY_TARGETS})

stdlib/public/SDK/CloudKit/CKError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
@_exported import CloudKit // Clang module
14+
15+
@nonobjc
16+
@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)
17+
extension CKFetchRecordZoneChangesOperation.ZoneConfiguration {
18+
/**
19+
Declares which user-defined keys should be fetched and added to the resulting CKRecords.
20+
21+
If nil, declares the entire record should be downloaded. If set to an empty array, declares that no user fields should be downloaded.
22+
Defaults to nil.
23+
*/
24+
@available(swift 4.2)
25+
public var desiredKeys: [CKRecord.FieldKey]? {
26+
get { return self.__desiredKeys }
27+
set { self.__desiredKeys = newValue }
28+
}
29+
30+
@available(swift 4.2)
31+
public convenience init(previousServerChangeToken: CKServerChangeToken? = nil, resultsLimit: Int? = nil, desiredKeys: [CKRecord.FieldKey]? = nil) {
32+
self.init()
33+
if let previousServerChangeToken = previousServerChangeToken {
34+
self.previousServerChangeToken = previousServerChangeToken
35+
}
36+
if let resultsLimit = resultsLimit {
37+
self.resultsLimit = resultsLimit
38+
}
39+
if let desiredKeys = desiredKeys {
40+
self.desiredKeys = desiredKeys
41+
}
42+
}
43+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
@_exported import CloudKit
14+
15+
// MARK: - Iterate over records
16+
17+
@available(macOS 10.10, iOS 8.0, watchOS 3.0, *)
18+
public struct CKRecordKeyValueIterator : IteratorProtocol {
19+
private var keyArray: [CKRecord.FieldKey]
20+
private var record: CKRecord
21+
private var index: Array<CKRecord.FieldKey>.Index
22+
23+
fileprivate init(_ record: CKRecord) {
24+
self.record = record
25+
keyArray = record.allKeys()
26+
index = keyArray.startIndex
27+
}
28+
29+
public mutating func next() -> (CKRecord.FieldKey, CKRecordValueProtocol)? {
30+
var key: CKRecord.FieldKey? = nil
31+
var objcValue: __CKRecordObjCValue? = nil
32+
while objcValue == nil {
33+
guard index < keyArray.endIndex else { return nil }
34+
key = keyArray[index]
35+
objcValue = record[key!]
36+
index = index.advanced(by: 1)
37+
}
38+
39+
let swiftValue = objcValue!.asSwiftNativeValue()
40+
41+
return (key!, swiftValue)
42+
}
43+
}
44+
45+
@nonobjc
46+
@available(macOS 10.10, iOS 8.0, watchOS 3.0, *)
47+
extension CKRecord : Sequence {
48+
public func makeIterator() -> CKRecordKeyValueIterator {
49+
return CKRecordKeyValueIterator(self)
50+
}
51+
}
52+
53+
@nonobjc
54+
@available(macOS 10.10, iOS 8.0, watchOS 3.0, *)
55+
extension CKRecord {
56+
public typealias RecordType = String
57+
public typealias FieldKey = String
58+
59+
@available(swift 4.2)
60+
public enum SystemType {
61+
public static let userRecord: CKRecord.RecordType = __CKRecordTypeUserRecord as CKRecord.RecordType
62+
@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
63+
public static let share: CKRecord.RecordType = __CKRecordTypeShare as CKRecord.RecordType
64+
}
65+
66+
@available(swift 4.2)
67+
public enum SystemFieldKey {
68+
@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
69+
public static let parent: CKRecord.FieldKey = __CKRecordParentKey as CKRecord.RecordType
70+
@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
71+
public static let share: CKRecord.FieldKey = __CKRecordShareKey as CKRecord.RecordType
72+
}
73+
}
74+

0 commit comments

Comments
 (0)