File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -318,6 +318,11 @@ func _uncheckedUnsafeAssume(_ condition: Bool) {
318
318
@usableFromInline
319
319
@_silgen_name ( " _swift_objcClassUsesNativeSwiftReferenceCounting " )
320
320
internal func _usesNativeSwiftReferenceCounting( _ theClass: AnyClass ) -> Bool
321
+
322
+ /// Returns the class of a non-tagged-pointer Objective-C object
323
+ @_effects ( readonly)
324
+ @_silgen_name ( " _swift_classOfObjCHeapObject " )
325
+ internal func _swift_class OfObjCHeapObject( _ object: AnyObject ) -> AnyClass
321
326
#else
322
327
@inlinable
323
328
@inline ( __always)
Original file line number Diff line number Diff line change @@ -125,11 +125,6 @@ private var kCFStringEncodingUTF8 : _swift_shims_CFStringEncoding {
125
125
@inline ( __always) get { return 0x8000100 }
126
126
}
127
127
128
- @_effects ( readonly)
129
- private func _unsafeAddressOfCocoaStringClass( _ str: _CocoaString ) -> UInt {
130
- return _swift_stdlib_unsafeAddressOfClass ( str)
131
- }
132
-
133
128
internal enum _KnownCocoaString {
134
129
case storage
135
130
case shared
@@ -148,7 +143,7 @@ internal enum _KnownCocoaString {
148
143
}
149
144
#endif
150
145
151
- switch _unsafeAddressOfCocoaStringClass ( str) {
146
+ switch unsafeBitCast ( _swift_classOfObjCHeapObject ( str) , to : UInt . self ) {
152
147
case unsafeBitCast ( __StringStorage. self, to: UInt . self) :
153
148
self = . storage
154
149
case unsafeBitCast ( __SharedStringStorage. self, to: UInt . self) :
Original file line number Diff line number Diff line change @@ -177,6 +177,11 @@ static Class _swift_getObjCClassOfAllocated(const void *object) {
177
177
class_getInstanceSize (cls), mask));
178
178
}
179
179
180
+ SWIFT_CC (swift) SWIFT_RUNTIME_STDLIB_API
181
+ Class _swift_classOfObjCHeapObject(OpaqueValue *value) {
182
+ return _swift_getObjCClassOfAllocated (value);
183
+ }
184
+
180
185
SWIFT_CC (swift) SWIFT_RUNTIME_STDLIB_API
181
186
NSString *swift_stdlib_getDescription(OpaqueValue *value,
182
187
const Metadata *type);
You can’t perform that action at this time.
0 commit comments