mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python speed up calculation of ControlFlowNode.getAChild()
This commit is contained in:
@@ -401,13 +401,18 @@ class ControlFlowNode extends @py_flow_node {
|
||||
py_true_successors(this, _) or py_false_successors(this, _)
|
||||
}
|
||||
|
||||
/* Gets a CFG node that corresponds to a child of the AST node for this node */
|
||||
pragma [noinline]
|
||||
ControlFlowNode getAChild() {
|
||||
this.getNode().getAChildNode() = result.getNode() and
|
||||
result = this.getExprChild() and
|
||||
result.getBasicBlock().dominates(this.getBasicBlock())
|
||||
}
|
||||
|
||||
/* join-ordering helper for `getAChild() */
|
||||
pragma [noinline]
|
||||
private ControlFlowNode getExprChild() {
|
||||
this.getNode().(Expr).getAChildNode() = result.getNode() and
|
||||
not this instanceof UnaryExprNode
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1058,7 +1063,7 @@ class BasicBlock extends @py_flow_node {
|
||||
this.strictlyDominates(other)
|
||||
}
|
||||
|
||||
BasicBlock getImmediateDominator() {
|
||||
cached BasicBlock getImmediateDominator() {
|
||||
this.getAPart().getImmediateDominator() = result.getAPart()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user