Skip to content

Commit b581e38

Browse files
committed
Java: Autoformat and sync post rebase.
1 parent 9ef61bd commit b581e38

File tree

23 files changed

+1330
-1253
lines changed

23 files changed

+1330
-1253
lines changed

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

Lines changed: 64 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -909,30 +909,31 @@ private predicate localFlowStepPlus(
909909
) {
910910
not isUnreachableInCall(node2, cc.(LocalCallContextSpecificCall).getCall()) and
911911
(
912-
localFlowEntry(node1, config) and
913-
(
914-
localFlowStep(node1, node2, config) and preservesValue = true
915-
or
916-
additionalLocalFlowStep(node1, node2, config) and preservesValue = false
917-
) and
918-
node1 != node2 and
912+
localFlowEntry(node1, config) and
913+
(
914+
localFlowStep(node1, node2, config) and preservesValue = true
915+
or
916+
additionalLocalFlowStep(node1, node2, config) and preservesValue = false
917+
) and
918+
node1 != node2 and
919919
cc.validFor(node1) and
920-
nodeCand(node2, unbind(config))
921-
or
922-
exists(Node mid |
923-
localFlowStepPlus(node1, mid, preservesValue, config, cc) and
924-
localFlowStep(mid, node2, config) and
925-
not mid instanceof CastNode and
920+
not isUnreachableInCall(node1, cc.(LocalCallContextSpecificCall).getCall()) and
926921
nodeCand(node2, unbind(config))
927-
)
928-
or
929-
exists(Node mid |
922+
or
923+
exists(Node mid |
924+
localFlowStepPlus(node1, mid, preservesValue, config, cc) and
925+
localFlowStep(mid, node2, config) and
926+
not mid instanceof CastNode and
927+
nodeCand(node2, unbind(config))
928+
)
929+
or
930+
exists(Node mid |
930931
localFlowStepPlus(node1, mid, _, config, cc) and
931-
additionalLocalFlowStep(mid, node2, config) and
932-
not mid instanceof CastNode and
933-
preservesValue = false and
934-
nodeCand(node2, unbind(config))
935-
)
932+
additionalLocalFlowStep(mid, node2, config) and
933+
not mid instanceof CastNode and
934+
preservesValue = false and
935+
nodeCand(node2, unbind(config))
936+
)
936937
)
937938
}
938939

