Skip to content

Commit e123f97

Browse files
committed
Java: Remove useless pruning.
1 parent 5e0ce81 commit e123f97

File tree

19 files changed

+570
-684
lines changed

19 files changed

+570
-684
lines changed

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

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,22 +1758,19 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPat
17581758
mid.getAp() instanceof AccessPathNil and
17591759
ap = node.(AccessPathNilNode).getAp()
17601760
or
1761-
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
1762-
(
1763-
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1764-
or
1765-
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1766-
or
1767-
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1768-
or
1769-
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1770-
or
1771-
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1772-
or
1773-
pathThroughCallable(mid, node, cc, ap)
1774-
or
1775-
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
1776-
)
1761+
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1762+
or
1763+
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1764+
or
1765+
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1766+
or
1767+
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1768+
or
1769+
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1770+
or
1771+
pathThroughCallable(mid, node, cc, ap)
1772+
or
1773+
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
17771774
}
17781775

17791776
pragma[noinline]
@@ -2244,27 +2241,24 @@ private module FlowExploration {
22442241
ap = TPartialNil(getErasedRepr(node.getType())) and
22452242
config = mid.getConfiguration()
22462243
or
2247-
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
2248-
(
2249-
partialPathStoreStep(mid, _, _, node, ap) and
2250-
cc = mid.getCallContext() and
2251-
config = mid.getConfiguration()
2252-
or
2253-
exists(PartialAccessPath ap0, Content f |
2254-
partialPathReadStep(mid, ap0, f, node, cc, config) and
2255-
apConsFwd(ap, f, ap0, config)
2256-
)
2257-
or
2258-
partialPathOutOfArgument(mid, node, cc, ap, config)
2259-
or
2260-
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2261-
or
2262-
partialPathOutOfCallable(mid, node, cc, ap, config)
2263-
or
2264-
partialPathThroughCallable(mid, node, cc, ap, config)
2265-
or
2266-
valuePartialPathThroughCallable(mid, node, cc, ap, config)
2244+
partialPathStoreStep(mid, _, _, node, ap) and
2245+
cc = mid.getCallContext() and
2246+
config = mid.getConfiguration()
2247+
or
2248+
exists(PartialAccessPath ap0, Content f |
2249+
partialPathReadStep(mid, ap0, f, node, cc, config) and
2250+
apConsFwd(ap, f, ap0, config)
22672251
)
2252+
or
2253+
partialPathOutOfArgument(mid, node, cc, ap, config)
2254+
or
2255+
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2256+
or
2257+
partialPathOutOfCallable(mid, node, cc, ap, config)
2258+
or
2259+
partialPathThroughCallable(mid, node, cc, ap, config)
2260+
or
2261+
valuePartialPathThroughCallable(mid, node, cc, ap, config)
22682262
}
22692263

22702264
bindingset[result, i]

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,22 +1758,19 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPat
17581758
mid.getAp() instanceof AccessPathNil and
17591759
ap = node.(AccessPathNilNode).getAp()
17601760
or
1761-
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
1762-
(
1763-
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1764-
or
1765-
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1766-
or
1767-
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1768-
or
1769-
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1770-
or
1771-
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1772-
or
1773-
pathThroughCallable(mid, node, cc, ap)
1774-
or
1775-
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
1776-
)
1761+
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1762+
or
1763+
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1764+
or
1765+
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1766+
or
1767+
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1768+
or
1769+
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1770+
or
1771+
pathThroughCallable(mid, node, cc, ap)
1772+
or
1773+
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
17771774
}
17781775

17791776
pragma[noinline]
@@ -2244,27 +2241,24 @@ private module FlowExploration {
22442241
ap = TPartialNil(getErasedRepr(node.getType())) and
22452242
config = mid.getConfiguration()
22462243
or
2247-
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
2248-
(
2249-
partialPathStoreStep(mid, _, _, node, ap) and
2250-
cc = mid.getCallContext() and
2251-
config = mid.getConfiguration()
2252-
or
2253-
exists(PartialAccessPath ap0, Content f |
2254-
partialPathReadStep(mid, ap0, f, node, cc, config) and
2255-
apConsFwd(ap, f, ap0, config)
2256-
)
2257-
or
2258-
partialPathOutOfArgument(mid, node, cc, ap, config)
2259-
or
2260-
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2261-
or
2262-
partialPathOutOfCallable(mid, node, cc, ap, config)
2263-
or
2264-
partialPathThroughCallable(mid, node, cc, ap, config)
2265-
or
2266-
valuePartialPathThroughCallable(mid, node, cc, ap, config)
2244+
partialPathStoreStep(mid, _, _, node, ap) and
2245+
cc = mid.getCallContext() and
2246+
config = mid.getConfiguration()
2247+
or
2248+
exists(PartialAccessPath ap0, Content f |
2249+
partialPathReadStep(mid, ap0, f, node, cc, config) and
2250+
apConsFwd(ap, f, ap0, config)
22672251
)
2252+
or
2253+
partialPathOutOfArgument(mid, node, cc, ap, config)
2254+
or
2255+
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2256+
or
2257+
partialPathOutOfCallable(mid, node, cc, ap, config)
2258+
or
2259+
partialPathThroughCallable(mid, node, cc, ap, config)
2260+
or
2261+
valuePartialPathThroughCallable(mid, node, cc, ap, config)
22682262
}
22692263

22702264
bindingset[result, i]

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,22 +1758,19 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPat
17581758
mid.getAp() instanceof AccessPathNil and
17591759
ap = node.(AccessPathNilNode).getAp()
17601760
or
1761-
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
1762-
(
1763-
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1764-
or
1765-
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1766-
or
1767-
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1768-
or
1769-
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1770-
or
1771-
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1772-
or
1773-
pathThroughCallable(mid, node, cc, ap)
1774-
or
1775-
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
1776-
)
1761+
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1762+
or
1763+
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1764+
or
1765+
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1766+
or
1767+
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1768+
or
1769+
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1770+
or
1771+
pathThroughCallable(mid, node, cc, ap)
1772+
or
1773+
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
17771774
}
17781775

