Predicate exprMaxVal
Gets the maximum value that this expression could represent, based on its type.
For example, if expr
has a signed 32-bit type then the result is
2^31 - 1
.
Note: Due to the way casts are represented, rather than calling
exprMaxVal(expr)
you will normally want to call
exprMaxVal(expr.getFullyConverted())
.
Import path
import semmle.code.cpp.rangeanalysis.RangeAnalysisUtils
float exprMaxVal(Expr expr)