Skip to content

Commit c8ec463

Browse files
authored
Merge pull request #66920 from eeckstein/managedbuffer-inlinable-deinit
stdlib: make deinit of `ManagedBuffer` inlinable
2 parents d7bc5a9 + a5744b2 commit c8ec463

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

stdlib/public/core/ManagedBuffer.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ open class ManagedBuffer<Header, Element> {
5151
internal init(_doNotCallMe: ()) {
5252
_internalInvariantFailure("Only initialize these by calling create")
5353
}
54+
55+
@inlinable
56+
deinit {}
5457
}
5558

5659
extension ManagedBuffer {

test/SILOptimizer/dead_alloc.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,12 @@ public class C<T> {
4545
public func deadClassInstance() {
4646
let _ = C<Int>()
4747
}
48+
49+
// CHECK-LABEL: sil @$s10dead_alloc0A13ManagedBufferyyF :
50+
// CHECK: bb0:
51+
// CHECK-NEXT: tuple
52+
// CHECK-NEXT: return
53+
// CHECK-NEXT: } // end sil function '$s10dead_alloc0A13ManagedBufferyyF'
54+
public func deadManagedBuffer() -> () {
55+
_ = ManagedBuffer<Void, Void>.create(minimumCapacity: 1, makingHeaderWith: { _ in () })
56+
}

0 commit comments

Comments
 (0)