Skip to content

Commit 1bf0e01

Browse files
committed
Data flow: Cache clearsContent
1 parent 4009c01 commit 1bf0e01

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ private module LocalFlowBigStep {
12581258
private class FlowCheckNode extends Node {
12591259
FlowCheckNode() {
12601260
this instanceof CastNode or
1261-
clearsContent(this, _)
1261+
clearsContentCached(this, _)
12621262
}
12631263
}
12641264

@@ -3610,7 +3610,7 @@ private module FlowExploration {
36103610
or
36113611
exists(PartialPathNodeRev mid |
36123612
revPartialPathStep(mid, node, sc1, sc2, ap, config) and
3613-
not clearsContent(node, ap.getHead()) and
3613+
not clearsContentCached(node, ap.getHead()) and
36143614
not fullBarrier(node, config) and
36153615
distSink(getNodeEnclosingCallable(node), config) <= config.explorationLimit()
36163616
)
@@ -3624,7 +3624,7 @@ private module FlowExploration {
36243624
exists(PartialPathNodeFwd mid |
36253625
partialPathStep(mid, node, cc, sc1, sc2, ap, config) and
36263626
not fullBarrier(node, config) and
3627-
not clearsContent(node, ap.getHead().getContent()) and
3627+
not clearsContentCached(node, ap.getHead().getContent()) and
36283628
if node instanceof CastingNode
36293629
then compatibleTypes(getNodeDataFlowType(node), ap.getType())
36303630
else any()

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ private module Cached {
256256
cached
257257
predicate jumpStepCached(Node node1, Node node2) { jumpStep(node1, node2) }
258258

259+
cached
260+
predicate clearsContentCached(Node n, Content c) { clearsContent(n, c) }
261+
259262
/**
260263
* Gets a viable target for the lambda call `call`.
261264
*
@@ -1141,7 +1144,7 @@ abstract class AccessPathFront extends TAccessPathFront {
11411144

11421145
TypedContent getHead() { this = TFrontHead(result) }
11431146

1144-
predicate isClearedAt(Node n) { clearsContent(n, getHead().getContent()) }
1147+
predicate isClearedAt(Node n) { clearsContentCached(n, getHead().getContent()) }
11451148
}
11461149

11471150
class AccessPathFrontNil extends AccessPathFront, TFrontNil {

0 commit comments

Comments
 (0)