Skip to content

Commit d028e6b

Browse files
committed
Dataflow: Change some headUsesContent to getHead.
1 parent aa66b9b commit d028e6b

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,9 +1862,9 @@ private predicate expensiveLen2unfolding(TypedContent tc, Configuration config)
18621862
tails = strictcount(AccessPathFront apf | Stage3::consCand(tc, apf, config)) and
18631863
nodes =
18641864
strictcount(Node n |
1865-
Stage3::revFlow(n, _, _, any(AccessPathFrontHead apf | apf.headUsesContent(tc)), config)
1865+
Stage3::revFlow(n, _, _, any(AccessPathFrontHead apf | apf.getHead() = tc), config)
18661866
or
1867-
flowCandSummaryCtx(n, any(AccessPathFrontHead apf | apf.headUsesContent(tc)), config)
1867+
flowCandSummaryCtx(n, any(AccessPathFrontHead apf | apf.getHead() = tc), config)
18681868
) and
18691869
accessPathApproxCostLimits(apLimit, tupleLimit) and
18701870
apLimit < tails and
@@ -3300,17 +3300,13 @@ predicate flowsTo(Node source, Node sink, Configuration configuration) {
33003300
private predicate finalStats(boolean fwd, int nodes, int fields, int conscand, int tuples) {
33013301
fwd = true and
33023302
nodes = count(Node n0 | exists(PathNode pn | pn.getNode() = n0)) and
3303-
fields =
3304-
count(TypedContent f0 | exists(PathNodeMid pn | pn.getAp().getFront().headUsesContent(f0))) and
3303+
fields = count(TypedContent f0 | exists(PathNodeMid pn | pn.getAp().getHead() = f0)) and
33053304
conscand = count(AccessPath ap | exists(PathNodeMid pn | pn.getAp() = ap)) and
33063305
tuples = count(PathNode pn)
33073306
or
33083307
fwd = false and
33093308
nodes = count(Node n0 | exists(PathNode pn | pn.getNode() = n0 and reach(pn))) and
3310-
fields =
3311-
count(TypedContent f0 |
3312-
exists(PathNodeMid pn | pn.getAp().getFront().headUsesContent(f0) and reach(pn))
3313-
) and
3309+
fields = count(TypedContent f0 | exists(PathNodeMid pn | pn.getAp().getHead() = f0 and reach(pn))) and
33143310
conscand = count(AccessPath ap | exists(PathNodeMid pn | pn.getAp() = ap and reach(pn))) and
33153311
tuples = count(PathNode pn | reach(pn))
33163312
}

java/ql/src/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -807,12 +807,7 @@ abstract class AccessPathFront extends TAccessPathFront {
807807
// TODO: delete
808808
predicate headUsesContent(TypedContent tc) { this = TFrontHead(tc) }
809809

810-
predicate isClearedAt(Node n) {
811-
exists(TypedContent tc |
812-
this.headUsesContent(tc) and
813-
clearsContent(n, tc.getContent())
814-
)
815-
}
810+
predicate isClearedAt(Node n) { clearsContent(n, getHead().getContent()) }
816811
}
817812

818813
class AccessPathFrontNil extends AccessPathFront, TFrontNil {

0 commit comments

Comments
 (0)