Skip to content

Commit 00df679

Browse files
committed
Dataflow: Sync
1 parent 2b4e3a7 commit 00df679

File tree

10 files changed

+40
-50
lines changed

10 files changed

+40
-50
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ private module Cached {
251251
predicate forceCachingInSameStage() { any() }
252252

253253
cached
254-
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = n.getEnclosingCallable() }
254+
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = nodeGetEnclosingCallable(n) }
255255

256256
cached
257257
predicate callEnclosingCallable(DataFlowCall call, DataFlowCallable c) {
@@ -316,9 +316,7 @@ private module Cached {
316316
}
317317

318318
cached
319-
predicate parameterNode(Node n, DataFlowCallable c, int i) {
320-
n.(ParameterNode).isParameterOf(c, i)
321-
}
319+
predicate parameterNode(Node p, DataFlowCallable c, int pos) { isParameterNode(p, c, pos) }
322320

323321
cached
324322
predicate argumentNode(Node n, DataFlowCall call, int pos) {

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module Consistency {
3131
query predicate uniqueEnclosingCallable(Node n, string msg) {
3232
exists(int c |
3333
n instanceof RelevantNode and
34-
c = count(n.getEnclosingCallable()) and
34+
c = count(nodeGetEnclosingCallable(n)) and
3535
c != 1 and
3636
msg = "Node should have one enclosing callable but has " + c + "."
3737
)
@@ -85,13 +85,13 @@ module Consistency {
8585
}
8686

8787
query predicate parameterCallable(ParameterNode p, string msg) {
88-
exists(DataFlowCallable c | p.isParameterOf(c, _) and c != p.getEnclosingCallable()) and
88+
exists(DataFlowCallable c | isParameterNode(p, c, _) and c != nodeGetEnclosingCallable(p)) and
8989
msg = "Callable mismatch for parameter."
9090
}
9191

9292
query predicate localFlowIsLocal(Node n1, Node n2, string msg) {
9393
simpleLocalFlowStep(n1, n2) and
94-
n1.getEnclosingCallable() != n2.getEnclosingCallable() and
94+
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
9595
msg = "Local flow step does not preserve enclosing callable."
9696
}
9797

@@ -106,7 +106,7 @@ module Consistency {
106106
query predicate unreachableNodeCCtx(Node n, DataFlowCall call, string msg) {
107107
isUnreachableInCall(n, call) and
108108
exists(DataFlowCallable c |
109-
c = n.getEnclosingCallable() and
109+
c = nodeGetEnclosingCallable(n) and
110110
not viableCallable(call) = c
111111
) and
112112
msg = "Call context for isUnreachableInCall is inconsistent with call graph."
@@ -120,7 +120,7 @@ module Consistency {
120120
n.(ArgumentNode).argumentOf(call, _) and
121121
msg = "ArgumentNode and call does not share enclosing callable."
122122
) and
123-
n.getEnclosingCallable() != call.getEnclosingCallable()
123+
nodeGetEnclosingCallable(n) != call.getEnclosingCallable()
124124
}
125125

126126
// This predicate helps the compiler forget that in some languages
@@ -151,7 +151,7 @@ module Consistency {
151151
}
152152

153153
query predicate postIsInSameCallable(PostUpdateNode n, string msg) {
154-
n.getEnclosingCallable() != n.getPreUpdateNode().getEnclosingCallable() and
154+
nodeGetEnclosingCallable(n) != nodeGetEnclosingCallable(n.getPreUpdateNode()) and
155155
msg = "PostUpdateNode does not share callable with its pre-update node."
156156
}
157157

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ private module Cached {
251251
predicate forceCachingInSameStage() { any() }
252252

253253
cached
254-
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = n.getEnclosingCallable() }
254+
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = nodeGetEnclosingCallable(n) }
255255

256256
cached
257257
predicate callEnclosingCallable(DataFlowCall call, DataFlowCallable c) {
@@ -316,9 +316,7 @@ private module Cached {
316316
}
317317

318318
cached
319-
predicate parameterNode(Node n, DataFlowCallable c, int i) {
320-
n.(ParameterNode).isParameterOf(c, i)
321-
}
319+
predicate parameterNode(Node p, DataFlowCallable c, int pos) { isParameterNode(p, c, pos) }
322320

323321
cached
324322
predicate argumentNode(Node n, DataFlowCall call, int pos) {

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module Consistency {
3131
query predicate uniqueEnclosingCallable(Node n, string msg) {
3232
exists(int c |
3333
n instanceof RelevantNode and
34-
c = count(n.getEnclosingCallable()) and
34+
c = count(nodeGetEnclosingCallable(n)) and
3535
c != 1 and
3636
msg = "Node should have one enclosing callable but has " + c + "."
3737
)
@@ -85,13 +85,13 @@ module Consistency {
8585
}
8686

8787
query predicate parameterCallable(ParameterNode p, string msg) {
88-
exists(DataFlowCallable c | p.isParameterOf(c, _) and c != p.getEnclosingCallable()) and
88+
exists(DataFlowCallable c | isParameterNode(p, c, _) and c != nodeGetEnclosingCallable(p)) and
8989
msg = "Callable mismatch for parameter."
9090
}
9191

9292
query predicate localFlowIsLocal(Node n1, Node n2, string msg) {
9393
simpleLocalFlowStep(n1, n2) and
94-
n1.getEnclosingCallable() != n2.getEnclosingCallable() and
94+
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
9595
msg = "Local flow step does not preserve enclosing callable."
9696
}
9797

@@ -106,7 +106,7 @@ module Consistency {
106106
query predicate unreachableNodeCCtx(Node n, DataFlowCall call, string msg) {
107107
isUnreachableInCall(n, call) and
108108
exists(DataFlowCallable c |
109-
c = n.getEnclosingCallable() and
109+
c = nodeGetEnclosingCallable(n) and
110110
not viableCallable(call) = c
111111
) and
112112
msg = "Call context for isUnreachableInCall is inconsistent with call graph."
@@ -120,7 +120,7 @@ module Consistency {
120120
n.(ArgumentNode).argumentOf(call, _) and
121121
msg = "ArgumentNode and call does not share enclosing callable."
122122
) and
123-
n.getEnclosingCallable() != call.getEnclosingCallable()
123+
nodeGetEnclosingCallable(n) != call.getEnclosingCallable()
124124
}
125125

126126
// This predicate helps the compiler forget that in some languages
@@ -151,7 +151,7 @@ module Consistency {
151151
}
152152

153153
query predicate postIsInSameCallable(PostUpdateNode n, string msg) {
154-
n.getEnclosingCallable() != n.getPreUpdateNode().getEnclosingCallable() and
154+
nodeGetEnclosingCallable(n) != nodeGetEnclosingCallable(n.getPreUpdateNode()) and
155155
msg = "PostUpdateNode does not share callable with its pre-update node."
156156
}
157157

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ private module Cached {
251251
predicate forceCachingInSameStage() { any() }
252252

253253
cached
254-
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = n.getEnclosingCallable() }
254+
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = nodeGetEnclosingCallable(n) }
255255

256256
cached
257257
predicate callEnclosingCallable(DataFlowCall call, DataFlowCallable c) {
@@ -316,9 +316,7 @@ private module Cached {
316316
}
317317

318318
cached
319-
predicate parameterNode(Node n, DataFlowCallable c, int i) {
320-
n.(ParameterNode).isParameterOf(c, i)
321-
}
319+
predicate parameterNode(Node p, DataFlowCallable c, int pos) { isParameterNode(p, c, pos) }
322320

323321
cached
324322
predicate argumentNode(Node n, DataFlowCall call, int pos) {

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module Consistency {
3131
query predicate uniqueEnclosingCallable(Node n, string msg) {
3232
exists(int c |
3333
n instanceof RelevantNode and
34-
c = count(n.getEnclosingCallable()) and
34+
c = count(nodeGetEnclosingCallable(n)) and
3535
c != 1 and
3636
msg = "Node should have one enclosing callable but has " + c + "."
3737
)
@@ -85,13 +85,13 @@ module Consistency {
8585
}
8686

8787
query predicate parameterCallable(ParameterNode p, string msg) {
88-
exists(DataFlowCallable c | p.isParameterOf(c, _) and c != p.getEnclosingCallable()) and
88+
exists(DataFlowCallable c | isParameterNode(p, c, _) and c != nodeGetEnclosingCallable(p)) and
8989
msg = "Callable mismatch for parameter."
9090
}
9191

9292
query predicate localFlowIsLocal(Node n1, Node n2, string msg) {
9393
simpleLocalFlowStep(n1, n2) and
94-
n1.getEnclosingCallable() != n2.getEnclosingCallable() and
94+
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
9595
msg = "Local flow step does not preserve enclosing callable."
9696
}
9797

@@ -106,7 +106,7 @@ module Consistency {
106106
query predicate unreachableNodeCCtx(Node n, DataFlowCall call, string msg) {
107107
isUnreachableInCall(n, call) and
108108
exists(DataFlowCallable c |
109-
c = n.getEnclosingCallable() and
109+
c = nodeGetEnclosingCallable(n) and
110110
not viableCallable(call) = c
111111
) and
112112
msg = "Call context for isUnreachableInCall is inconsistent with call graph."
@@ -120,7 +120,7 @@ module Consistency {
120120
n.(ArgumentNode).argumentOf(call, _) and
121121
msg = "ArgumentNode and call does not share enclosing callable."
122122
) and
123-
n.getEnclosingCallable() != call.getEnclosingCallable()
123+
nodeGetEnclosingCallable(n) != call.getEnclosingCallable()
124124
}
125125

126126
// This predicate helps the compiler forget that in some languages
@@ -151,7 +151,7 @@ module Consistency {
151151
}
152152

153153
query predicate postIsInSameCallable(PostUpdateNode n, string msg) {
154-
n.getEnclosingCallable() != n.getPreUpdateNode().getEnclosingCallable() and
154+
nodeGetEnclosingCallable(n) != nodeGetEnclosingCallable(n.getPreUpdateNode()) and
155155
msg = "PostUpdateNode does not share callable with its pre-update node."
156156
}
157157

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ private module Cached {
251251
predicate forceCachingInSameStage() { any() }
252252

253253
cached
254-
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = n.getEnclosingCallable() }
254+
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = nodeGetEnclosingCallable(n) }
255255

256256
cached
257257
predicate callEnclosingCallable(DataFlowCall call, DataFlowCallable c) {
@@ -316,9 +316,7 @@ private module Cached {
316316
}
317317

318318
cached
319-
predicate parameterNode(Node n, DataFlowCallable c, int i) {
320-
n.(ParameterNode).isParameterOf(c, i)
321-
}
319+
predicate parameterNode(Node p, DataFlowCallable c, int pos) { isParameterNode(p, c, pos) }
322320

323321
cached
324322
predicate argumentNode(Node n, DataFlowCall call, int pos) {

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module Consistency {
3131
query predicate uniqueEnclosingCallable(Node n, string msg) {
3232
exists(int c |
3333
n instanceof RelevantNode and
34-
c = count(n.getEnclosingCallable()) and
34+
c = count(nodeGetEnclosingCallable(n)) and
3535
c != 1 and
3636
msg = "Node should have one enclosing callable but has " + c + "."
3737
)
@@ -85,13 +85,13 @@ module Consistency {
8585
}
8686

8787
query predicate parameterCallable(ParameterNode p, string msg) {
88-
exists(DataFlowCallable c | p.isParameterOf(c, _) and c != p.getEnclosingCallable()) and
88+
exists(DataFlowCallable c | isParameterNode(p, c, _) and c != nodeGetEnclosingCallable(p)) and
8989
msg = "Callable mismatch for parameter."
9090
}
9191

9292
query predicate localFlowIsLocal(Node n1, Node n2, string msg) {
9393
simpleLocalFlowStep(n1, n2) and
94-
n1.getEnclosingCallable() != n2.getEnclosingCallable() and
94+
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
9595
msg = "Local flow step does not preserve enclosing callable."
9696
}
9797

@@ -106,7 +106,7 @@ module Consistency {
106106
query predicate unreachableNodeCCtx(Node n, DataFlowCall call, string msg) {
107107
isUnreachableInCall(n, call) and
108108
exists(DataFlowCallable c |
109-
c = n.getEnclosingCallable() and
109+
c = nodeGetEnclosingCallable(n) and
110110
not viableCallable(call) = c
111111
) and
112112
msg = "Call context for isUnreachableInCall is inconsistent with call graph."
@@ -120,7 +120,7 @@ module Consistency {
120120
n.(ArgumentNode).argumentOf(call, _) and
121121
msg = "ArgumentNode and call does not share enclosing callable."
122122
) and
123-
n.getEnclosingCallable() != call.getEnclosingCallable()
123+
nodeGetEnclosingCallable(n) != call.getEnclosingCallable()
124124
}
125125

126126
// This predicate helps the compiler forget that in some languages
@@ -151,7 +151,7 @@ module Consistency {
151151
}
152152

153153
query predicate postIsInSameCallable(PostUpdateNode n, string msg) {
154-
n.getEnclosingCallable() != n.getPreUpdateNode().getEnclosingCallable() and
154+
nodeGetEnclosingCallable(n) != nodeGetEnclosingCallable(n.getPreUpdateNode()) and
155155
msg = "PostUpdateNode does not share callable with its pre-update node."
156156
}
157157

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ private module Cached {
251251
predicate forceCachingInSameStage() { any() }
252252

253253
cached
254-
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = n.getEnclosingCallable() }
254+
predicate nodeEnclosingCallable(Node n, DataFlowCallable c) { c = nodeGetEnclosingCallable(n) }
255255

256256
cached
257257
predicate callEnclosingCallable(DataFlowCall call, DataFlowCallable c) {
@@ -316,9 +316,7 @@ private module Cached {
316316
}
317317

318318
cached
319-
predicate parameterNode(Node n, DataFlowCallable c, int i) {
320-
n.(ParameterNode).isParameterOf(c, i)
321-
}
319+
predicate parameterNode(Node p, DataFlowCallable c, int pos) { isParameterNode(p, c, pos) }
322320

323321
cached
324322
predicate argumentNode(Node n, DataFlowCall call, int pos) {

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module Consistency {
3131
query predicate uniqueEnclosingCallable(Node n, string msg) {
3232
exists(int c |
3333
n instanceof RelevantNode and
34-
c = count(n.getEnclosingCallable()) and
34+
c = count(nodeGetEnclosingCallable(n)) and
3535
c != 1 and
3636
msg = "Node should have one enclosing callable but has " + c + "."
3737
)
@@ -85,13 +85,13 @@ module Consistency {
8585
}
8686

8787
query predicate parameterCallable(ParameterNode p, string msg) {
88-
exists(DataFlowCallable c | p.isParameterOf(c, _) and c != p.getEnclosingCallable()) and
88+
exists(DataFlowCallable c | isParameterNode(p, c, _) and c != nodeGetEnclosingCallable(p)) and
8989
msg = "Callable mismatch for parameter."
9090
}
9191

9292
query predicate localFlowIsLocal(Node n1, Node n2, string msg) {
9393
simpleLocalFlowStep(n1, n2) and
94-
n1.getEnclosingCallable() != n2.getEnclosingCallable() and
94+
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
9595
msg = "Local flow step does not preserve enclosing callable."
9696
}
9797

@@ -106,7 +106,7 @@ module Consistency {
106106
query predicate unreachableNodeCCtx(Node n, DataFlowCall call, string msg) {
107107
isUnreachableInCall(n, call) and
108108
exists(DataFlowCallable c |
109-
c = n.getEnclosingCallable() and
109+
c = nodeGetEnclosingCallable(n) and
110110
not viableCallable(call) = c
111111
) and
112112
msg = "Call context for isUnreachableInCall is inconsistent with call graph."
@@ -120,7 +120,7 @@ module Consistency {
120120
n.(ArgumentNode).argumentOf(call, _) and
121121
msg = "ArgumentNode and call does not share enclosing callable."
122122
) and
123-
n.getEnclosingCallable() != call.getEnclosingCallable()
123+
nodeGetEnclosingCallable(n) != call.getEnclosingCallable()
124124
}
125125

126126
// This predicate helps the compiler forget that in some languages
@@ -151,7 +151,7 @@ module Consistency {
151151
}
152152

153153
query predicate postIsInSameCallable(PostUpdateNode n, string msg) {
154-
n.getEnclosingCallable() != n.getPreUpdateNode().getEnclosingCallable() and
154+
nodeGetEnclosingCallable(n) != nodeGetEnclosingCallable(n.getPreUpdateNode()) and
155155
msg = "PostUpdateNode does not share callable with its pre-update node."
156156
}
157157

0 commit comments

Comments
 (0)