[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:
Dave Abrahams
2014-10-15 22:25:12 +00:00
parent 4e31ae0a44
commit 56c4cb2d42
9 changed files with 40 additions and 21 deletions

View File

@@ -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(