Data flow: Cache nodeIsHidden

This commit is contained in:
Tom Hvitved
2021-04-26 16:38:17 +02:00
parent 1112c0f994
commit 0c8886967b
2 changed files with 12 additions and 1 deletions

View File

@@ -2986,7 +2986,7 @@ class PathNode extends TPathNode {
Configuration getConfiguration() { none() }
private predicate isHidden() {
nodeIsHidden(this.getNode()) and
hiddenNode(this.getNode()) and
not this.isSource() and
not this instanceof PathNodeSink
}

View File

@@ -244,6 +244,14 @@ private DataFlowCallable viableCallableExt(DataFlowCall call) {
cached
private module Cached {
/**
* If needed, call this predicate from `DataFlowImplSpecific.qll` in order to
* force a stage-dependency on the `DataFlowImplCommon.qll` stage and therby
* collapsing the two stages.
*/
cached
predicate forceCachingInSameStage() { any() }
cached
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = n.getEnclosingCallable() }
@@ -271,6 +279,9 @@ private module Cached {
n.(PostUpdateNode).getPreUpdateNode() instanceof ArgumentNodeExt
}
cached
predicate hiddenNode(Node n) { nodeIsHidden(n) }
cached
OutNodeExt getAnOutNodeExt(DataFlowCall call, ReturnKindExt k) {
result = getAnOutNode(call, k.(ValueReturnKind).getKind())