File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -444,9 +444,7 @@ extension UnsafePointer {
444
444
/// - Returns: A pointer to the stored property represented
445
445
/// by the key path, or `nil`.
446
446
@_alwaysEmitIntoClient
447
- #if $Embedded
448
447
@_transparent
449
- #endif
450
448
public func pointer< Property> (
451
449
to property: KeyPath < Pointee , Property >
452
450
) -> UnsafePointer < Property > ? {
@@ -1332,9 +1330,7 @@ extension UnsafeMutablePointer {
1332
1330
/// - Returns: A pointer to the stored property represented
1333
1331
/// by the key path, or `nil`.
1334
1332
@_alwaysEmitIntoClient
1335
- #if $Embedded
1336
1333
@_transparent
1337
- #endif
1338
1334
public func pointer< Property> (
1339
1335
to property: KeyPath < Pointee , Property >
1340
1336
) -> UnsafePointer < Property > ? {
@@ -1356,9 +1352,7 @@ extension UnsafeMutablePointer {
1356
1352
/// - Returns: A mutable pointer to the stored property represented
1357
1353
/// by the key path, or `nil`.
1358
1354
@_alwaysEmitIntoClient
1359
- #if $Embedded
1360
1355
@_transparent
1361
- #endif
1362
1356
public func pointer< Property> (
1363
1357
to property: WritableKeyPath < Pointee , Property >
1364
1358
) -> UnsafeMutablePointer < Property > ? {
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend %s -module-name=test -parse-as-library -emit-sil | %FileCheck %s
2
+
3
+ // REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
4
+
5
+ public struct S {
6
+ var a : Int
7
+ var b : Int
8
+ }
9
+
10
+ // Check that even with -Onone, no keypath is created.
11
+
12
+ // CHECK-LABEL: sil @$s4test6testitySPySiGSgSPyAA1SVGF :
13
+ // CHECK-NOT: keypath
14
+ // CHECK: } // end sil function '$s4test6testitySPySiGSgSPyAA1SVGF'
15
+ public func testit( _ p: UnsafePointer < S > ) -> UnsafePointer < Int > ? {
16
+ return p. pointer ( to: \. b)
17
+ }
You can’t perform that action at this time.
0 commit comments