Skip to content

Commit 402457b

Browse files
author
Itai Ferber
committed
Annotate Foundation overlay with __shared/__owned
1 parent e3f3e93 commit 402457b

22 files changed

+76
-76
lines changed

stdlib/public/SDK/Foundation/AffineTransform.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public struct AffineTransform : ReferenceConvertible, Hashable, CustomStringConv
3333
self.tY = tY
3434
}
3535

36-
fileprivate init(reference: NSAffineTransform) {
36+
fileprivate init(reference: __shared NSAffineTransform) {
3737
m11 = reference.transformStruct.m11
3838
m12 = reference.transformStruct.m12
3939
m21 = reference.transformStruct.m21

stdlib/public/SDK/Foundation/Boxing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal final class _MutableHandle<MutableType : NSObject>
1919
where MutableType : NSCopying {
2020
fileprivate var _pointer : MutableType
2121

22-
init(reference : MutableType) {
22+
init(reference : __shared MutableType) {
2323
_pointer = reference.copy() as! MutableType
2424
}
2525

stdlib/public/SDK/Foundation/Calendar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public struct Calendar : Hashable, Equatable, ReferenceConvertible, _MutableBoxi
106106
// MARK: -
107107
// MARK: Bridging
108108

109-
fileprivate init(reference : NSCalendar) {
109+
fileprivate init(reference : __shared NSCalendar) {
110110
_handle = _MutableHandle(reference: reference)
111111
if __NSCalendarIsAutoupdating(reference) {
112112
_autoupdating = true

stdlib/public/SDK/Foundation/CharacterSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
415415
}
416416
}
417417

418-
fileprivate init(_bridged characterSet: NSCharacterSet) {
418+
fileprivate init(_bridged characterSet: __shared NSCharacterSet) {
419419
_storage = _CharacterSetStorage(immutableReference: characterSet.copy() as! CFCharacterSet)
420420
}
421421

stdlib/public/SDK/Foundation/Data.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
12201220
/// If the resulting value is mutated, then `Data` will invoke the `mutableCopy()` function on the reference to copy the contents. You may customize the behavior of that function if you wish to return a specialized mutable subclass.
12211221
///
12221222
/// - parameter reference: The instance of `NSData` that you wish to wrap. This instance will be copied by `struct Data`.
1223-
public init(referencing reference: NSData) {
1223+
public init(referencing reference: __shared NSData) {
12241224
#if DEPLOYMENT_RUNTIME_SWIFT
12251225
let providesConcreteBacking = reference._providesConcreteBacking()
12261226
#else

stdlib/public/SDK/Foundation/DateComponents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _Mutab
269269

270270
// MARK: - Bridging Helpers
271271

272-
fileprivate init(reference: NSDateComponents) {
272+
fileprivate init(reference: __shared NSDateComponents) {
273273
_handle = _MutableHandle(reference: reference)
274274
}
275275

stdlib/public/SDK/Foundation/IndexPath.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
684684

685685
// MARK: - Bridging Helpers
686686

687-
fileprivate init(nsIndexPath: ReferenceType) {
687+
fileprivate init(nsIndexPath: __shared ReferenceType) {
688688
let count = nsIndexPath.length
689689
if count == 0 {
690690
_indexes = []

stdlib/public/SDK/Foundation/IndexSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
661661
return _handle.reference
662662
}
663663

664-
fileprivate init(reference: NSIndexSet) {
664+
fileprivate init(reference: __shared NSIndexSet) {
665665
_handle = _MutablePairHandle(reference)
666666
}
667667
}

stdlib/public/SDK/Foundation/JSONEncoder.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ fileprivate struct _JSONEncodingStorage {
387387
return array
388388
}
389389

390-
fileprivate mutating func push(container: NSObject) {
390+
fileprivate mutating func push(container: __owned NSObject) {
391391
self.containers.append(container)
392392
}
393393

@@ -961,7 +961,7 @@ fileprivate class _JSONReferencingEncoder : _JSONEncoder {
961961

962962
/// Initializes `self` by referencing the given dictionary container in the given encoder.
963963
fileprivate init(referencing encoder: _JSONEncoder,
964-
key: CodingKey, convertedKey: CodingKey, wrapping dictionary: NSMutableDictionary) {
964+
key: CodingKey, convertedKey: __shared CodingKey, wrapping dictionary: NSMutableDictionary) {
965965
self.encoder = encoder
966966
self.reference = .dictionary(dictionary, convertedKey.stringValue)
967967
super.init(options: encoder.options, codingPath: encoder.codingPath)
@@ -1273,7 +1273,7 @@ fileprivate struct _JSONDecodingStorage {
12731273
return self.containers.last!
12741274
}
12751275

1276-
fileprivate mutating func push(container: Any) {
1276+
fileprivate mutating func push(container: __owned Any) {
12771277
self.containers.append(container)
12781278
}
12791279

@@ -1616,7 +1616,7 @@ fileprivate struct _JSONKeyedDecodingContainer<K : CodingKey> : KeyedDecodingCon
16161616
return _JSONUnkeyedDecodingContainer(referencing: self.decoder, wrapping: array)
16171617
}
16181618

1619-
private func _superDecoder(forKey key: CodingKey) throws -> Decoder {
1619+
private func _superDecoder(forKey key: __owned CodingKey) throws -> Decoder {
16201620
self.decoder.codingPath.append(key)
16211621
defer { self.decoder.codingPath.removeLast() }
16221622

stdlib/public/SDK/Foundation/Locale.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public struct Locale : Hashable, Equatable, ReferenceConvertible {
5252
_autoupdating = false
5353
}
5454

55-
fileprivate init(reference: NSLocale) {
55+
fileprivate init(reference: __shared NSLocale) {
5656
_wrapped = reference.copy() as! NSLocale
5757
if __NSLocaleIsAutoupdating(reference) {
5858
_autoupdating = true

0 commit comments

Comments
 (0)