@@ -1253,6 +1253,31 @@ sil [serialized] [thunk] @a_regular_thunk : $@convention(thin) () -> () {
1253
1253
return %1 : $()
1254
1254
}
1255
1255
1256
+ public class WeakUnownedTest {
1257
+ @sil_stored public unowned var unownedVal: @sil_unowned AnyObject { get set }
1258
+ @sil_stored public weak var weakVal: @sil_weak AnyObject? { get set }
1259
+ public init(protoVal: AnyObject)
1260
+ deinit
1261
+ }
1262
+
1263
+ // CHECK-LABEL: sil public_external [serialized] @weak_unowned : $@convention(thin) (@owned WeakUnownedTest, @owned AnyObject) -> ()
1264
+ sil [serialized] @weak_unowned : $@convention(thin) (@owned WeakUnownedTest, @owned AnyObject) -> () {
1265
+ bb0(%0 : $WeakUnownedTest, %1 : $AnyObject):
1266
+ %2 = ref_element_addr %0 : $WeakUnownedTest, #WeakUnownedTest.unownedVal
1267
+ // CHECK: store_unowned
1268
+ store_unowned %1 to %2 : $*@sil_unowned AnyObject
1269
+
1270
+ %3 = enum $Optional<AnyObject>, #Optional.some!enumelt.1, %1 : $AnyObject
1271
+ %4 = ref_element_addr %0 : $WeakUnownedTest, #WeakUnownedTest.weakVal
1272
+ // CHECK: store_weak
1273
+ store_weak %3 to %4 : $*@sil_weak AnyObject?
1274
+
1275
+ %r = tuple ()
1276
+
1277
+ // CHECK: return
1278
+ return %r : $()
1279
+ }
1280
+
1256
1281
public class Foo {
1257
1282
subscript (x: Int, y: Int) -> Int32 { get set }
1258
1283
var x: Int
@@ -1467,6 +1492,7 @@ bb0:
1467
1492
%150 = function_ref @bridge_object : $@convention(thin) (@owned Class1, Builtin.Word) -> ()
1468
1493
%151 = function_ref @a_reabstraction_thunk: $@convention(thin) () -> ()
1469
1494
%152 = function_ref @a_regular_thunk: $@convention(thin) () -> ()
1495
+ %153 = function_ref @weak_unowned: $@convention(thin) (@owned WeakUnownedTest, @owned AnyObject) -> ()
1470
1496
1471
1497
%r = tuple ()
1472
1498
return %r : $()
0 commit comments