Skip to content

Commit 27998bb

Browse files
committed
---
yaml --- r: 349529 b: refs/heads/master-next c: b497780 h: refs/heads/master i: 349527: 417081d
1 parent 2ef26bb commit 27998bb

23 files changed

+317
-381
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: ff7d2c2503d070f32afd2a87cb42921fffcaa31c
3+
refs/heads/master-next: b4977801b812a81f36c0b6cfecb519f187f8f814
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/include/swift/Runtime/ObjCBridge.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ namespace swift {
7979
SWIFT_RUNTIME_EXPORT
8080
void swift_rootObjCDealloc(HeapObject *self);
8181

82-
// Uses Swift bridging to box a C string into an NSString without introducing
83-
// a link-time dependency on NSString.
84-
SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_API
85-
id swift_stdlib_NSStringFromUTF8(const char *cstr, int len);
86-
8782
}
8883

8984
#endif // SWIFT_OBJC_INTEROP

branches/master-next/stdlib/public/core/BridgeObjectiveC.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,6 @@ public protocol _ObjectiveCBridgeable {
8585

8686
#if _runtime(_ObjC)
8787

88-
@_silgen_name("swift_stdlib_connectNSBaseClasses")
89-
internal func _connectNSBaseClasses() -> Bool
90-
91-
92-
private let _bridgeInitializedSuccessfully = _connectNSBaseClasses()
93-
internal var _orphanedFoundationSubclassesReparented: Bool = false
94-
95-
/// Reparents the SwiftNativeNS*Base classes to be subclasses of their respective
96-
/// Foundation types, or is false if they couldn't be reparented. Must be run
97-
/// in order to bridge Swift Strings, Arrays, Dictionarys, Sets, or Enumerators to ObjC.
98-
internal func _connectOrphanedFoundationSubclassesIfNeeded() -> Void {
99-
let bridgeWorks = _bridgeInitializedSuccessfully
100-
_debugPrecondition(bridgeWorks)
101-
_orphanedFoundationSubclassesReparented = true
102-
}
103-
10488
//===--- Bridging for metatypes -------------------------------------------===//
10589

10690
/// A stand-in for a value of metatype type.

branches/master-next/stdlib/public/core/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ set(swift_core_private_link_libraries)
229229
set(swift_stdlib_compile_flags "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}")
230230
if(SWIFT_PRIMARY_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
231231
list(APPEND swift_core_link_flags "-all_load")
232+
list(APPEND swift_core_framework_depends Foundation)
233+
list(APPEND swift_core_framework_depends CoreFoundation)
232234
list(APPEND swift_core_private_link_libraries icucore)
233235
else()
234236
# With the GNU linker the equivalent of -all_load is to tell the linker

branches/master-next/stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -417,27 +417,13 @@ internal struct _ContiguousArrayBuffer<Element>: _ArrayBufferProtocol {
417417
}
418418

419419
#if _runtime(_ObjC)
420-
421420
/// Convert to an NSArray.
422421
///
423422
/// - Precondition: `Element` is bridged to Objective-C.
424423
///
425424
/// - Complexity: O(1).
426-
@usableFromInline
425+
@inlinable
427426
internal __consuming func _asCocoaArray() -> AnyObject {
428-
// _asCocoaArray was @inlinable in Swift 5.0 and 5.1, which means that there
429-
// are existing apps out there that effectively have the old implementation
430-
// Be careful with future changes to this function. Here be dragons!
431-
// The old implementation was
432-
// if count == 0 {
433-
// return _emptyArrayStorage
434-
// }
435-
// if _isBridgedVerbatimToObjectiveC(Element.self) {
436-
// return _storage
437-
// }
438-
// return __SwiftDeferredNSArray(_nativeStorage: _storage)
439-
440-
_connectOrphanedFoundationSubclassesIfNeeded()
441427
if count == 0 {
442428
return _emptyArrayStorage
443429
}

branches/master-next/stdlib/public/core/DictionaryBridging.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ internal func _stdlib_NSDictionary_allKeys(
2929
extension _NativeDictionary { // Bridging
3030
@usableFromInline
3131
__consuming internal func bridged() -> AnyObject {
32-
_connectOrphanedFoundationSubclassesIfNeeded()
3332
// We can zero-cost bridge if our keys are verbatim
3433
// or if we're the empty singleton.
3534

@@ -68,7 +67,6 @@ final internal class _SwiftDictionaryNSEnumerator<Key: Hashable, Value>
6867

6968
internal init(_ base: __owned _NativeDictionary<Key, Value>) {
7069
_internalInvariant(_isBridgedVerbatimToObjectiveC(Key.self))
71-
_internalInvariant(_orphanedFoundationSubclassesReparented)
7270
self.base = base
7371
self.bridgedKeys = nil
7472
self.nextBucket = base.hashTable.startBucket
@@ -79,7 +77,6 @@ final internal class _SwiftDictionaryNSEnumerator<Key: Hashable, Value>
7977
@nonobjc
8078
internal init(_ deferred: __owned _SwiftDeferredNSDictionary<Key, Value>) {
8179
_internalInvariant(!_isBridgedVerbatimToObjectiveC(Key.self))
82-
_internalInvariant(_orphanedFoundationSubclassesReparented)
8380
self.base = deferred.native
8481
self.bridgedKeys = deferred.bridgeKeys()
8582
self.nextBucket = base.hashTable.startBucket

branches/master-next/stdlib/public/core/Hashing.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ internal struct _UnmanagedAnyObjectArray {
7676
// renamed. The old name must not be used in the new runtime.
7777
final internal class __SwiftEmptyNSEnumerator
7878
: __SwiftNativeNSEnumerator, _NSEnumerator {
79-
internal override required init() {
80-
super.init()
81-
_internalInvariant(_orphanedFoundationSubclassesReparented)
82-
}
79+
internal override required init() { super.init() }
8380

8481
@objc
8582
internal func nextObject() -> AnyObject? {

branches/master-next/stdlib/public/core/ReflectionMirror.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ internal func getChild<T>(of value: T, type: Any.Type, index: Int) -> (label: St
4747
internal func _getQuickLookObject<T>(_: T) -> AnyObject?
4848

4949
@_silgen_name("_swift_stdlib_NSObject_isKindOfClass")
50-
internal func _isImpl(_ object: AnyObject, kindOf: UnsafePointer<CChar>) -> Bool
50+
internal func _isImpl(_ object: AnyObject, kindOf: AnyObject) -> Bool
5151

5252
internal func _is(_ object: AnyObject, kindOf `class`: String) -> Bool {
53-
return `class`.withCString {
54-
return _isImpl(object, kindOf: $0)
55-
}
53+
return _isImpl(object, kindOf: `class` as AnyObject)
5654
}
5755

5856
internal func _getClassPlaygroundQuickLook(

branches/master-next/stdlib/public/core/SetBridging.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,24 @@
1414

1515
import SwiftShims
1616

17+
@_silgen_name("swift_stdlib_CFSetGetValues")
18+
internal
19+
func _stdlib_CFSetGetValues(
20+
_ nss: AnyObject,
21+
_: UnsafeMutablePointer<AnyObject>)
22+
1723
/// Equivalent to `NSSet.allObjects`, but does not leave objects on the
1824
/// autorelease pool.
1925
internal func _stdlib_NSSet_allObjects(_ object: AnyObject) -> _BridgingBuffer {
2026
let nss = unsafeBitCast(object, to: _NSSet.self)
21-
let count = nss.count
22-
let storage = _BridgingBuffer(count)
23-
nss.getObjects(storage.baseAddress, count: count)
27+
let storage = _BridgingBuffer(nss.count)
28+
_stdlib_CFSetGetValues(nss, storage.baseAddress)
2429
return storage
2530
}
2631

2732
extension _NativeSet { // Bridging
2833
@usableFromInline
2934
internal __consuming func bridged() -> AnyObject {
30-
_connectOrphanedFoundationSubclassesIfNeeded()
31-
3235
// We can zero-cost bridge if our keys are verbatim
3336
// or if we're the empty singleton.
3437

@@ -67,7 +70,6 @@ final internal class _SwiftSetNSEnumerator<Element: Hashable>
6770

6871
internal init(_ base: __owned _NativeSet<Element>) {
6972
_internalInvariant(_isBridgedVerbatimToObjectiveC(Element.self))
70-
_internalInvariant(_orphanedFoundationSubclassesReparented)
7173
self.base = base
7274
self.bridgedElements = nil
7375
self.nextBucket = base.hashTable.startBucket
@@ -78,7 +80,6 @@ final internal class _SwiftSetNSEnumerator<Element: Hashable>
7880
@nonobjc
7981
internal init(_ deferred: __owned _SwiftDeferredNSSet<Element>) {
8082
_internalInvariant(!_isBridgedVerbatimToObjectiveC(Element.self))
81-
_internalInvariant(_orphanedFoundationSubclassesReparented)
8283
self.base = deferred.native
8384
self.bridgedElements = deferred.bridgeElements()
8485
self.nextBucket = base.hashTable.startBucket

branches/master-next/stdlib/public/core/ShadowProtocols.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,6 @@ internal protocol _NSSetCore: _NSCopying, _NSFastEnumeration {
171171
/// supplies.
172172
@unsafe_no_objc_tagged_pointer @objc
173173
internal protocol _NSSet: _NSSetCore {
174-
@objc(getObjects:count:) func getObjects(
175-
_ buffer: UnsafeMutablePointer<AnyObject>,
176-
count: Int
177-
)
178174
}
179175

180176
/// A shadow for the API of NSNumber we will use in the core

branches/master-next/stdlib/public/core/StringBridge.swift

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,6 @@ extension String {
442442
@_effects(releasenone)
443443
public // SPI(Foundation)
444444
func _bridgeToObjectiveCImpl() -> AnyObject {
445-
446-
_connectOrphanedFoundationSubclassesIfNeeded()
447-
448445
// Smol ASCII a) may bridge to tagged pointers, b) can't contain a BOM
449446
if _guts.isSmallASCII {
450447
let maybeTagged = _guts.asSmall.withUTF8 { bufPtr in
@@ -456,7 +453,6 @@ extension String {
456453
}
457454
if let tagged = maybeTagged { return tagged }
458455
}
459-
460456
if _guts.isSmall {
461457
// We can't form a tagged pointer String, so grow to a non-small String,
462458
// and bridge that instead. Also avoids CF deleting any BOM that may be
@@ -501,17 +497,6 @@ public func _getDescription<T>(_ x: T) -> AnyObject {
501497
return String(reflecting: x)._bridgeToObjectiveCImpl()
502498
}
503499

504-
@_silgen_name("swift_stdlib_NSStringFromUTF8")
505-
@usableFromInline //this makes the symbol available to the runtime :(
506-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
507-
internal func _NSStringFromUTF8(_ s: UnsafePointer<UInt8>, _ len: Int)
508-
-> AnyObject {
509-
return String(
510-
decoding: UnsafeBufferPointer(start: s, count: len),
511-
as: UTF8.self
512-
)._bridgeToObjectiveCImpl()
513-
}
514-
515500
#else // !_runtime(_ObjC)
516501

517502
internal class __SwiftNativeNSString {

0 commit comments

Comments
 (0)