Merge pull request #16313 from hvitved/dataflow/fix-bad-join3

Data flow: Fix bad join
This commit is contained in:
Tom Hvitved
2024-04-24 17:09:14 +02:00
committed by GitHub

View File

@@ -1142,6 +1142,14 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
) )
} }
pragma[nomagic]
private predicate returnCallEdgeInCtx1(
DataFlowCallable c, SndLevelScopeOption scope, DataFlowCall call, NodeEx out, DataFlowCall ctx
) {
returnCallEdge1(c, scope, call, out) and
c = viableImplInCallContextExt(call, ctx)
}
private int ctxDispatchFanoutOnReturn(NodeEx out, DataFlowCall ctx) { private int ctxDispatchFanoutOnReturn(NodeEx out, DataFlowCall ctx) {
exists(DataFlowCall call, DataFlowCallable c | exists(DataFlowCall call, DataFlowCallable c |
simpleDispatchFanoutOnReturn(call, out) > 1 and simpleDispatchFanoutOnReturn(call, out) > 1 and
@@ -1151,8 +1159,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
mayBenefitFromCallContextExt(call, _) and mayBenefitFromCallContextExt(call, _) and
result = result =
count(DataFlowCallable tgt, SndLevelScopeOption scope | count(DataFlowCallable tgt, SndLevelScopeOption scope |
tgt = viableImplInCallContextExt(call, ctx) and returnCallEdgeInCtx1(tgt, scope, call, out, ctx)
returnCallEdge1(tgt, scope, call, out)
) )
) )
} }