// RUN: %target-swift-frontend -O -Xllvm -sil-print-types -emit-sil -disable-availability-checking %s -enable-builtin-module -enable-experimental-feature RawLayout | %FileCheck %s // REQUIRES: swift_feature_RawLayout import Builtin @frozen @_rawLayout(like: T) public struct Cell: ~Copyable { // CHECK-LABEL: sil {{.*}} @$s4CellAAVAARi_zrlE7addressSpyxGvg : $@convention(method) (@in_guaranteed Cell) -> UnsafeMutablePointer { // CHECK: bb0([[SELF:%.*]] : $*Cell): // CHECK: [[RAW_LAYOUT_ADDR:%.*]] = builtin "addressOfRawLayout">([[SELF]] : $*Cell) : $Builtin.RawPointer // CHECK-NEXT: [[POINTER:%.*]] = struct $UnsafeMutablePointer ([[RAW_LAYOUT_ADDR]] : $Builtin.RawPointer) // CHECK-NEXT: return [[POINTER]] : $UnsafeMutablePointer // CHECK-LABEL: } // end sil function '$s4CellAAVAARi_zrlE7addressSpyxGvg' @_transparent public var address: UnsafeMutablePointer { .init(Builtin.addressOfRawLayout(self)) } // CHECK-LABEL: sil {{.*}} @$s4CellAAVAARi_zrlEyAByxGxcfC : $@convention(method) (@in T, @thin Cell.Type) -> @out Cell { // CHECK: bb0({{%.*}} : $*Cell, [[VALUE:%.*]] : $*T, {{%.*}} : $@thin Cell.Type): // CHECK: {{%.*}} = builtin "prepareInitialization"([[SELF:%.*]] : $*Cell) : $() // CHECK-NEXT: [[RAW_LAYOUT_ADDR:%.*]] = builtin "addressOfRawLayout">([[SELF]] : $*Cell) : $Builtin.RawPointer // CHECK-NEXT: [[POINTER:%.*]] = struct $UnsafeMutablePointer ([[RAW_LAYOUT_ADDR]] : $Builtin.RawPointer) // Calling 'UnsafeMutablePointer.initialize(to:)' // CHECK: {{%.*}} = apply {{%.*}}([[VALUE]], [[POINTER]]) // CHECK-LABEL: } // end sil function '$s4CellAAVAARi_zrlEyAByxGxcfC' @_transparent public init(_ value: consuming T) { address.initialize(to: value) } @inlinable deinit { address.deinitialize(count: 1) } }