|
1 |
| -// RUN: %target-swift-emit-irgen \ |
| 1 | +// RUN: %target-swift-emit-irgen \ |
2 | 2 | // RUN: -enable-experimental-feature NoncopyableGenerics \
|
3 |
| -// RUN: %s \ |
4 |
| -// RUN: | \ |
| 3 | +// RUN: -disable-type-layout \ |
| 4 | +// RUN: %s \ |
| 5 | +// RUN: | \ |
5 | 6 | // RUN: %FileCheck %s
|
6 | 7 |
|
| 8 | +// Check that UMA_Large.deinit is called directly from FIFO_Large.deinit, |
| 9 | +// rather than through an outlined release function. |
| 10 | +// CHECK-LABEL: define{{.*}} void @"$s21moveonly_enum_deinits10FIFO_LargeVfD" |
| 11 | +// CHECK: call{{.*}} void @"$s21moveonly_enum_deinits9UMA_LargeVfD" |
| 12 | +// CHECK: } |
| 13 | +public struct FIFO_Large<T>: ~Copyable { |
| 14 | + public var uma: UMA_Large<T> |
| 15 | + public var i1: Int |
| 16 | + public var i2: Int |
| 17 | + |
| 18 | + deinit { |
| 19 | + something(self) |
| 20 | + } |
| 21 | +} |
| 22 | + |
| 23 | +public struct UMA_Large<T>: ~Copyable { |
| 24 | + public let umbp: UnsafeMutableBufferPointer<T> |
| 25 | + public var allocd: [Bool] = [] |
| 26 | + deinit { |
| 27 | + something(self) |
| 28 | + } |
| 29 | +} |
| 30 | + |
| 31 | +// Check that UMA_Small.deinit is called directly from FIFO_Small.deinit, |
| 32 | +// rather than through an outlined release function. |
| 33 | +// CHECK-LABEL: define{{.*}} void @"$s21moveonly_enum_deinits10FIFO_SmallVfD" |
| 34 | +// CHECK: call{{.*}} void @"$s21moveonly_enum_deinits9UMA_SmallVfD" |
| 35 | +// CHECK: } |
| 36 | +public struct FIFO_Small<T>: ~Copyable { |
| 37 | + public var uma: UMA_Small<T> |
| 38 | + public var i1: Int |
| 39 | + public var i2: Int |
| 40 | + |
| 41 | + deinit { |
| 42 | + something(self) |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +public struct UMA_Small<T>: ~Copyable { |
| 47 | + public var allocd: [Bool] = [] |
| 48 | + deinit { |
| 49 | + something(self) |
| 50 | + } |
| 51 | +} |
| 52 | + |
7 | 53 | // CHECK-LABEL: define{{.*}} void @"$s21moveonly_enum_deinits4ListOwxx"(
|
8 | 54 | // CHECK-SAME: ptr noalias %object,
|
9 | 55 | // CHECK-SAME: ptr %List)
|
|
17 | 63 | // CHECK: ret void
|
18 | 64 | // CHECK: }
|
19 | 65 |
|
20 |
| -struct Box<T : ~Copyable> : ~Copyable { |
21 |
| - public init(_ l: consuming T) {} |
22 |
| - |
23 |
| - deinit {} |
| 66 | +public struct Box<T : ~Copyable> : ~Copyable { |
| 67 | + public init(_ l: consuming T) {} |
| 68 | + |
| 69 | + deinit {} |
24 | 70 | }
|
25 | 71 |
|
26 |
| -enum List: ~Copyable { |
27 |
| - case end |
28 |
| - case more(Int, Box<List>) |
| 72 | +public enum List: ~Copyable { |
| 73 | + case end |
| 74 | + case more(Int, Box<List>) |
29 | 75 | }
|
| 76 | + |
| 77 | +@_silgen_name("something") |
| 78 | +func something<T : ~Copyable>(_ t: borrowing T) |
0 commit comments