Merge pull request #7187 from aschackmull/java/dont-clear-in-summary-store

Java: Don't clear content in store steps in summaries.
This commit is contained in:
Anders Schack-Mulligen
2021-11-19 16:12:37 +01:00
committed by GitHub
2 changed files with 6 additions and 3 deletions

View File

@@ -150,8 +150,11 @@ predicate readStep(Node node1, Content f, Node node2) {
* in `x.f = newValue`.
*/
predicate clearsContent(Node n, Content c) {
c instanceof FieldContent and
n = any(PostUpdateNode pun | storeStep(_, c, pun)).getPreUpdateNode()
exists(FieldAccess fa |
instanceFieldAssign(_, fa) and
n = getFieldQualifier(fa) and
c.(FieldContent).getField() = fa.getField()
)
or
FlowSummaryImpl::Private::Steps::summaryClearsContent(n, c)
}

View File

@@ -174,7 +174,7 @@ public class A {
a1.field1 = source(20);
A a2 = new A();
applyConsumer1Field1Field2(a1, a2, p -> {
sink(p); // MISSING FLOW
sink(p); // $ flow=20
});
wrapSinkToAvoidFieldSsa(a1);
sink(a2.field2);