Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 264301b

Browse files
committed
C++: Cache TNode and localFlowStep
These two elements weren't cached, which meant that local data flow was recalculated in every query that used data flow. They are also cached in the Java version of `DataFlowUtil.qll`.
1 parent 86e646b commit 264301b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import cpp
55
private import semmle.code.cpp.dataflow.internal.FlowVar
66

7+
cached
78
private newtype TNode =
89
TExprNode(Expr e) or
910
TParameterNode(Parameter p) { exists(p.getFunction().getBlock()) } or
@@ -161,6 +162,7 @@ private Variable asVariable(Node node) {
161162
* Holds if data flows from `nodeFrom` to `nodeTo` in exactly one local
162163
* (intra-procedural) step.
163164
*/
165+
cached
164166
predicate localFlowStep(Node nodeFrom, Node nodeTo) {
165167
// Expr -> Expr
166168
exprToExprStep_nocfg(nodeFrom.asExpr(), nodeTo.asExpr())

0 commit comments

Comments
 (0)