From 77146e4e04b4a2bb087e2af53653d9d1bef2c8bb Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Fri, 4 Jun 2021 12:53:47 +0200 Subject: [PATCH] Data flow: Reduce caching These predicates are now cached in the shared implementation. --- .../dataflow/internal/DataFlowPrivate.qll | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ql/src/codeql_ruby/dataflow/internal/DataFlowPrivate.qll b/ql/src/codeql_ruby/dataflow/internal/DataFlowPrivate.qll index 55805c27e86..9de111c8444 100644 --- a/ql/src/codeql_ruby/dataflow/internal/DataFlowPrivate.qll +++ b/ql/src/codeql_ruby/dataflow/internal/DataFlowPrivate.qll @@ -177,18 +177,17 @@ private module Cached { cached newtype TContent = TTodoContent() // stub - - /** Holds if `n` should be hidden from path explanations. */ - cached - predicate nodeIsHidden(Node n) { - exists(Ssa::Definition def | def = n.(SsaDefinitionNode).getDefinition() | - def instanceof Ssa::PhiNode - ) - } } import Cached +/** Holds if `n` should be hidden from path explanations. */ +predicate nodeIsHidden(Node n) { + exists(Ssa::Definition def | def = n.(SsaDefinitionNode).getDefinition() | + def instanceof Ssa::PhiNode + ) +} + /** An SSA definition, viewed as a node in a data flow graph. */ class SsaDefinitionNode extends NodeImpl, TSsaDefinitionNode { Ssa::Definition def; @@ -308,7 +307,6 @@ import ParameterNodes /** A data-flow node that represents a call argument. */ abstract class ArgumentNode extends Node { /** Holds if this argument occurs at the given position in the given call. */ - cached abstract predicate argumentOf(DataFlowCall call, int pos); /** Gets the call in which this node is an argument. */ @@ -420,7 +418,6 @@ import ReturnNodes /** A data-flow node that represents the output of a call. */ abstract class OutNode extends Node { /** Gets the underlying call, where this node is a corresponding output of kind `kind`. */ - cached abstract DataFlowCall getCall(ReturnKind kind); }