Skip to content

Commit efb43bc

Browse files
committed
PS: Match the changes from github#18696.
1 parent 61796da commit efb43bc

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

powershell/ql/lib/semmle/code/powershell/controlflow/BasicBlocks.qll

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,29 @@ final class BasicBlock extends BasicBlocksImpl::BasicBlock {
8585
*/
8686
BasicBlock getImmediateDominator() { result = super.getImmediateDominator() }
8787

88+
/**
89+
* Holds if the edge with successor type `s` out of this basic block is a
90+
* dominating edge for `dominated`.
91+
*
92+
* That is, all paths reaching `dominated` from the entry point basic
93+
* block must go through the `s` edge out of this basic block.
94+
*
95+
* Edge dominance is similar to node dominance except it concerns edges
96+
* instead of nodes: A basic block is dominated by a _basic block_ `bb` if it
97+
* can only be reached through `bb` and dominated by an _edge_ `s` if it can
98+
* only be reached through `s`.
99+
*
100+
* Note that where all basic blocks (except the entry basic block) are
101+
* strictly dominated by at least one basic block, a basic block may not be
102+
* dominated by any edge. If an edge dominates a basic block `bb`, then
103+
* both endpoints of the edge dominates `bb`. The converse is not the case,
104+
* as there may be multiple paths between the endpoints with none of them
105+
* dominating.
106+
*/
107+
predicate edgeDominates(BasicBlock dominated, SuccessorType s) {
108+
super.edgeDominates(dominated, s)
109+
}
110+
88111
/**
89112
* Holds if this basic block strictly post-dominates basic block `bb`.
90113
*
@@ -133,23 +156,4 @@ final class JoinBlockPredecessor extends BasicBlock, BasicBlocksImpl::JoinPredec
133156
* A basic block that terminates in a condition, splitting the subsequent
134157
* control flow.
135158
*/
136-
final class ConditionBlock extends BasicBlock, BasicBlocksImpl::ConditionBasicBlock {
137-
/**
138-
* Holds if basic block `succ` is immediately controlled by this basic
139-
* block with conditional value `s`. That is, `succ` is an immediate
140-
* successor of this block, and `succ` can only be reached from
141-
* the callable entry point by going via the `s` edge out of this basic block.
142-
*/
143-
predicate immediatelyControls(BasicBlock succ, ConditionalSuccessor s) {
144-
super.immediatelyControls(succ, s)
145-
}
146-
147-
/**
148-
* Holds if basic block `controlled` is controlled by this basic block with
149-
* conditional value `s`. That is, `controlled` can only be reached from the
150-
* callable entry point by going via the `s` edge out of this basic block.
151-
*/
152-
predicate controls(BasicBlock controlled, ConditionalSuccessor s) {
153-
super.controls(controlled, s)
154-
}
155-
}
159+
final class ConditionBlock extends BasicBlock, BasicBlocksImpl::ConditionBasicBlock { }

0 commit comments

Comments
 (0)