mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Python: Address review comments
This commit is contained in:
@@ -147,11 +147,13 @@ module EssaFlow {
|
||||
* excludes SSA flow through instance fields.
|
||||
*/
|
||||
predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
|
||||
exists(Node preUpdate |
|
||||
not preUpdate.(EssaNode).getVar() instanceof GlobalSsaVariable and
|
||||
// If there is ESSA-flow out of a node `node`, we want flow
|
||||
// both out of `node` and any post-update node of `node`.
|
||||
exists(Node node |
|
||||
not node.(EssaNode).getVar() instanceof GlobalSsaVariable and
|
||||
not nodeTo.(EssaNode).getVar() instanceof GlobalSsaVariable and
|
||||
EssaFlow::essaFlowStep(preUpdate, nodeTo) and
|
||||
nodeFrom = update(preUpdate)
|
||||
EssaFlow::essaFlowStep(node, nodeTo) and
|
||||
nodeFrom = update(node)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ private module SsaComputeImpl {
|
||||
defUseRank(v, b, rankix, i)
|
||||
}
|
||||
|
||||
/** A `VarAccess` `use` of `v` in `b` at index `i`. */
|
||||
/** A variable access `use` of `v` in `b` at index `i`. */
|
||||
cached
|
||||
predicate variableUse(SsaSourceVariable v, ControlFlowNode use, BasicBlock b, int i) {
|
||||
(v.getAUse() = use or v.hasRefinement(use, _)) and
|
||||
@@ -360,7 +360,7 @@ private module SsaComputeImpl {
|
||||
i = rank[rankix](int j | variableDefine(v, _, b, j) or variableSourceUse(v, _, b, j))
|
||||
}
|
||||
|
||||
/** A `VarAccess` `use` of `v` in `b` at index `i`. */
|
||||
/** A variable access `use` of `v` in `b` at index `i`. */
|
||||
cached
|
||||
predicate variableSourceUse(SsaSourceVariable v, ControlFlowNode use, BasicBlock b, int i) {
|
||||
v.getASourceUse() = use and
|
||||
@@ -386,12 +386,12 @@ private module SsaComputeImpl {
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `b2` is a transitive successor of `b1` and `v` occurs in `b1` [and
|
||||
* in `b2` or one of its transitive successors]? but not in any block on the path
|
||||
* Holds if `b2` is a transitive successor of `b1` and `v` occurs in `b1` and
|
||||
* in `b2` or one of its transitive successors but not in any block on the path
|
||||
* between `b1` and `b2`.
|
||||
*/
|
||||
private predicate varBlockReaches(SsaSourceVariable v, BasicBlock b1, BasicBlock b2) {
|
||||
varOccursInBlock(v, b1) and
|
||||
varOccursInBlock(v, b1) and
|
||||
b2 = b1.getASuccessor() and
|
||||
blockPrecedesVar(v, b2)
|
||||
or
|
||||
|
||||
Reference in New Issue
Block a user