Skip to content

Commit 5d13d3b

Browse files
committed
Dataflow: Refactor - deduplicate fwdFlowRead+consCand join.
1 parent 70a8bc3 commit 5d13d3b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,11 +1533,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
15331533
)
15341534
or
15351535
// read
1536-
exists(Typ t0, Ap ap0, Content c |
1537-
fwdFlowRead(t0, ap0, c, _, node, state, cc, summaryCtx) and
1538-
fwdFlowConsCand(t0, ap0, c, t, ap) and
1539-
apa = getApprox(ap)
1540-
)
1536+
fwdFlowRead(_, _, _, _, node, t, ap, state, cc, summaryCtx) and
1537+
apa = getApprox(ap)
15411538
or
15421539
// flow into a callable without summary context
15431540
fwdFlowInNoFlowThrough(node, apa, state, cc, t, ap) and
@@ -1676,7 +1673,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
16761673
}
16771674

16781675
pragma[nomagic]
1679-
private predicate fwdFlowRead(
1676+
private predicate fwdFlowRead0(
16801677
Typ t, Ap ap, Content c, NodeEx node1, NodeEx node2, FlowState state, Cc cc,
16811678
SummaryCtx summaryCtx
16821679
) {
@@ -1689,6 +1686,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
16891686
)
16901687
}
16911688

1689+
pragma[nomagic]
1690+
private predicate fwdFlowRead(
1691+
NodeEx node1, Typ t1, Ap ap1, Content c, NodeEx node2, Typ t2, Ap ap2, FlowState state,
1692+
Cc cc, SummaryCtx summaryCtx
1693+
) {
1694+
fwdFlowRead0(t1, ap1, c, node1, node2, state, cc, summaryCtx) and
1695+
fwdFlowConsCand(t1, ap1, c, t2, ap2)
1696+
}
1697+
16921698
pragma[nomagic]
16931699
private predicate fwdFlowIntoArg(
16941700
ArgNodeEx arg, FlowState state, Cc outercc, SummaryCtx summaryCtx, Typ t, Ap ap,
@@ -2127,10 +2133,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
21272133

21282134
pragma[nomagic]
21292135
private predicate readStepFwd(NodeEx n1, Ap ap1, Content c, NodeEx n2, Ap ap2) {
2130-
exists(Typ t1 |
2131-
fwdFlowRead(t1, ap1, c, n1, n2, _, _, _) and
2132-
fwdFlowConsCand(t1, ap1, c, _, ap2)
2133-
)
2136+
fwdFlowRead(n1, _, ap1, c, n2, _, ap2, _, _, _)
21342137
}
21352138

21362139
pragma[nomagic]
@@ -3200,10 +3203,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
32003203
)
32013204
or
32023205
// read
3203-
exists(NodeEx mid, Typ t0, Ap ap0, Content c |
3206+
exists(NodeEx mid, Typ t0, Ap ap0 |
32043207
pn1 = TPathNodeMid(mid, state, cc, summaryCtx, t0, ap0) and
3205-
fwdFlowRead(t0, ap0, c, mid, node, state, cc, summaryCtx) and
3206-
fwdFlowConsCand(t0, ap0, c, t, ap) and
3208+
fwdFlowRead(mid, t0, ap0, _, node, t, ap, state, cc, summaryCtx) and
32073209
label = "" and
32083210
isStoreStep = false
32093211
)

0 commit comments

Comments
 (0)