Skip to content

Commit 74eab3c

Browse files
committed
Dataflow: Fix qltest.
1 parent cedfaf6 commit 74eab3c

File tree

5 files changed

+37
-1
lines changed

5 files changed

+37
-1
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,15 @@ private module Cached {
300300
)
301301
}
302302

303+
/**
304+
* Holds if `arg` flows to `out` through a call using only
305+
* value-preserving steps and a single read step, not taking call
306+
* contexts into account, thus representing a getter-step.
307+
*/
308+
predicate getterStep(ArgumentNode arg, Content c, Node out) {
309+
argumentValueFlowsThrough(arg, TReadStepTypesSome(_, c, _), out)
310+
}
311+
303312
/**
304313
* Holds if `p` can flow to a return node of kind `kind` in the same
305314
* callable using only value-preserving steps and possibly a single read

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,15 @@ private module Cached {
300300
)
301301
}
302302

303+
/**
304+
* Holds if `arg` flows to `out` through a call using only
305+
* value-preserving steps and a single read step, not taking call
306+
* contexts into account, thus representing a getter-step.
307+
*/
308+
predicate getterStep(ArgumentNode arg, Content c, Node out) {
309+
argumentValueFlowsThrough(arg, TReadStepTypesSome(_, c, _), out)
310+
}
311+
303312
/**
304313
* Holds if `p` can flow to a return node of kind `kind` in the same
305314
* callable using only value-preserving steps and possibly a single read

csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,15 @@ private module Cached {
300300
)
301301
}
302302

303+
/**
304+
* Holds if `arg` flows to `out` through a call using only
305+
* value-preserving steps and a single read step, not taking call
306+
* contexts into account, thus representing a getter-step.
307+
*/
308+
predicate getterStep(ArgumentNode arg, Content c, Node out) {
309+
argumentValueFlowsThrough(arg, TReadStepTypesSome(_, c, _), out)
310+
}
311+
303312
/**
304313
* Holds if `p` can flow to a return node of kind `kind` in the same
305314
* callable using only value-preserving steps and possibly a single read

java/ql/src/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,15 @@ private module Cached {
300300
)
301301
}
302302

303+
/**
304+
* Holds if `arg` flows to `out` through a call using only
305+
* value-preserving steps and a single read step, not taking call
306+
* contexts into account, thus representing a getter-step.
307+
*/
308+
predicate getterStep(ArgumentNode arg, Content c, Node out) {
309+
argumentValueFlowsThrough(arg, TReadStepTypesSome(_, c, _), out)
310+
}
311+
303312
/**
304313
* Holds if `p` can flow to a return node of kind `kind` in the same
305314
* callable using only value-preserving steps and possibly a single read

java/ql/test/library-tests/dataflow/getter/getter.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import semmle.code.java.dataflow.internal.DataFlowImplSpecific::Private
66
from Node n1, Content f, Node n2
77
where
88
read(n1, f, n2) or
9-
argumentValueFlowsThrough(n1, TContentSome(f), n2, _, _)
9+
getterStep(n1, f, n2)
1010
select n1, n2, f

0 commit comments

Comments
 (0)