From f7932dc1dfc01f331d18c86998e0d0a29367c42d Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Fri, 22 Nov 2024 10:18:32 +0100 Subject: [PATCH] Dataflow: Postpone type pruning until stage 5. --- .../codeql/dataflow/internal/DataFlowImpl.qll | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll b/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll index 752733496ddbe..3eddbddf36cec 100644 --- a/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll +++ b/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll @@ -3929,7 +3929,7 @@ module MakeImpl Lang> { private module Stage4Param implements MkStage::StageParam { private module PrevStage = Stage3; - class Typ = DataFlowType; + class Typ = Unit; class Ap = AccessPathFront; @@ -3937,7 +3937,7 @@ module MakeImpl Lang> { PrevStage::Ap getApprox(Ap ap) { result = ap.toApprox() } - Typ getTyp(DataFlowType t) { result = t } + Typ getTyp(DataFlowType t) { any() } bindingset[c, tail] Ap apCons(Content c, Ap tail) { result.getHead() = c and exists(tail) } @@ -3962,9 +3962,10 @@ module MakeImpl Lang> { NodeEx node1, FlowState state1, NodeEx node2, FlowState state2, boolean preservesValue, Typ t, LocalCc lcc, string label ) { - Stage3Param::localFlowBigStep(node1, state1, node2, state2, preservesValue, t, _, label) and + Stage3Param::localFlowBigStep(node1, state1, node2, state2, preservesValue, _, _, label) and PrevStage::revFlow(node1, pragma[only_bind_into](state1), _) and PrevStage::revFlow(node2, pragma[only_bind_into](state2), _) and + exists(t) and exists(lcc) } @@ -4013,7 +4014,7 @@ module MakeImpl Lang> { predicate filter(NodeEx node, FlowState state, Typ t0, Ap ap, Typ t) { exists(state) and not clear(node, ap) and - strengthenType(node, t0, t) and + t0 = t and ( notExpectsContent(node) or @@ -4027,7 +4028,7 @@ module MakeImpl Lang> { } bindingset[t1, t2] - predicate typecheck(Typ t1, Typ t2) { compatibleTypesFilter(t1, t2) } + predicate typecheck(Typ t1, Typ t2) { any() } } private module Stage4 = MkStage::Stage;