mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Python ESSA: Fix performance of PythonSsaSourceVariable.hasRefinementEdge()
This commit is contained in:
@@ -79,24 +79,12 @@ abstract class PythonSsaSourceVariable extends SsaSourceVariable {
|
||||
}
|
||||
|
||||
override predicate hasRefinementEdge(ControlFlowNode use, BasicBlock pred, BasicBlock succ) {
|
||||
test_contains(pred.getLastNode(), use) and
|
||||
use.(NameNode).uses(this) and
|
||||
exists(ControlFlowNode test |
|
||||
test.getAChild*() = use and
|
||||
test.isBranch() and
|
||||
test = pred.getLastNode()
|
||||
) and
|
||||
(pred.getAFalseSuccessor() = succ or pred.getATrueSuccessor() = succ)
|
||||
and
|
||||
(pred.getAFalseSuccessor() = succ or pred.getATrueSuccessor() = succ) and
|
||||
/* There is a store to this variable -- We don't want to refine builtins */
|
||||
exists(this.(Variable).getAStore()) and
|
||||
/* There is at least one use or definition of the variable that is reachable by the test */
|
||||
exists(ControlFlowNode n |
|
||||
n = this.getAUse() or
|
||||
this.hasDefiningNode(n) |
|
||||
pred.(ConditionBlock).strictlyReaches(n.getBasicBlock())
|
||||
)
|
||||
exists(this.(Variable).getAStore())
|
||||
}
|
||||
|
||||
override ControlFlowNode getASourceUse() {
|
||||
result.(NameNode).uses(this)
|
||||
or
|
||||
|
||||
Reference in New Issue
Block a user