mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] Kill off _isUniquelyReferenced
It was doing an unsafeBitCast and possibly not managing lifetimes; replace it with more-typesafe and memory-safe calls where possible. Swift SVN r22779
This commit is contained in:
@@ -724,6 +724,15 @@ unsigned char swift::_swift_isUniquelyReferenced_nonNull_native(
|
||||
return object->refCount < 2 * RC_INTERVAL;
|
||||
}
|
||||
|
||||
// Given a non-@objc object reference, return true iff the
|
||||
// object has a strong reference count of 1.
|
||||
unsigned char swift::_swift_isUniquelyReferenced_native(
|
||||
const HeapObject* object
|
||||
) {
|
||||
return object != nullptr
|
||||
&& _swift_isUniquelyReferenced_nonNull_native(object);
|
||||
}
|
||||
|
||||
// Given a non-nil object reference, return true iff the object is a
|
||||
// native swift object with strong reference count of 1.
|
||||
unsigned char swift::_swift_isUniquelyReferencedNonObjC_nonNull(
|
||||
|
||||
Reference in New Issue
Block a user