@@ -354,6 +354,23 @@ public struct UnsafePointer<Pointee>: _Pointer {
354354 }
355355 }
356356
357+ /// Obtain a pointer to the stored property referred to by a key path.
358+ ///
359+ /// If the key path represents a computed property,
360+ /// this function will return `nil`.
361+ ///
362+ /// - Parameter property: A `KeyPath` whose `Root` is `Pointee`.
363+ /// - Returns: A pointer to the stored property represented
364+ /// by the key path, or `nil`.
365+ @inlinable
366+ @_alwaysEmitIntoClient
367+ public func pointer< Property> (
368+ to property: KeyPath < Pointee , Property >
369+ ) -> UnsafePointer < Property > ? {
370+ guard let o = property. _storedInlineOffset else { return nil }
371+ return . init( Builtin . gepRaw_Word ( _rawValue, o. _builtinWordValue) )
372+ }
373+
357374 @inlinable // unsafe-performance
358375 internal static var _max : UnsafePointer {
359376 return UnsafePointer (
@@ -1051,6 +1068,40 @@ public struct UnsafeMutablePointer<Pointee>: _Pointer {
10511068 }
10521069 }
10531070
1071+ /// Obtain a pointer to the stored property referred to by a key path.
1072+ ///
1073+ /// If the key path represents a computed property,
1074+ /// this function will return `nil`.
1075+ ///
1076+ /// - Parameter property: A `KeyPath` whose `Root` is `Pointee`.
1077+ /// - Returns: A pointer to the stored property represented
1078+ /// by the key path, or `nil`.
1079+ @inlinable
1080+ @_alwaysEmitIntoClient
1081+ public func pointer< Property> (
1082+ to property: KeyPath < Pointee , Property >
1083+ ) -> UnsafePointer < Property > ? {
1084+ guard let o = property. _storedInlineOffset else { return nil }
1085+ return . init( Builtin . gepRaw_Word ( _rawValue, o. _builtinWordValue) )
1086+ }
1087+
1088+ /// Obtain a mutable pointer to the stored property referred to by a key path.
1089+ ///
1090+ /// If the key path represents a computed property,
1091+ /// this function will return `nil`.
1092+ ///
1093+ /// - Parameter property: A `WritableKeyPath` whose `Root` is `Pointee`.
1094+ /// - Returns: A mutable pointer to the stored property represented
1095+ /// by the key path, or `nil`.
1096+ @inlinable
1097+ @_alwaysEmitIntoClient
1098+ public func pointer< Property> (
1099+ to property: WritableKeyPath < Pointee , Property >
1100+ ) -> UnsafeMutablePointer < Property > ? {
1101+ guard let o = property. _storedInlineOffset else { return nil }
1102+ return . init( Builtin . gepRaw_Word ( _rawValue, o. _builtinWordValue) )
1103+ }
1104+
10541105 @inlinable // unsafe-performance
10551106 internal static var _max : UnsafeMutablePointer {
10561107 return UnsafeMutablePointer (
0 commit comments