Skip to content

Commit af8a3f2

Browse files
author
Robert Marsh
committed
C++: expand a comment
1 parent 0040a2d commit af8a3f2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cpp/ql/src/semmle/code/cpp/rangeanalysis/RangeAnalysis.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ private IRGuardCondition boundFlowCond(ValueNumber vn, NonPhiOperand bound, int
161161
{
162162
exists(int d |
163163
result.comparesLt(vn.getAUse(), bound, d, upper, testIsTrue) and
164-
// strengthen from x < y to x <= y-1
164+
/*
165+
* `comparesLt` provides bounds of the form `x < y + k` or `x >= y + k`, but we need
166+
* `x <= y + k` so we strengthen here. `testIsTrue` has the same semantics in `comparesLt` as
167+
* it does here, so we don't need to account for it.
168+
*/
165169
if upper = true
166170
then delta = d-1
167171
else delta = d

0 commit comments

Comments
 (0)