mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix <rdar://problem/18199087> DI doesn't catch use of super properties lexically inside super.init call
When analyzing a super.init call, we have several instructions involved including an upcast to the parent type and an applyinst to call super.init. DI was using the location of the upcast as the point at which it modeled the super.init requirement, not at the point of the applyinst. This meant that code like: %x = upcast self to basetype ... stuff ... apply super.init(%x) would not catch invalid uses of super in the "stuff" range, because DI thought that super.init was called at the upcast. Fix this by using the apply as the super.init use, not the upcast. Swift SVN r22101
This commit is contained in:
@@ -848,7 +848,7 @@ void LifetimeChecker::handleLoadUseFailure(const DIMemoryUse &Use,
|
||||
/// handleSuperInitUse - When processing a 'self' argument on a class, this is
|
||||
/// a call to super.init.
|
||||
void LifetimeChecker::handleSuperInitUse(const DIMemoryUse &InstInfo) {
|
||||
UpcastInst *Inst = cast<UpcastInst>(InstInfo.Inst);
|
||||
auto *Inst = cast<ApplyInst>(InstInfo.Inst);
|
||||
|
||||
// Determine the liveness states of the memory object, including the
|
||||
// super.init state.
|
||||
|
||||
Reference in New Issue
Block a user