Skip to content

Commit 3dadfa2

Browse files
committed
Dataflow: review fixes
1 parent d285afb commit 3dadfa2

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
private import codeql.dataflow.DataFlow
22
private import codeql.typetracking.TypeTracking as Tt
3+
private import codeql.util.Unit
34

45
module MakeImplCommon<InputSig Lang> {
56
private import Lang
@@ -54,7 +55,10 @@ module MakeImplCommon<InputSig Lang> {
5455
override string toString() { result = "FeatureEqualSourceSinkCallContext" }
5556
}
5657

57-
signature predicate sourceNode(Node n);
58+
/**
59+
* Holds if `source` is a relevant data flow source.
60+
*/
61+
signature predicate sourceNode(Node source);
5862

5963
/**
6064
* EXPERIMENTAL: This API is subject to change without notice.
@@ -86,8 +90,8 @@ module MakeImplCommon<InputSig Lang> {
8690
string toString() { result = "Content" }
8791
}
8892

89-
class ContentFilter extends Content {
90-
Content getAMatchingContent() { result = this }
93+
class ContentFilter extends Unit {
94+
Content getAMatchingContent() { none() }
9195
}
9296

9397
predicate compatibleContents(Content storeContents, Content loadContents) {
@@ -102,6 +106,7 @@ module MakeImplCommon<InputSig Lang> {
102106
argumentValueFlowsThrough(n1, TReadStepTypesNone(), n2)
103107
}
104108

109+
// TODO: support setters
105110
predicate storeStep(Node n1, Node n2, Content f) { storeSet(n1, f, n2, _, _) }
106111

107112
predicate loadStep(Node n1, LocalSourceNode n2, Content f) {
@@ -720,7 +725,7 @@ module MakeImplCommon<InputSig Lang> {
720725
* If a read step was taken, then `read` captures the `Content`, the
721726
* container type, and the content type.
722727
*/
723-
pragma[nomagic]
728+
cached
724729
predicate argumentValueFlowsThrough(ArgNode arg, ReadStepTypesOption read, Node out) {
725730
exists(DataFlowCall call, ReturnKind kind |
726731
argumentValueFlowsThrough0(call, arg, kind, read) and

shared/util/codeql/util/Unit.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
private newtype TUnit = TMkUnit()
55

66
/** The trivial type with a single element. */
7-
class Unit extends TUnit {
7+
final class Unit extends TUnit {
88
/** Gets a textual representation of this element. */
99
string toString() { result = "unit" }
1010
}

0 commit comments

Comments
 (0)