mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
fix <rdar://problem/20608881> DI miscompiles this testcase into a memory leak
When emiting logic for conditional destruction of a variable, we weren't considering
a delegated init as a store to the variable that needed to be tracked. This caused us
to miscompile situations like this testcase where the self.init was conditional:
struct X {
var c : C
init() { c = C()}
init?(a : Bool) {
if a { self.init() }
return nil
}
}
This was exposed by other work, but needs to be fixed in any case.
Swift SVN r27471
This commit is contained in:
@@ -1493,6 +1493,7 @@ SILValue LifetimeChecker::handleConditionalInitAssign() {
|
||||
// The dynamically unknown case is the interesting one, handle it below.
|
||||
break;
|
||||
|
||||
case DIUseKind::SelfInit:
|
||||
case DIUseKind::Initialization:
|
||||
// If this is an initialization of only trivial elements, then we don't
|
||||
// need to update the bitvector.
|
||||
|
||||
Reference in New Issue
Block a user