Skip to content

Commit

Permalink
Dataflow: Postpone type pruning until stage 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
aschackmull committed Dec 2, 2024
1 parent 0225509 commit f7932dc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll
Original file line number Diff line number Diff line change
Expand Up @@ -3929,15 +3929,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
private module Stage4Param implements MkStage<Stage3>::StageParam {
private module PrevStage = Stage3;

class Typ = DataFlowType;
class Typ = Unit;

class Ap = AccessPathFront;

class ApNil = AccessPathFrontNil;

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) }
Expand All @@ -3962,9 +3962,10 @@ module MakeImpl<LocationSig Location, InputSig<Location> 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)
}

Expand Down Expand Up @@ -4013,7 +4014,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> 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
Expand All @@ -4027,7 +4028,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
}

bindingset[t1, t2]
predicate typecheck(Typ t1, Typ t2) { compatibleTypesFilter(t1, t2) }
predicate typecheck(Typ t1, Typ t2) { any() }
}

private module Stage4 = MkStage<Stage3>::Stage<Stage4Param>;
Expand Down

0 comments on commit f7932dc

Please sign in to comment.