Skip to content

Commit 99e1a07

Browse files
committed
C++: Add a comment to the 'ConditionalBranchInstruction' case in 'additionalImpliesStep.
1 parent 2b47ac8 commit 99e1a07

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cpp/ql/lib/semmle/code/cpp/controlflow/IRGuards.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,15 @@ private module LogicInput_v1 implements GuardsImpl::LogicInputSig {
434434
predicate additionalImpliesStep(
435435
GuardsImpl::PreGuard g1, GuardValue v1, GuardsImpl::PreGuard g2, GuardValue v2
436436
) {
437+
// The `ConditionalBranch` instruction is the instruction for which there are
438+
// conditional successors out of. However, the condition that controls
439+
// which conditional successor is taken is given by the condition of the
440+
// `ConditionalBranch` instruction. So this step either needs to be here,
441+
// or we need `ConditionalBranch` instructions to be `IdExpr`s. Modeling
442+
// them as `IdExpr`s would be a bit weird since the result type is
443+
// `IRVoidType`. Including them here is fine as long as `ConditionalBranch`
444+
// instructions cannot be assigned to SSA variables (which they cannot
445+
// since they produce no value).
437446
g1.(ConditionalBranchInstruction).getCondition() = g2 and
438447
v1.asBooleanValue() = v2.asBooleanValue()
439448
}

0 commit comments

Comments
 (0)