@@ -420,7 +420,7 @@ extension _StringGuts {
420
420
#if _runtime(_ObjC)
421
421
extension _StringGuts {
422
422
423
- private static var associationKey : UnsafeRawPointer {
423
+ private static var _associationKey : UnsafeRawPointer {
424
424
struct AssociationKey { }
425
425
// We never dereference this, we only use this address as a unique key
426
426
return unsafe unsafeBitCast(
@@ -429,7 +429,7 @@ extension _StringGuts {
429
429
)
430
430
}
431
431
432
- internal func getAssociatedStorage ( ) -> __StringStorage ? {
432
+ private func _getAssociatedStorage ( ) -> __StringStorage ? {
433
433
_internalInvariant ( _object. hasObjCBridgeableObject)
434
434
let getter = unsafe unsafeBitCast(
435
435
getGetAssociatedObjectPtr ( ) ,
@@ -441,7 +441,7 @@ extension _StringGuts {
441
441
442
442
if let assocPtr = unsafe getter(
443
443
_object. objCBridgeableObject,
444
- Self . associationKey
444
+ Self . _associationKey
445
445
) {
446
446
let storage : __StringStorage
447
447
storage = unsafe Unmanaged. fromOpaque ( assocPtr) . takeUnretainedValue ( )
@@ -450,7 +450,7 @@ extension _StringGuts {
450
450
return nil
451
451
}
452
452
453
- internal func setAssociatedStorage ( _ storage: __StringStorage ) {
453
+ private func _setAssociatedStorage ( _ storage: __StringStorage ) {
454
454
_internalInvariant ( _object. hasObjCBridgeableObject)
455
455
let setter = unsafe unsafeBitCast(
456
456
getSetAssociatedObjectPtr ( ) ,
@@ -464,24 +464,24 @@ extension _StringGuts {
464
464
465
465
unsafe setter(
466
466
_object. objCBridgeableObject,
467
- Self . associationKey ,
467
+ Self . _associationKey ,
468
468
storage,
469
469
1 //OBJC_ASSOCIATION_RETAIN_NONATOMIC
470
470
)
471
471
}
472
472
473
- internal func getOrAllocateAssociatedStorage ( ) -> __StringStorage {
473
+ internal func _getOrAllocateAssociatedStorage ( ) -> __StringStorage {
474
474
_internalInvariant ( _object. hasObjCBridgeableObject)
475
475
let unwrapped : __StringStorage
476
476
// libobjc already provides the necessary memory barriers for
477
477
// double checked locking to be safe, per comments on
478
478
// https://github.com/swiftlang/swift/pull/75148
479
- if let storage = getAssociatedStorage ( ) {
479
+ if let storage = _getAssociatedStorage ( ) {
480
480
unwrapped = storage
481
481
} else {
482
482
let lock = _object. objCBridgeableObject
483
483
objc_sync_enter ( lock)
484
- if let storage = getAssociatedStorage ( ) {
484
+ if let storage = _getAssociatedStorage ( ) {
485
485
unwrapped = storage
486
486
} else {
487
487
var contents = String . UnicodeScalarView ( )
@@ -494,7 +494,7 @@ extension _StringGuts {
494
494
}
495
495
_precondition ( contents. _guts. _object. hasNativeStorage)
496
496
unwrapped = ( consume contents) . _guts. _object. nativeStorage
497
- setAssociatedStorage ( unwrapped)
497
+ _setAssociatedStorage ( unwrapped)
498
498
}
499
499
defer { _fixLifetime ( unwrapped) }
500
500
objc_sync_exit ( lock)
0 commit comments