Skip to content

Commit d9eff0c

Browse files
authored
Merge pull request #81989 from atrick/enable-addressable-tests
Enable lifetime dependence tests for @_addressable.
2 parents 7b4d1bc + 9cd502d commit d9eff0c

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

test/SILOptimizer/lifetime_dependence/semantics.swift

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,12 @@ struct Outer {
180180
get { _innerObject }
181181
}
182182

183-
/* TODO: rdar://137608270 Add Builtin.addressof() support for @addressable arguments
184-
@addressableSelf
185-
var innerAddress: Inner {
183+
var innerAddress: InnerTrivial {
184+
@_addressableSelf
186185
unsafeAddress {
187-
Builtin.addressof(inner)
186+
UnsafePointer<InnerTrivial>(Builtin.addressOfBorrow(_innerTrivial))
188187
}
189188
}
190-
*/
191189
}
192190

193191
func parse(_ span: Span<Int>) {}
@@ -577,26 +575,22 @@ func dependsOnAddressHelper(arg: @_addressable Holder) -> Span<Int> {
577575
arg.span()
578576
}
579577

580-
/* TODO: requires -enable-address-dependencies
581-
582578
// Non-addressable error returning a Span.
583579
@lifetime(borrow arg)
584580
func testTrivialNonAddressable(arg: TrivialHolder) -> Span<Int> {
585581
dependsOnTrivialAddressHelper(arg: arg)
586-
// todo-error @-1{{lifetime-dependent value escapes its scope}
587-
// todo-note @-3{{it depends on the lifetime of variable 'arg'}}
588-
} // todo-note {{this use causes the lifetime-dependent value to escape}}
582+
// expected-error @-1{{lifetime-dependent value escapes its scope}}
583+
// expected-note @-3{{it depends on the lifetime of argument 'arg'}}
584+
} // expected-note {{this use causes the lifetime-dependent value to escape}}
589585

590586
// Non-addressable error returning a Span.
591587
@lifetime(borrow arg)
592588
func testNonAddressable(arg: Holder) -> Span<Int> {
593589
dependsOnAddressHelper(arg: arg)
594-
// todo-error @-1{{lifetime-dependent value escapes its scope}
595-
// todo-note @-3{{it depends on the lifetime of variable 'arg'}}
596-
} // todo-note {{this use causes the lifetime-dependent value to escape}}
597-
*/
590+
// expected-error @-1{{lifetime-dependent value escapes its scope}}
591+
// expected-note @-3{{it depends on the lifetime of argument 'arg'}}
592+
} // expected-note {{this use causes the lifetime-dependent value to escape}}
598593

599-
/* TODO: rdar://145872854 (SILGen: @addressable inout arguments are copied)
600594
@lifetime(borrow arg)
601595
func test(arg: inout AddressableInt) -> Span<Int> {
602596
arg.span()
@@ -614,8 +608,6 @@ func testBorrowedAddressableInt(arg: Holder) -> Int {
614608
@lifetime(borrow arg)
615609
func testBorrowedAddressableIntReturn(arg: Holder) -> Span<Int> {
616610
arg.addressableInt.span()
617-
// todo-error @-1{{lifetime-dependent value escapes its scope}
618-
// todo-note @-2{{it depends on the lifetime of this parent value}}
619-
} // todo-note {{this use causes the lifetime-dependent value to escape}}
620-
621-
*/
611+
// expected-error @-1{{lifetime-dependent value escapes its scope}}
612+
// expected-note @-3{{it depends on the lifetime of argument 'arg'}}
613+
} // expected-note {{this use causes the lifetime-dependent value to escape}}

0 commit comments

Comments
 (0)