mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen: Emit cleanups before returning from enum case constructors.
We were leaking dealloc_stacks when the enum constructor had to create temporary allocations in order to implode address-only tuple payloads. Swift SVN r8971
This commit is contained in:
11
test/SILGen/enum.swift
Normal file
11
test/SILGen/enum.swift
Normal file
@@ -0,0 +1,11 @@
|
||||
// RUN: %swift -emit-silgen %s | FileCheck %s
|
||||
protocol P {}
|
||||
|
||||
// Regression test for a bug where temporary allocations created as a result of
|
||||
// tuple implosion were not deallocated in enum constructors.
|
||||
enum Foo { case A(P, String) }
|
||||
|
||||
// CHECK: sil [transparent] @_TO4enum3Foo1AfMS0_FTPS_1P_SS_S0_ : $[thin] ((P, String), Foo.metatype) -> Foo {
|
||||
// CHECK: [[ALLOC:%.*]] = alloc_stack $(P, String)
|
||||
// CHECK: dealloc_stack [[ALLOC]]#0
|
||||
// CHECK: }
|
||||
Reference in New Issue
Block a user