mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
57 lines
2.1 KiB
Plaintext
57 lines
2.1 KiB
Plaintext
// RUN: %target-sil-opt -enable-objc-interop -enable-sil-verify-all=0 -module-name Swift -ownership-dumper -o /dev/null %s | %FileCheck %s
|
|
|
|
// REQUIRES: asserts
|
|
|
|
sil_stage raw
|
|
|
|
import Builtin
|
|
|
|
class Klass {}
|
|
|
|
struct MyInt {
|
|
var i: Builtin.Int32
|
|
}
|
|
|
|
struct MyKlassWrapper {
|
|
var i: Klass
|
|
}
|
|
|
|
// Make sure that we handle undef in an appropriate way. Do to special handling
|
|
// in SIL around undef, we test this using the ownership dumper for simplicity.
|
|
|
|
// CHECK-LABEL: *** Dumping Function: 'undef_addresses_have_any_ownership'
|
|
// CHECK: Visiting: {{.*}}%0 = mark_uninitialized [var] undef : $*Klass
|
|
// CHECK-NEXT: Ownership Constraint:
|
|
// CHECK-NEXT: Op #: 0
|
|
// CHECK-NEXT: Constraint: <Constraint Kind:owned LifetimeConstraint:LifetimeEnding>
|
|
// CHECK: Visiting: {{.*}}%1 = mark_uninitialized [var] undef : $Klass
|
|
// CHECK-NEXT: Ownership Constraint:
|
|
// CHECK-NEXT: Op #: 0
|
|
// CHECK-NEXT: Constraint: <Constraint Kind:owned LifetimeConstraint:LifetimeEnding>
|
|
// CHECK: Visiting: {{.*}}%3 = mark_uninitialized [var] undef : $*Builtin.Int32
|
|
// CHECK-NEXT: Ownership Constraint:
|
|
// CHECK-NEXT: Op #: 0
|
|
// CHECK-NEXT: Constraint: <Constraint Kind:owned LifetimeConstraint:LifetimeEnding>
|
|
// CHECK: Visiting: {{.*}}%4 = struct $MyInt (undef : $Builtin.Int32)
|
|
// CHECK-NEXT: Ownership Constraint:
|
|
// CHECK-NEXT: Op #: 0
|
|
// CHECK-NEXT: Constraint: <Constraint Kind:none LifetimeConstraint:NonLifetimeEnding>
|
|
// CHECK-LABEL: Visiting: {{%.*}} = struct $MyKlassWrapper (undef : $Klass)
|
|
// CHECK-NEXT: Ownership Constraint:
|
|
// CHECK-NEXT: Op #: 0
|
|
// CHECK-NEXT: Constraint: <Constraint Kind:none LifetimeConstraint:NonLifetimeEnding>
|
|
// CHECK-NEXT: Results Ownership Kinds:
|
|
// CHECK-NEXT: Result: {{%.*}} = struct $MyKlassWrapper (undef : $Klass)
|
|
// CHECK-NEXT: Kind: none
|
|
sil [ossa] @undef_addresses_have_any_ownership : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = mark_uninitialized [var] undef : $*Klass
|
|
%1 = mark_uninitialized [var] undef : $Klass
|
|
destroy_value %1 : $Klass
|
|
%2 = mark_uninitialized [var] undef : $*Builtin.Int32
|
|
%3 = struct $MyInt(undef : $Builtin.Int32)
|
|
%4 = struct $MyKlassWrapper(undef : $Klass)
|
|
%9999 = tuple()
|
|
return %9999 : $()
|
|
}
|