@@ -1733,19 +1734,17 @@ private class PathNodeSink extends PathNode, TPathNodeSink {
17331734
* a callable is recorded by `cc`.
17341735
*/
17351736
private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPath ap) {
1736-
exists(LocalCallContext localCC | localCC.matchesCallContext(cc) |
1737+
exists(LocalCallContext localCC | localCC = getMatchingLocalCallContext(cc, node) |
17371738
localFlowBigStep(mid.getNode(), node, true, mid.getConfiguration(), localCC) and
1738-
cc = mid.getCallContext() and
1739-
ap = mid.getAp()
1740-
or
1739+
cc = mid.getCallContext() and
1740+
ap = mid.getAp()
1741+
or
17411742
localFlowBigStep(mid.getNode(), node, false, mid.getConfiguration(), localCC) and
1742-
cc = mid.getCallContext() and
1743-
mid.getAp() instanceof AccessPathNil and
1744-
ap = node.(AccessPathNilNode).getAp()
1743+
cc = mid.getCallContext() and
1744+
mid.getAp() instanceof AccessPathNil and
1745+
ap = node.(AccessPathNilNode).getAp()
17451746
)
17461747
or
1747-
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
1748-
(
17491748
jumpStep(mid.getNode(), node, mid.getConfiguration()) and
17501749
cc instanceof CallContextAny and
17511750
ap = mid.getAp()
@@ -1755,19 +1754,21 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPat
17551754
mid.getAp() instanceof AccessPathNil and
17561755
ap = node.(AccessPathNilNode).getAp()
17571756
or
1758-
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1759-
or
1760-
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1761-
or
1762-
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1763-
or
1764-
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1765-
or
1766-
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1767-
or
1768-
pathThroughCallable(mid, node, cc, ap)
1769-
or
1770-
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
1757+
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
1758+
(
1759+
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1760+
or
1761+
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1762+
or
1763+
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1764+
or
1765+
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1766+
or
1767+
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1768+
or
1769+
pathThroughCallable(mid, node, cc, ap)
1770+
or
1771+
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
17711772
)
17721773
}
17731774

@@ -2236,24 +2237,27 @@ private module FlowExploration {
22362237
ap = TPartialNil(getErasedRepr(node.getType())) and
22372238
config = mid.getConfiguration()
22382239
or
2239-
partialPathStoreStep(mid, _, _, node, ap) and
2240-
cc = mid.getCallContext() and
2241-
config = mid.getConfiguration()
2242-
or
2243-
exists(PartialAccessPath ap0, Content f |
2244-
partialPathReadStep(mid, ap0, f, node, cc, config) and
2245-
apConsFwd(ap, f, ap0, config)
2240+
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
2241+
(
2242+
partialPathStoreStep(mid, _, _, node, ap) and
2243+
cc = mid.getCallContext() and
2244+
config = mid.getConfiguration()
2245+
or
2246+
exists(PartialAccessPath ap0, Content f |
2247+
partialPathReadStep(mid, ap0, f, node, cc, config) and
2248+
apConsFwd(ap, f, ap0, config)
2249+
)
2250+
or
2251+
partialPathOutOfArgument(mid, node, cc, ap, config)
2252+
or
2253+
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2254+
or
2255+
partialPathOutOfCallable(mid, node, cc, ap, config)
2256+
or
2257+
partialPathThroughCallable(mid, node, cc, ap, config)
2258+
or
2259+
valuePartialPathThroughCallable(mid, node, cc, ap, config)
22462260
)
2247-
or
2248-
partialPathOutOfArgument(mid, node, cc, ap, config)
2249-
or
2250-
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2251-
or
2252-
partialPathOutOfCallable(mid, node, cc, ap, config)
2253-
or
2254-
partialPathThroughCallable(mid, node, cc, ap, config)
2255-
or
2256-
valuePartialPathThroughCallable(mid, node, cc, ap, config)
22572261
}
22582262

22592263
bindingset[result, i]

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

Lines changed: 64 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -909,30 +909,31 @@ private predicate localFlowStepPlus(
909909
) {
910910
not isUnreachableInCall(node2, cc.(LocalCallContextSpecificCall).getCall()) and
911911
(
912-
localFlowEntry(node1, config) and
913-
(
914-
localFlowStep(node1, node2, config) and preservesValue = true
915-
or
916-
additionalLocalFlowStep(node1, node2, config) and preservesValue = false
917-
) and
918-
node1 != node2 and
912+
localFlowEntry(node1, config) and
913+
(
914+
localFlowStep(node1, node2, config) and preservesValue = true
915+
or
916+
additionalLocalFlowStep(node1, node2, config) and preservesValue = false
917+
) and
918+
node1 != node2 and
919919
cc.validFor(node1) and
920-
nodeCand(node2, unbind(config))
921-
or
922-
exists(Node mid |
923-
localFlowStepPlus(node1, mid, preservesValue, config, cc) and
924-
localFlowStep(mid, node2, config) and
925-
not mid instanceof CastNode and
920+
not isUnreachableInCall(node1, cc.(LocalCallContextSpecificCall).getCall()) and
926921
nodeCand(node2, unbind(config))
927-
)
928-
or
929-
exists(Node mid |
922+
or
923+
exists(Node mid |
924+
localFlowStepPlus(node1, mid, preservesValue, config, cc) and
925+
localFlowStep(mid, node2, config) and
926+
not mid instanceof CastNode and
927+
nodeCand(node2, unbind(config))
928+
)
929+
or
930+
exists(Node mid |
930931
localFlowStepPlus(node1, mid, _, config, cc) and
931-
additionalLocalFlowStep(mid, node2, config) and
932-
not mid instanceof CastNode and
933-
preservesValue = false and
934-
nodeCand(node2, unbind(config))
935-
)
932+
additionalLocalFlowStep(mid, node2, config) and
933+
not mid instanceof CastNode and
934+
preservesValue = false and
935+
nodeCand(node2, unbind(config))
936+
)
936937
)
937938
}
938939

@@ -1733,19 +1734,17 @@ private class PathNodeSink extends PathNode, TPathNodeSink {
17331734
* a callable is recorded by `cc`.
17341735
*/
17351736
private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPath ap) {
1736-
exists(LocalCallContext localCC | localCC.matchesCallContext(cc) |
1737+
exists(LocalCallContext localCC | localCC = getMatchingLocalCallContext(cc, node) |
17371738
localFlowBigStep(mid.getNode(), node, true, mid.getConfiguration(), localCC) and
1738-
cc = mid.getCallContext() and
1739-
ap = mid.getAp()
1740-
or
1739+
cc = mid.getCallContext() and
1740+
ap = mid.getAp()
1741+
or
17411742
localFlowBigStep(mid.getNode(), node, false, mid.getConfiguration(), localCC) and
1742-
cc = mid.getCallContext() and
1743-
mid.getAp() instanceof AccessPathNil and
1744-
ap = node.(AccessPathNilNode).getAp()
1743+
cc = mid.getCallContext() and
1744+
mid.getAp() instanceof AccessPathNil and
1745+
ap = node.(AccessPathNilNode).getAp()
17451746
)
17461747
or
1747-
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
1748-
(
17491748
jumpStep(mid.getNode(), node, mid.getConfiguration()) and
17501749
cc instanceof CallContextAny and
17511750
ap = mid.getAp()
@@ -1755,19 +1754,21 @@ private predicate pathStep(PathNodeMid mid, Node node, CallContext cc, AccessPat
17551754
mid.getAp() instanceof AccessPathNil and
17561755
ap = node.(AccessPathNilNode).getAp()
17571756
or
1758-
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1759-
or
1760-
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1761-
or
1762-
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1763-
or
1764-
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1765-
or
1766-
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1767-
or
1768-
pathThroughCallable(mid, node, cc, ap)
1769-
or
1770-
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
1757+
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
1758+
(
1759+
contentReadStep(mid, node, ap) and cc = mid.getCallContext()
1760+
or
1761+
exists(Content f, AccessPath ap0 | contentStoreStep(mid, node, ap0, f, cc) and push(ap0, f, ap))
1762+
or
1763+
pathOutOfArgument(mid, node, cc) and ap = mid.getAp()
1764+
or
1765+
pathIntoCallable(mid, node, _, cc, _) and ap = mid.getAp()
1766+
or
1767+
pathOutOfCallable(mid, node, cc) and ap = mid.getAp()
1768+
or
1769+
pathThroughCallable(mid, node, cc, ap)
1770+
or
1771+
valuePathThroughCallable(mid, node, cc) and ap = mid.getAp()
17711772
)
17721773
}
17731774

@@ -2236,24 +2237,27 @@ private module FlowExploration {
22362237
ap = TPartialNil(getErasedRepr(node.getType())) and
22372238
config = mid.getConfiguration()
22382239
or
2239-
partialPathStoreStep(mid, _, _, node, ap) and
2240-
cc = mid.getCallContext() and
2241-
config = mid.getConfiguration()
2242-
or
2243-
exists(PartialAccessPath ap0, Content f |
2244-
partialPathReadStep(mid, ap0, f, node, cc, config) and
2245-
apConsFwd(ap, f, ap0, config)
2240+
not isUnreachableInCall(node, cc.(CallContextSpecificCall).getCall()) and
2241+
(
2242+
partialPathStoreStep(mid, _, _, node, ap) and
2243+
cc = mid.getCallContext() and
2244+
config = mid.getConfiguration()
2245+
or
2246+
exists(PartialAccessPath ap0, Content f |
2247+
partialPathReadStep(mid, ap0, f, node, cc, config) and
2248+
apConsFwd(ap, f, ap0, config)
2249+
)
2250+
or
2251+
partialPathOutOfArgument(mid, node, cc, ap, config)
2252+
or
2253+
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2254+
or
2255+
partialPathOutOfCallable(mid, node, cc, ap, config)
2256+
or
2257+
partialPathThroughCallable(mid, node, cc, ap, config)
2258+
or
2259+
valuePartialPathThroughCallable(mid, node, cc, ap, config)
22462260
)
2247-
or
2248-
partialPathOutOfArgument(mid, node, cc, ap, config)
2249-
or
2250-
partialPathIntoCallable(mid, node, _, cc, _, ap, config)
2251-
or
2252-
partialPathOutOfCallable(mid, node, cc, ap, config)
2253-
or
2254-
partialPathThroughCallable(mid, node, cc, ap, config)
2255-
or
2256-
valuePartialPathThroughCallable(mid, node, cc, ap, config)
22572261
}
22582262

22592263
bindingset[result, i]

0 commit comments

Comments
 (0)