mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[DI] Fix unfailable throw during super init.
When deallocating a partially allocated class in the trapping branch of an unfailable cast, cast back down to the subclass which is being partially deallocated before emitting the dealloc partial ref instruction.
This commit is contained in:
@@ -2642,6 +2642,12 @@ void LifetimeChecker::processUninitializedRelease(SILInstruction *Release,
|
||||
}
|
||||
}
|
||||
|
||||
// Cast back down from an upcast.
|
||||
if (auto *UI = dyn_cast<UpcastInst>(Pointer)) {
|
||||
Pointer =
|
||||
B.createUncheckedRefCast(Loc, Pointer, UI->getOperand()->getType());
|
||||
}
|
||||
|
||||
// We've already destroyed any instance variables initialized by this
|
||||
// constructor, now destroy instance variables initialized by subclass
|
||||
// constructors that delegated to us, and finally free the memory.
|
||||
|
||||
Reference in New Issue
Block a user