Skip to content

Commit b4856e9

Browse files
authored
Merge pull request #1780 from jbj/simpleLocalFlowStep
C++/C#/Java: Split localFlowStep predicate in two
2 parents 857cd91 + 6fc3a62 commit b4856e9

27 files changed

+70
-36
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private predicate isAdditionalFlowStep(
162162
* Holds if data can flow in one local step from `node1` to `node2`.
163163
*/
164164
private predicate localFlowStep(Node node1, Node node2, Configuration config) {
165-
localFlowStep(node1, node2) and
165+
simpleLocalFlowStep(node1, node2) and
166166
not outBarrier(node1, config) and
167167
not inBarrier(node2, config) and
168168
not fullBarrier(node1, config) and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private predicate isAdditionalFlowStep(
162162
* Holds if data can flow in one local step from `node1` to `node2`.
163163
*/
164164
private predicate localFlowStep(Node node1, Node node2, Configuration config) {
165-
localFlowStep(node1, node2) and
165+
simpleLocalFlowStep(node1, node2) and
166166
not outBarrier(node1, config) and
167167
not inBarrier(node2, config) and
168168
not fullBarrier(node1, config) and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private predicate isAdditionalFlowStep(
162162
* Holds if data can flow in one local step from `node1` to `node2`.
163163
*/
164164
private predicate localFlowStep(Node node1, Node node2, Configuration config) {
165-
localFlowStep(node1, node2) and
165+
simpleLocalFlowStep(node1, node2) and
166166
not outBarrier(node1, config) and
167167
not inBarrier(node2, config) and
168168
not fullBarrier(node1, config) and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private predicate isAdditionalFlowStep(
162162
* Holds if data can flow in one local step from `node1` to `node2`.
163163
*/
164164
private predicate localFlowStep(Node node1, Node node2, Configuration config) {
165-
localFlowStep(node1, node2) and
165+
simpleLocalFlowStep(node1, node2) and
166166
not outBarrier(node1, config) and
167167
not inBarrier(node2, config) and
168168
not fullBarrier(node1, config) and

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private module ImplCommon {
3535
or
3636
exists(Node mid |
3737
parameterValueFlowNoCtx(p, mid) and
38-
localFlowStep(mid, node) and
38+
simpleLocalFlowStep(mid, node) and
3939
compatibleTypes(p.getType(), node.getType())
4040
)
4141
or
@@ -152,7 +152,7 @@ private module ImplCommon {
152152
or
153153
exists(Node mid |
154154
parameterValueFlow(p, mid, cc) and
155-
localFlowStep(mid, node) and
155+
simpleLocalFlowStep(mid, node) and
156156
compatibleTypes(p.getType(), node.getType())
157157
)
158158
or
@@ -209,7 +209,7 @@ private module ImplCommon {
209209
* through a value-preserving method.
210210
*/
211211
private predicate localValueStep(Node node1, Node node2) {
212-
localFlowStep(node1, node2) or
212+
simpleLocalFlowStep(node1, node2) or
213213
argumentValueFlowsThrough(node1, node2, _)
214214
}
215215

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,18 @@ private module ThisFlow {
422422
* Holds if data flows from `nodeFrom` to `nodeTo` in exactly one local
423423
* (intra-procedural) step.
424424
*/
425-
cached
426425
predicate localFlowStep(Node nodeFrom, Node nodeTo) {
426+
simpleLocalFlowStep(nodeFrom, nodeTo)
427+
}
428+
429+
/**
430+
* INTERNAL: do not use.
431+
*
432+
* This is the local flow predicate that's used as a building block in global
433+
* data flow. It may have less flow than the `localFlowStep` predicate.
434+
*/
435+
cached
436+
predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
427437
// Expr -> Expr
428438
exprToExprStep_nocfg(nodeFrom.asExpr(), nodeTo.asExpr())
429439
or

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private predicate isAdditionalFlowStep(
162162
* Holds if data can flow in one local step from `node1` to `node2`.
163163
*/
164164
private predicate localFlowStep(Node node1, Node node2, Configuration config) {
165-
localFlowStep(node1, node2) and
165+
simpleLocalFlowStep(node1, node2) and
166166
not outBarrier(node1, config) and
167167
not inBarrier(node2, config) and
168168
not fullBarrier(node1, config) and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private predicate isAdditionalFlowStep(
162162
* Holds if data can flow in one local step from `node1` to `node2`.
163163
*/
164164
private predicate localFlowStep(Node node1, Node node2, Configuration config) {
165-
localFlowStep(node1, node2) and
165+
simpleLocalFlowStep(node1, node2) and
166166
not outBarrier(node1, config) and
167167
not inBarrier(node2, config) and
168168
not fullBarrier(node1, config) and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private predicate isAdditionalFlowStep(
162162
* Holds if data can flow in one local step from `node1` to `node2`.
163163
*/
164164
private predicate localFlowStep(Node node1, Node node2, Configuration config) {
165-
localFlowStep(node1, node2) and
165+
simpleLocalFlowStep(node1, node2) and
166166
not outBarrier(node1, config) and
167167
not inBarrier(node2, config) and
168168
not fullBarrier(node1, config) and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private predicate isAdditionalFlowStep(
162162
* Holds if data can flow in one local step from `node1` to `node2`.
163163
*/
164164
private predicate localFlowStep(Node node1, Node node2, Configuration config) {
165-
localFlowStep(node1, node2) and
165+
simpleLocalFlowStep(node1, node2) and
166166
not outBarrier(node1, config) and
167167
not inBarrier(node2, config) and
168168
not fullBarrier(node1, config) and

0 commit comments

Comments
 (0)