CodeQL library for C/C++
codeql/cpp-all 2.1.2-dev (changelog, source)
Search

Predicate linearAccess

Holds if expr is equivalent to p*v + q, where p is a non-zero number. This takes into account the associativity, commutativity and distributivity of arithmetic operations.

Import path

import semmle.code.cpp.rangeanalysis.RangeAnalysisUtils
predicate linearAccess(Expr expr, VariableAccess v, float p, float q)