mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
C++: Add comment on why getGuardedUpperBound must have exactly one predecessor
This commit is contained in:
@@ -1540,6 +1540,13 @@ private float getGuardedUpperBound(VariableAccess guardedAccess) {
|
||||
RangeSsaDefinition def, StackVariable v, VariableAccess guardVa, Expr guard, boolean branch
|
||||
|
|
||||
def.isGuardPhi(v, guardVa, guard, branch) and
|
||||
// If the basic block for the variable access being examined has
|
||||
// more than one predecessor, the guard phi node could originate
|
||||
// from one of the predecessors. This is because the guard phi
|
||||
// node is attached to the block at the end of the edge and not on
|
||||
// the actual edge. It is therefore possible to determine which
|
||||
// edge the guard phi node belongs to. The predicate below ensures
|
||||
// that there is one predecessor, albeit somewhat conservative.
|
||||
exists(unique(BasicBlock b | b = def.(BasicBlock).getAPredecessor())) and
|
||||
guardedAccess = def.getAUse(v) and
|
||||
result = max(float ub | upperBoundFromGuard(guard, guardVa, ub, branch))
|
||||
|
||||
Reference in New Issue
Block a user