Skip to content

Commit 822890f

Browse files
committed
Dataflow: Remove disjunction-induced tuple duplication.
1 parent f5f67dd commit 822890f

File tree

1 file changed

+18
-27
lines changed

1 file changed

+18
-27
lines changed

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

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,9 +1144,8 @@ private module Stage2 {
11441144
exists(ArgNodeEx arg, boolean allowsFieldFlow |
11451145
fwdFlow(arg, outercc, argAp, ap, config) and
11461146
flowIntoCall(call, arg, p, allowsFieldFlow, config) and
1147-
innercc = getCallContextCall(call, p.getEnclosingCallable(), outercc)
1148-
|
1149-
ap instanceof ApNil or allowsFieldFlow = true
1147+
innercc = getCallContextCall(call, p.getEnclosingCallable(), outercc) and
1148+
if allowsFieldFlow = false then ap instanceof ApNil else any()
11501149
)
11511150
}
11521151

@@ -1161,9 +1160,8 @@ private module Stage2 {
11611160
fwdFlow(ret, innercc, argAp, ap, config) and
11621161
flowOutOfCall(call, ret, out, allowsFieldFlow, config) and
11631162
inner = ret.getEnclosingCallable() and
1164-
ccOut = getCallContextReturn(inner, call, innercc)
1165-
|
1166-
ap instanceof ApNil or allowsFieldFlow = true
1163+
ccOut = getCallContextReturn(inner, call, innercc) and
1164+
if allowsFieldFlow = false then ap instanceof ApNil else any()
11671165
)
11681166
}
11691167

@@ -1173,9 +1171,8 @@ private module Stage2 {
11731171
) {
11741172
exists(RetNodeEx ret, boolean allowsFieldFlow, CcCall ccc |
11751173
fwdFlow(ret, ccc, apSome(argAp), ap, config) and
1176-
flowThroughOutOfCall(call, ccc, ret, out, allowsFieldFlow, config)
1177-
|
1178-
ap instanceof ApNil or allowsFieldFlow = true
1174+
flowThroughOutOfCall(call, ccc, ret, out, allowsFieldFlow, config) and
1175+
if allowsFieldFlow = false then ap instanceof ApNil else any()
11791176
)
11801177
}
11811178

@@ -1845,9 +1842,8 @@ private module Stage3 {
18451842
exists(ArgNodeEx arg, boolean allowsFieldFlow |
18461843
fwdFlow(arg, outercc, argAp, ap, config) and
18471844
flowIntoCall(call, arg, p, allowsFieldFlow, config) and
1848-
innercc = getCallContextCall(call, p.getEnclosingCallable(), outercc)
1849-
|
1850-
ap instanceof ApNil or allowsFieldFlow = true
1845+
innercc = getCallContextCall(call, p.getEnclosingCallable(), outercc) and
1846+
if allowsFieldFlow = false then ap instanceof ApNil else any()
18511847
)
18521848
}
18531849

@@ -1862,9 +1858,8 @@ private module Stage3 {
18621858
fwdFlow(ret, innercc, argAp, ap, config) and
18631859
flowOutOfCall(call, ret, out, allowsFieldFlow, config) and
18641860
inner = ret.getEnclosingCallable() and
1865-
ccOut = getCallContextReturn(inner, call, innercc)
1866-
|
1867-
ap instanceof ApNil or allowsFieldFlow = true
1861+
ccOut = getCallContextReturn(inner, call, innercc) and
1862+
if allowsFieldFlow = false then ap instanceof ApNil else any()
18681863
)
18691864
}
18701865

@@ -1874,9 +1869,8 @@ private module Stage3 {
18741869
) {
18751870
exists(RetNodeEx ret, boolean allowsFieldFlow, CcCall ccc |
18761871
fwdFlow(ret, ccc, apSome(argAp), ap, config) and
1877-
flowThroughOutOfCall(call, ccc, ret, out, allowsFieldFlow, config)
1878-
|
1879-
ap instanceof ApNil or allowsFieldFlow = true
1872+
flowThroughOutOfCall(call, ccc, ret, out, allowsFieldFlow, config) and
1873+
if allowsFieldFlow = false then ap instanceof ApNil else any()
18801874
)
18811875
}
18821876

@@ -2617,9 +2611,8 @@ private module Stage4 {
26172611
exists(ArgNodeEx arg, boolean allowsFieldFlow |
26182612
fwdFlow(arg, outercc, argAp, ap, config) and
26192613
flowIntoCall(call, arg, p, allowsFieldFlow, config) and
2620-
innercc = getCallContextCall(call, p.getEnclosingCallable(), outercc)
2621-
|
2622-
ap instanceof ApNil or allowsFieldFlow = true
2614+
innercc = getCallContextCall(call, p.getEnclosingCallable(), outercc) and
2615+
if allowsFieldFlow = false then ap instanceof ApNil else any()
26232616
)
26242617
}
26252618

@@ -2634,9 +2627,8 @@ private module Stage4 {
26342627
fwdFlow(ret, innercc, argAp, ap, config) and
26352628
flowOutOfCall(call, ret, out, allowsFieldFlow, config) and
26362629
inner = ret.getEnclosingCallable() and
2637-
ccOut = getCallContextReturn(inner, call, innercc)
2638-
|
2639-
ap instanceof ApNil or allowsFieldFlow = true
2630+
ccOut = getCallContextReturn(inner, call, innercc) and
2631+
if allowsFieldFlow = false then ap instanceof ApNil else any()
26402632
)
26412633
}
26422634

@@ -2646,9 +2638,8 @@ private module Stage4 {
26462638
) {
26472639
exists(RetNodeEx ret, boolean allowsFieldFlow, CcCall ccc |
26482640
fwdFlow(ret, ccc, apSome(argAp), ap, config) and
2649-
flowThroughOutOfCall(call, ccc, ret, out, allowsFieldFlow, config)
2650-
|
2651-
ap instanceof ApNil or allowsFieldFlow = true
2641+
flowThroughOutOfCall(call, ccc, ret, out, allowsFieldFlow, config) and
2642+
if allowsFieldFlow = false then ap instanceof ApNil else any()
26522643
)
26532644
}
26542645

0 commit comments

Comments
 (0)