Skip to content

Commit 04586e3

Browse files
committed
[stdlib] AutoreleasingUnsafeMutablePointer: Switch subscripts to _read accessors
1 parent b914464 commit 04586e3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

stdlib/public/core/BridgeObjectiveC.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,9 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
374374
/// `Pointee`.
375375
@inlinable
376376
public var pointee: Pointee {
377-
/// Retrieve the value the pointer points to.
378-
@_transparent get {
377+
@_transparent _read {
379378
// We can do a strong load normally.
380-
return UnsafePointer(self).pointee
379+
yield UnsafePointer(self).pointee
381380
}
382381
/// Set the value the pointer points to, copying over the previous value.
383382
///
@@ -414,9 +413,9 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
414413
@inlinable // unsafe-performance
415414
public subscript(i: Int) -> Pointee {
416415
@_transparent
417-
get {
416+
_read {
418417
// We can do a strong load normally.
419-
return (UnsafePointer<Pointee>(self) + i).pointee
418+
yield ((UnsafePointer<Pointee>(self) + i).pointee)
420419
}
421420
}
422421

0 commit comments

Comments
 (0)