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 ed0cd71 commit 5feb737
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 @@ -3931,15 +3931,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 @@ -3964,9 +3964,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 @@ -4015,7 +4016,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 @@ -4029,7 +4030,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 5feb737

Please sign in to comment.