Skip to content

Commit b65a4e4

Browse files
committed
Dataflow: Postpone type pruning until stage 5.
1 parent 4933e80 commit b65a4e4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3931,15 +3931,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
39313931
private module Stage4Param implements MkStage<Stage3>::StageParam {
39323932
private module PrevStage = Stage3;
39333933

3934-
class Typ = DataFlowType;
3934+
class Typ = Unit;
39353935

39363936
class Ap = AccessPathFront;
39373937

39383938
class ApNil = AccessPathFrontNil;
39393939

39403940
PrevStage::Ap getApprox(Ap ap) { result = ap.toApprox() }
39413941

3942-
Typ getTyp(DataFlowType t) { result = t }
3942+
Typ getTyp(DataFlowType t) { any() }
39433943

39443944
bindingset[c, tail]
39453945
Ap apCons(Content c, Ap tail) { result.getHead() = c and exists(tail) }
@@ -3964,9 +3964,10 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
39643964
NodeEx node1, FlowState state1, NodeEx node2, FlowState state2, boolean preservesValue,
39653965
Typ t, LocalCc lcc, string label
39663966
) {
3967-
Stage3Param::localFlowBigStep(node1, state1, node2, state2, preservesValue, t, _, label) and
3967+
Stage3Param::localFlowBigStep(node1, state1, node2, state2, preservesValue, _, _, label) and
39683968
PrevStage::revFlow(node1, pragma[only_bind_into](state1), _) and
39693969
PrevStage::revFlow(node2, pragma[only_bind_into](state2), _) and
3970+
exists(t) and
39703971
exists(lcc)
39713972
}
39723973

@@ -4015,7 +4016,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
40154016
predicate filter(NodeEx node, FlowState state, Typ t0, Ap ap, Typ t) {
40164017
exists(state) and
40174018
not clear(node, ap) and
4018-
strengthenType(node, t0, t) and
4019+
t0 = t and
40194020
(
40204021
notExpectsContent(node)
40214022
or
@@ -4029,7 +4030,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
40294030
}
40304031

40314032
bindingset[t1, t2]
4032-
predicate typecheck(Typ t1, Typ t2) { compatibleTypesFilter(t1, t2) }
4033+
predicate typecheck(Typ t1, Typ t2) { any() }
40334034
}
40344035

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

0 commit comments

Comments
 (0)