Skip to content

Commit 4ff37cc

Browse files
committed
Dataflow: Address review comments.
1 parent 8085460 commit 4ff37cc

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,12 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
13691369

13701370
CcCall ccSomeCall();
13711371

1372+
/*
1373+
* The following `instanceof` predicates are necessary for proper
1374+
* caching, since we're able to cache predicates, but not the underlying
1375+
* types.
1376+
*/
1377+
13721378
predicate instanceofCc(Cc cc);
13731379

13741380
predicate instanceofCcCall(CcCall cc);

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
502502
)
503503
}
504504

505-
private module CallSetsInput implements MkSetsInp {
505+
private module CallSetsInput implements MkSetsInputSig {
506506
class Key = TCallEdge;
507507

508508
class Value = DataFlowCall;
@@ -523,7 +523,7 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
523523

524524
private class CallSet = CallSetOption::Option;
525525

526-
private module DispatchSetsInput implements MkSetsInp {
526+
private module DispatchSetsInput implements MkSetsInputSig {
527527
class Key = TCallEdge;
528528

529529
class Value = TCallEdge;
@@ -585,10 +585,11 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
585585
*
586586
* There are four cases:
587587
* - `TAnyCallContext()` : No restrictions on method flow.
588-
* - `TSpecificCall(DataFlowCall call)` : Flow entered through the
589-
* given `call`. This call improves the set of viable
590-
* dispatch targets for at least one method call in the current callable
591-
* or helps prune unreachable nodes in the current callable.
588+
* - `TSpecificCall(CallSet calls, DispatchSet tgts, UnreachableSetOption unreachable)` :
589+
* Flow entered through a specific call that improves the set of viable
590+
* dispatch targets for all of `calls` to the set of dispatch targets in
591+
* `tgts`, and/or the specific call prunes unreachable nodes in the
592+
* current callable as given by `unreachable`.
592593
* - `TSomeCall()` : Flow entered through a parameter. The
593594
* originating call does not improve the set of dispatch targets for any
594595
* method call in the current callable and was therefore not recorded.
@@ -1498,7 +1499,7 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
14981499
cached
14991500
int callOrder(DataFlowCall call) { result = call.totalorder() }
15001501

1501-
private module UnreachableSetsInput implements MkSetsInp {
1502+
private module UnreachableSetsInput implements MkSetsInputSig {
15021503
class Key = TCallEdge;
15031504

15041505
class Value = NodeRegion;

shared/util/codeql/util/internal/MakeSets.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
/** The input signature for `MakeSets`. */
8-
signature module MkSetsInp {
8+
signature module MkSetsInputSig {
99
class Key;
1010

1111
class Value;
@@ -31,7 +31,7 @@ signature module MkSetsInp {
3131
* reasonable fallback where `getValueSet(k).contains(v)` remains equivalent to
3232
* `v = getAValue(k)`.
3333
*/
34-
module MakeSets<MkSetsInp Inp> {
34+
module MakeSets<MkSetsInputSig Inp> {
3535
private import Inp
3636

3737
private int totalorderExt(Value v) {
@@ -53,7 +53,7 @@ module MakeSets<MkSetsInp Inp> {
5353
private newtype TValList =
5454
TValListNil() or
5555
TValListCons(Value head, int r, TValList tail) { hasValListCons(_, head, r, tail) } or
56-
TValListUnordered(Key k) { exists(getAValue(k)) and unordered(k) }
56+
TValListUnordered(Key k) { unordered(k) }
5757

5858
private predicate hasValListCons(Key k, Value head, int r, TValList tail) {
5959
rankedValue(k, head, r) and

0 commit comments

Comments
 (0)