Capture flow: Take overwrites in nested scopes into account

This commit is contained in:
Tom Hvitved
2024-02-07 14:06:08 +01:00
parent 0c43ad45b4
commit 1ea7717714
6 changed files with 28 additions and 4 deletions

View File

@@ -232,6 +232,9 @@ signature module OutputSig<LocationSig Location, InputSig<Location> I> {
/** Holds if this-to-this summaries are expected for `c`. */
predicate heuristicAllowInstanceParameterReturnInSelf(I::Callable c);
/** Holds if captured variable `v` is cleared at `node`. */
predicate clearsContent(ClosureNode node, I::CapturedVariable v);
}
/**
@@ -959,4 +962,11 @@ module Flow<LocationSig Location, InputSig<Location> Input> implements OutputSig
)
)
}
predicate clearsContent(ClosureNode node, CapturedVariable v) {
exists(BasicBlock bb, int i |
captureWrite(v, bb, i, false, _) and
node = TSynthThisQualifier(bb, i, false)
)
}
}