Skip to content

Commit 41dad35

Browse files
committed
---
yaml --- r: 347626 b: refs/heads/master c: 61dc909 h: refs/heads/master
1 parent 951c3c5 commit 41dad35

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 520a2d7afeca4c51efb1b1020453d509216a113a
2+
refs/heads/master: 61dc9094e6aaed44f6cc0d69f12d15da2e62acab
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/stdlib/public/core/Builtin.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ func _uncheckedUnsafeAssume(_ condition: Bool) {
312312
@usableFromInline
313313
@_silgen_name("_swift_objcClassUsesNativeSwiftReferenceCounting")
314314
internal func _usesNativeSwiftReferenceCounting(_ theClass: AnyClass) -> Bool
315+
316+
/// Returns the class of a non-tagged-pointer Objective-C object
317+
@_effects(readonly)
318+
@_silgen_name("_swift_classOfObjCHeapObject")
319+
internal func _swift_classOfObjCHeapObject(_ object: AnyObject) -> AnyClass
315320
#else
316321
@inlinable
317322
@inline(__always)

trunk/stdlib/public/core/StringBridge.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@ private var kCFStringEncodingUTF8 : _swift_shims_CFStringEncoding {
125125
@inline(__always) get { return 0x8000100 }
126126
}
127127

128-
@_effects(readonly)
129-
private func _unsafeAddressOfCocoaStringClass(_ str: _CocoaString) -> UInt {
130-
return _swift_stdlib_unsafeAddressOfClass(str)
131-
}
132-
133128
internal enum _KnownCocoaString {
134129
case storage
135130
case shared
@@ -148,7 +143,7 @@ internal enum _KnownCocoaString {
148143
}
149144
#endif
150145

151-
switch _unsafeAddressOfCocoaStringClass(str) {
146+
switch unsafeBitCast(_swift_classOfObjCHeapObject(str), to: UInt.self) {
152147
case unsafeBitCast(__StringStorage.self, to: UInt.self):
153148
self = .storage
154149
case unsafeBitCast(__SharedStringStorage.self, to: UInt.self):

trunk/stdlib/public/runtime/SwiftObject.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ static Class _swift_getObjCClassOfAllocated(const void *object) {
177177
class_getInstanceSize(cls), mask));
178178
}
179179

180+
SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_API
181+
Class _swift_classOfObjCHeapObject(OpaqueValue *value) {
182+
return _swift_getObjCClassOfAllocated(value);
183+
}
184+
180185
SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_API
181186
NSString *swift_stdlib_getDescription(OpaqueValue *value,
182187
const Metadata *type);

0 commit comments

Comments
 (0)