Skip to content

Commit 0c88869

Browse files
committed
Data flow: Cache nodeIsHidden
1 parent 1112c0f commit 0c88869

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2986,7 +2986,7 @@ class PathNode extends TPathNode {
29862986
Configuration getConfiguration() { none() }
29872987

29882988
private predicate isHidden() {
2989-
nodeIsHidden(this.getNode()) and
2989+
hiddenNode(this.getNode()) and
29902990
not this.isSource() and
29912991
not this instanceof PathNodeSink
29922992
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ private DataFlowCallable viableCallableExt(DataFlowCall call) {
244244

245245
cached
246246
private module Cached {
247+
/**
248+
* If needed, call this predicate from `DataFlowImplSpecific.qll` in order to
249+
* force a stage-dependency on the `DataFlowImplCommon.qll` stage and therby
250+
* collapsing the two stages.
251+
*/
252+
cached
253+
predicate forceCachingInSameStage() { any() }
254+
247255
cached
248256
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = n.getEnclosingCallable() }
249257

@@ -271,6 +279,9 @@ private module Cached {
271279
n.(PostUpdateNode).getPreUpdateNode() instanceof ArgumentNodeExt
272280
}
273281

282+
cached
283+
predicate hiddenNode(Node n) { nodeIsHidden(n) }
284+
274285
cached
275286
OutNodeExt getAnOutNodeExt(DataFlowCall call, ReturnKindExt k) {
276287
result = getAnOutNode(call, k.(ValueReturnKind).getKind())

0 commit comments

Comments
 (0)