mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fixes a leak when parts of the payload are ignored, as in rdar://problem/19631811. Swift SVN r24809
43 lines
1.9 KiB
Swift
43 lines
1.9 KiB
Swift
// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
|
|
|
|
class C {}
|
|
|
|
// CHECK-LABEL: sil hidden @_TF7foreach3fooFGSaTCS_1CS0___T_
|
|
func foo(xx: [(C, C)]) {
|
|
// CHECK: [[PAYLOAD_ADDR:%.*]] = unchecked_take_enum_data_addr {{%.*}} : $*Optional<(C, C)>
|
|
// CHECK: [[PAYLOAD:%.*]] = load [[PAYLOAD_ADDR]]
|
|
// CHECK: [[A:%.*]] = tuple_extract [[PAYLOAD]] : $(C, C), 0
|
|
// CHECK: [[B:%.*]] = tuple_extract [[PAYLOAD]] : $(C, C), 1
|
|
// CHECK: strong_release [[B]]
|
|
// CHECK: strong_release [[A]]
|
|
for (a, b) in xx {}
|
|
// CHECK: [[PAYLOAD_ADDR:%.*]] = unchecked_take_enum_data_addr {{%.*}} : $*Optional<(C, C)>
|
|
// CHECK: [[PAYLOAD:%.*]] = load [[PAYLOAD_ADDR]]
|
|
// CHECK: [[A:%.*]] = tuple_extract [[PAYLOAD]] : $(C, C), 0
|
|
// CHECK: [[B:%.*]] = tuple_extract [[PAYLOAD]] : $(C, C), 1
|
|
// CHECK: strong_release [[B]]
|
|
// CHECK: strong_release [[A]]
|
|
for (a, _) in xx {}
|
|
// CHECK: [[PAYLOAD_ADDR:%.*]] = unchecked_take_enum_data_addr {{%.*}} : $*Optional<(C, C)>
|
|
// CHECK: [[PAYLOAD:%.*]] = load [[PAYLOAD_ADDR]]
|
|
// CHECK: [[A:%.*]] = tuple_extract [[PAYLOAD]] : $(C, C), 0
|
|
// CHECK: [[B:%.*]] = tuple_extract [[PAYLOAD]] : $(C, C), 1
|
|
// CHECK: strong_release [[A]]
|
|
// CHECK: strong_release [[B]]
|
|
for (_, b) in xx {}
|
|
// CHECK: [[PAYLOAD_ADDR:%.*]] = unchecked_take_enum_data_addr {{%.*}} : $*Optional<(C, C)>
|
|
// CHECK: [[PAYLOAD:%.*]] = load [[PAYLOAD_ADDR]]
|
|
// CHECK: [[A:%.*]] = tuple_extract [[PAYLOAD]] : $(C, C), 0
|
|
// CHECK: [[B:%.*]] = tuple_extract [[PAYLOAD]] : $(C, C), 1
|
|
// CHECK: strong_release [[B]]
|
|
// CHECK: strong_release [[A]]
|
|
for (_, _) in xx {}
|
|
// CHECK: [[PAYLOAD_ADDR:%.*]] = unchecked_take_enum_data_addr {{%.*}} : $*Optional<(C, C)>
|
|
// CHECK: [[PAYLOAD:%.*]] = load [[PAYLOAD_ADDR]]
|
|
// CHECK: [[A:%.*]] = tuple_extract [[PAYLOAD]] : $(C, C), 0
|
|
// CHECK: [[B:%.*]] = tuple_extract [[PAYLOAD]] : $(C, C), 1
|
|
// CHECK: strong_release [[B]]
|
|
// CHECK: strong_release [[A]]
|
|
for _ in xx {}
|
|
}
|