Skip to content

Commit 0de8ae9

Browse files
committed
[SIL] Ensure __owned arguments are @owned.
No matter what the default is, an __owned argument should end up being @owned in SIL. Currently this is... hard to test, since arguments are owned by default. Part of rdar://problem/34668110.
1 parent a46019f commit 0de8ae9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/SILGen/owned.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,19 @@ class RefAggregate {}
66
struct ValueAggregate { let x = RefAggregate() }
77

88
// CHECK-LABEL: sil hidden @$S5owned0A10_arguments7trivial5value3refySin_AA14ValueAggregateVnAA03RefG0CntF : $@convention(thin) (Int, @owned ValueAggregate, @owned RefAggregate) -> () {
9-
func owned_arguments(trivial : __owned Int, value : __owned ValueAggregate, ref : __owned RefAggregate) {}
9+
func owned_arguments(trivial : __owned Int, value : __owned ValueAggregate, ref : __owned RefAggregate) {
10+
let t = trivial
11+
let v = value
12+
let r = ref
13+
}
1014

1115
struct Foo {
1216
var x: ValueAggregate
1317

1418
// CHECK-LABEL: sil hidden @$S5owned3FooV20methodOwnedArguments7trivial5value3refySin_AA14ValueAggregateVnAA03RefJ0CntF : $@convention(method) (Int, @owned ValueAggregate, @owned RefAggregate, @guaranteed Foo) -> () {
15-
func methodOwnedArguments(trivial : __owned Int, value : __owned ValueAggregate, ref : __owned RefAggregate) {}
19+
func methodOwnedArguments(trivial : __owned Int, value : __owned ValueAggregate, ref : __owned RefAggregate) {
20+
let t = trivial
21+
let v = value
22+
let r = ref
23+
}
1624
}

0 commit comments

Comments
 (0)