mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
SSA: Update input to use member predicates.
This commit is contained in:
@@ -1082,9 +1082,15 @@ class BasicBlock extends @py_flow_node {
|
||||
* Dominance frontier of a node x is the set of all nodes `other` such that `this` dominates a predecessor
|
||||
* of `other` but does not strictly dominate `other`
|
||||
*/
|
||||
pragma[noinline]
|
||||
predicate dominanceFrontier(BasicBlock other) {
|
||||
this.dominates(other.getAPredecessor()) and not this.strictlyDominates(other)
|
||||
predicate dominanceFrontier(BasicBlock other) { this.inDominanceFrontier(other) }
|
||||
|
||||
predicate inDominanceFrontier(BasicBlock df) {
|
||||
this = df.getAPredecessor() and not this = df.getImmediateDominator()
|
||||
or
|
||||
exists(BasicBlock prev | prev.inDominanceFrontier(df) |
|
||||
this = prev.getImmediateDominator() and
|
||||
not this = df.getImmediateDominator()
|
||||
)
|
||||
}
|
||||
|
||||
private ControlFlowNode firstNode() { result = this }
|
||||
|
||||
@@ -23,7 +23,9 @@ private module CaptureInput implements Shared::InputSig<Location> {
|
||||
predicate isConstructor() { none() }
|
||||
}
|
||||
|
||||
class BasicBlock extends PY::BasicBlock {
|
||||
final private class PyBasicBlock = PY::BasicBlock;
|
||||
|
||||
class BasicBlock extends PyBasicBlock {
|
||||
int length() { result = count(int i | exists(this.getNode(i))) }
|
||||
|
||||
Callable getEnclosingCallable() { result = this.getScope() }
|
||||
@@ -34,14 +36,16 @@ private module CaptureInput implements Shared::InputSig<Location> {
|
||||
// and we just need a way to identify the basic block
|
||||
// during debugging, so this will be serviceable.
|
||||
Location getLocation() { result = super.getNode(0).getLocation() }
|
||||
|
||||
BasicBlock getASuccessor() { result = super.getASuccessor() }
|
||||
|
||||
BasicBlock getImmediateDominator() { result = super.getImmediateDominator() }
|
||||
|
||||
predicate inDominanceFrontier(BasicBlock df) { super.inDominanceFrontier(df) }
|
||||
}
|
||||
|
||||
class ControlFlowNode = PY::ControlFlowNode;
|
||||
|
||||
BasicBlock getImmediateBasicBlockDominator(BasicBlock bb) { result = bb.getImmediateDominator() }
|
||||
|
||||
BasicBlock getABasicBlockSuccessor(BasicBlock bb) { result = bb.getASuccessor() }
|
||||
|
||||
class CapturedVariable extends LocalVariable {
|
||||
Function f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user