Skip to content

Commit 51c48c7

Browse files
committed
Dataflow: Address review comments (take 2).
1 parent 4ff37cc commit 51c48c7

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,11 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
521521

522522
private module CallSetOption = Option<CallSets::ValueSet>;
523523

524+
/**
525+
* A set of call sites for which dispatch is affected by the call context.
526+
*
527+
* A `None` value indicates the empty set.
528+
*/
524529
private class CallSet = CallSetOption::Option;
525530

526531
private module DispatchSetsInput implements MkSetsInputSig {
@@ -544,6 +549,15 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
544549

545550
private module DispatchSetsOption = Option<DispatchSets::ValueSet>;
546551

552+
/**
553+
* A set of call edges that are allowed in the call context. This applies to
554+
* all calls in the associated `CallSet`, in particular, this means that if
555+
* a call has no associated edges in the `DispatchSet`, then either all
556+
* edges are allowed or none are depending on whether the call is in the
557+
* `CallSet`.
558+
*
559+
* A `None` value indicates the empty set.
560+
*/
547561
private class DispatchSet = DispatchSetsOption::Option;
548562

549563
private predicate relevantCtx(TCallEdge ctx) {
@@ -795,9 +809,10 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
795809
}
796810

797811
private LocalCallContext getLocalCallContext(CallContext ctx) {
798-
if exists(getUnreachable(ctx))
799-
then result = TSpecificLocalCall(getUnreachable(ctx))
800-
else result instanceof LocalCallContextAny
812+
result = TSpecificLocalCall(getUnreachable(ctx))
813+
or
814+
not exists(getUnreachable(ctx)) and
815+
result instanceof LocalCallContextAny
801816
}
802817

803818
bindingset[cc]

0 commit comments

Comments
 (0)