Skip to content

Commit 92e7a56

Browse files
committed
Python: Address review comments
1 parent 3a19b1e commit 92e7a56

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

python/ql/src/experimental/dataflow/internal/DataFlowPrivate.qll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ module EssaFlow {
147147
* excludes SSA flow through instance fields.
148148
*/
149149
predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
150-
exists(Node preUpdate |
151-
not preUpdate.(EssaNode).getVar() instanceof GlobalSsaVariable and
150+
// If there is ESSA-flow out of a node `node`, we want flow
151+
// both out of `node` and any post-update node of `node`.
152+
exists(Node node |
153+
not node.(EssaNode).getVar() instanceof GlobalSsaVariable and
152154
not nodeTo.(EssaNode).getVar() instanceof GlobalSsaVariable and
153-
EssaFlow::essaFlowStep(preUpdate, nodeTo) and
154-
nodeFrom = update(preUpdate)
155+
EssaFlow::essaFlowStep(node, nodeTo) and
156+
nodeFrom = update(node)
155157
)
156158
}
157159

python/ql/src/semmle/python/essa/SsaCompute.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ private module SsaComputeImpl {
194194
defUseRank(v, b, rankix, i)
195195
}
196196

197-
/** A `VarAccess` `use` of `v` in `b` at index `i`. */
197+
/** A variable access `use` of `v` in `b` at index `i`. */
198198
cached
199199
predicate variableUse(SsaSourceVariable v, ControlFlowNode use, BasicBlock b, int i) {
200200
(v.getAUse() = use or v.hasRefinement(use, _)) and
@@ -360,7 +360,7 @@ private module SsaComputeImpl {
360360
i = rank[rankix](int j | variableDefine(v, _, b, j) or variableSourceUse(v, _, b, j))
361361
}
362362

363-
/** A `VarAccess` `use` of `v` in `b` at index `i`. */
363+
/** A variable access `use` of `v` in `b` at index `i`. */
364364
cached
365365
predicate variableSourceUse(SsaSourceVariable v, ControlFlowNode use, BasicBlock b, int i) {
366366
v.getASourceUse() = use and
@@ -386,12 +386,12 @@ private module SsaComputeImpl {
386386
}
387387

388388
/**
389-
* Holds if `b2` is a transitive successor of `b1` and `v` occurs in `b1` [and
390-
* in `b2` or one of its transitive successors]? but not in any block on the path
389+
* Holds if `b2` is a transitive successor of `b1` and `v` occurs in `b1` and
390+
* in `b2` or one of its transitive successors but not in any block on the path
391391
* between `b1` and `b2`.
392392
*/
393393
private predicate varBlockReaches(SsaSourceVariable v, BasicBlock b1, BasicBlock b2) {
394-
varOccursInBlock(v, b1) and
394+
varOccursInBlock(v, b1) and
395395
b2 = b1.getASuccessor() and
396396
blockPrecedesVar(v, b2)
397397
or

0 commit comments

Comments
 (0)