17791776
pragma[noinline]
@@ -2244,27 +2241,24 @@ private module FlowExploration {
22442241
ap = TPartialNil(getErasedRepr(node.getType())) and
22452242
config = mid.getConfiguration()
22462243
or
2247-
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
2248-
(
2249-
partialPathStoreStep(mid, _, _, node, ap) and
2250-
cc = mid.getCallContext() and
2251-
config = mid.getConfiguration()
2252-
or
2253-
exists(PartialAccessPath ap0, Content f |
2254-
partialPathReadStep(mid, ap0, f, node, cc, config) and
2255-
apConsFwd(ap, f, ap0, config)
2256-
)
2257-
or
2258-
partialPathOutOfArgument(mid, node, cc, ap, config)
2259-
or
2260-
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2261-
or
2262-
partialPathOutOfCallable(mid, node, cc, ap, config)
2263-
or
2264-
partialPathThroughCallable(mid, node, cc, ap, config)
2265-
or
2266-
valuePartialPathThroughCallable(mid, node, cc, ap, config)
2244+
partialPathStoreStep(mid, _, _, node, ap) and
2245+
cc = mid.getCallContext() and
2246+
config = mid.getConfiguration()
2247+
or
2248+
exists(PartialAccessPath ap0, Content f |
2249+
partialPathReadStep(mid, ap0, f, node, cc, config) and
2250+
apConsFwd(ap, f, ap0, config)
22672251
)
2252+
or
2253+
partialPathOutOfArgument(mid, node, cc, ap, config)
2254+
or
2255+
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2256+
or
2257+
partialPathOutOfCallable(mid, node, cc, ap, config)
2258+
or
2259+
partialPathThroughCallable(mid, node, cc, ap, config)
2260+
or
2261+
valuePartialPathThroughCallable(mid, node, cc, ap, config)
22682262
}
22692263

22702264
bindingset[result, i]

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,22 +1758,19 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPat
17581758
mid.getAp() instanceof AccessPathNil and
17591759
ap = node.(AccessPathNilNode).getAp()
17601760
or
1761-
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
1762-
(
1763-
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1764-
or
1765-
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1766-
or
1767-
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1768-
or
1769-
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1770-
or
1771-
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1772-
or
1773-
pathThroughCallable(mid, node, cc, ap)
1774-
or
1775-
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
1776-
)
1761+
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1762+
or
1763+
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1764+
or
1765+
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1766+
or
1767+
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1768+
or
1769+
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1770+
or
1771+
pathThroughCallable(mid, node, cc, ap)
1772+
or
1773+
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
17771774
}
17781775

17791776
pragma[noinline]
@@ -2244,27 +2241,24 @@ private module FlowExploration {
22442241
ap = TPartialNil(getErasedRepr(node.getType())) and
22452242
config = mid.getConfiguration()
22462243
or
2247-
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
2248-
(
2249-
partialPathStoreStep(mid, _, _, node, ap) and
2250-
cc = mid.getCallContext() and
2251-
config = mid.getConfiguration()
2252-
or
2253-
exists(PartialAccessPath ap0, Content f |
2254-
partialPathReadStep(mid, ap0, f, node, cc, config) and
2255-
apConsFwd(ap, f, ap0, config)
2256-
)
2257-
or
2258-
partialPathOutOfArgument(mid, node, cc, ap, config)
2259-
or
2260-
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2261-
or
2262-
partialPathOutOfCallable(mid, node, cc, ap, config)
2263-
or
2264-
partialPathThroughCallable(mid, node, cc, ap, config)
2265-
or
2266-
valuePartialPathThroughCallable(mid, node, cc, ap, config)
2244+
partialPathStoreStep(mid, _, _, node, ap) and
2245+
cc = mid.getCallContext() and
2246+
config = mid.getConfiguration()
2247+
or
2248+
exists(PartialAccessPath ap0, Content f |
2249+
partialPathReadStep(mid, ap0, f, node, cc, config) and
2250+
apConsFwd(ap, f, ap0, config)
22672251
)
2252+
or
2253+
partialPathOutOfArgument(mid, node, cc, ap, config)
2254+
or
2255+
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2256+
or
2257+
partialPathOutOfCallable(mid, node, cc, ap, config)
2258+
or
2259+
partialPathThroughCallable(mid, node, cc, ap, config)
2260+
or
2261+
valuePartialPathThroughCallable(mid, node, cc, ap, config)
22682262
}
22692263

22702264
bindingset[result, i]

0 commit comments

Comments
 (0)