Skip to content

Commit 26e22a0

Browse files
committed
Shared guards: add hook booleanOutcomeBlock
1 parent eec5e66 commit 26e22a0

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎shared/controlflow/codeql/controlflow/Guards.qll‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ signature module InputSig<LocationSig Location, TypSig ControlFlowNode, TypSig B
7878
BasicBlock getBasicBlock();
7979
}
8080

81+
/**
82+
* Holds if `outcomeBlock` contains a control flow node indicating that
83+
* `guard` evaluated to `branch`.
84+
*/
85+
default predicate booleanOutcomeBlock(Expr guard, BasicBlock outcomeBlock, boolean branch) {
86+
none()
87+
}
88+
8189
class ConstantValue {
8290
/** Gets a textual representation of this constant value. */
8391
string toString();
@@ -1427,6 +1435,11 @@ module Make<
14271435
dominatingEdge(guard, succ) and
14281436
succ.dominates(bb)
14291437
)
1438+
or
1439+
exists(BasicBlock outcomeBlock |
1440+
booleanOutcomeBlock(this, outcomeBlock, v.asBooleanValue()) and
1441+
outcomeBlock.dominates(bb)
1442+
)
14301443
}
14311444

14321445
/**

0 commit comments

Comments
 (0)