Skip to content

Commit 73465d7

Browse files
committed
C++: Include the actual number of lower/upper bounds for added context in expected files
1 parent 0e41828 commit 73465d7

File tree

3 files changed

+5254
-5234
lines changed

3 files changed

+5254
-5234
lines changed

cpp/ql/lib/semmle/code/cpp/rangeanalysis/SimpleRangeAnalysis.qll

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2180,6 +2180,14 @@ module SimpleRangeAnalysisInternal {
21802180

21812181
/** Gets the estimate of the number of bounds for `e`. */
21822182
float estimateNrOfBounds(Expr e) { result = BoundsEstimate::nrOfBoundsExpr(e) }
2183+
2184+
float countNrOfLowerBounds(Expr e) {
2185+
result = strictcount(float lb | lb = getLowerBoundsImpl(e) | lb)
2186+
}
2187+
2188+
float countNrOfUpperBounds(Expr e) {
2189+
result = strictcount(float ub | ub = getUpperBoundsImpl(e) | ub)
2190+
}
21832191
}
21842192

21852193
/** Provides predicates for debugging the simple range analysis library. */
@@ -2208,7 +2216,7 @@ private module Debug {
22082216
*/
22092217
predicate countGetLowerBoundsImpl(Expr e, int n) {
22102218
e = getRelevantLocatable() and
2211-
n = strictcount(float lb | lb = getLowerBoundsImpl(e) | lb)
2219+
n = SimpleRangeAnalysisInternal::countNrOfLowerBounds(e)
22122220
}
22132221

22142222
float debugNrOfBounds(Expr e) {

0 commit comments

Comments
 (0)