Skip to content

Commit 06bd394

Browse files
committed
C++: Add a note for the other predicates as well.
1 parent 1f96200 commit 06bd394

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

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

+15-6
Original file line numberDiff line numberDiff line change
@@ -102,27 +102,34 @@ abstract private class GuardConditionImpl extends Expr {
102102
this.valueControls(controlled, any(BooleanValue bv | bv.getValue() = testIsTrue))
103103
}
104104

105-
/** Holds if (determined by this guard) `left < right + k` evaluates to `isLessThan` if this expression evaluates to `testIsTrue`. */
105+
/**
106+
* Holds if (determined by this guard) `left < right + k` evaluates to `isLessThan` if this
107+
* expression evaluates to `testIsTrue`. Note that there's a 4-argument
108+
* ("unary") and a 5-argument ("binary") version of this predicate (see `comparesEq`).
109+
*/
106110
pragma[inline]
107111
abstract predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue);
108112

109113
/**
110114
* Holds if (determined by this guard) `left < right + k` must be `isLessThan` in `block`.
111-
* If `isLessThan = false` then this implies `left >= right + k`.
115+
* If `isLessThan = false` then this implies `left >= right + k`. Note that there's a 4-argument
116+
* ("unary") and a 5-argument ("binary") version of this predicate (see `comparesEq`).
112117
*/
113118
pragma[inline]
114119
abstract predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan);
115120

116121
/**
117122
* Holds if (determined by this guard) `e < k` evaluates to `isLessThan` if
118-
* this expression evaluates to `value`.
123+
* this expression evaluates to `value`. Note that there's a 4-argument
124+
* ("unary") and a 5-argument ("binary") version of this predicate (see `comparesEq`).
119125
*/
120126
pragma[inline]
121127
abstract predicate comparesLt(Expr e, int k, boolean isLessThan, AbstractValue value);
122128

123129
/**
124130
* Holds if (determined by this guard) `e < k` must be `isLessThan` in `block`.
125-
* If `isLessThan = false` then this implies `e >= k`.
131+
* If `isLessThan = false` then this implies `e >= k`. Note that there's a 4-argument
132+
* ("unary") and a 5-argument ("binary") version of this predicate (see `comparesEq`).
126133
*/
127134
pragma[inline]
128135
abstract predicate ensuresLt(Expr e, int k, BasicBlock block, boolean isLessThan);
@@ -142,7 +149,8 @@ abstract private class GuardConditionImpl extends Expr {
142149

143150
/**
144151
* Holds if (determined by this guard) `left == right + k` must be `areEqual` in `block`.
145-
* If `areEqual = false` then this implies `left != right + k`.
152+
* If `areEqual = false` then this implies `left != right + k`. Note that there's a 4-argument
153+
* ("unary") and a 5-argument ("binary") version of this predicate (see `comparesEq`).
146154
*/
147155
pragma[inline]
148156
abstract predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual);
@@ -162,7 +170,8 @@ abstract private class GuardConditionImpl extends Expr {
162170

163171
/**
164172
* Holds if (determined by this guard) `e == k` must be `areEqual` in `block`.
165-
* If `areEqual = false` then this implies `e != k`.
173+
* If `areEqual = false` then this implies `e != k`. Note that there's a 4-argument
174+
* ("unary") and a 5-argument ("binary") version of this predicate (see `comparesEq`).
166175
*/
167176
pragma[inline]
168177
abstract predicate ensuresEq(Expr e, int k, BasicBlock block, boolean areEqual);

0 commit comments

Comments
 (0)