Files
swift-mirror/test/SILOptimizer/moveonly_addressable_implicit_read.swift
Joe Groff cbc7b2b92d SILGen: Mark lazily-allocated addressable representation buffers for move checking.
Move-only code generation based on the location may lead to SILGen emitting loads and copies out
of the addressable memory location that need to be checked and eliminated by the move checker.

Fixes rdar://179022026.
2026-06-08 12:42:39 -07:00

22 lines
810 B
Swift

// RUN: %target-swift-frontend -enable-experimental-feature Lifetimes -enable-experimental-feature AddressableTypes -emit-sil %s | %FileCheck %s
// REQUIRES: swift_feature_Lifetimes
// REQUIRES: swift_feature_AddressableTypes
public struct Butt: ~Copyable, ~Escapable {
// The compiler will synthesize an implicit `_read` coroutine for external
// users of this property. This test ensures that the generated code is
// properly move-checked.
// CHECK-LABEL: sil{{.*}} @${{.*}}4ButtV3foo{{.*}}vr
// CHECK: bb0([[SELF:%.*]] : $Butt):
// CHECK: [[FOO:%.*]] = struct_extract [[SELF]]
// CHECK: yield [[FOO]]
public let foo: Tubb
}
@_addressableForDependencies
public struct Tubb: ~Copyable, ~Escapable {
var x: AnyObject
@_lifetime(immortal) init() { fatalError() }
}