@@ -354,6 +354,23 @@ public struct UnsafePointer<Pointee>: _Pointer {
354
354
}
355
355
}
356
356
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
+
357
374
@inlinable // unsafe-performance
358
375
internal static var _max : UnsafePointer {
359
376
return UnsafePointer (
@@ -1051,6 +1068,40 @@ public struct UnsafeMutablePointer<Pointee>: _Pointer {
1051
1068
}
1052
1069
}
1053
1070
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
+
1054
1105
@inlinable // unsafe-performance
1055
1106
internal static var _max : UnsafeMutablePointer {
1056
1107
return UnsafeMutablePointer (
0 commit comments