CodeQL library for Java
codeql/java-all 0.3.2 (changelog, source)
Search

Predicate integerGuard

An expression that directly tests whether a given expression is equal to k or not. The set of ks is restricted to those that are relevant for the expression or have a direct comparison with the expression.

If result evaluates to branch, then e is guaranteed to be equal to k if is_k is true, and different from k if is_k is false.

Import path

import semmle.code.java.dataflow.IntegerGuards
Expr integerGuard(IntComparableExpr e, boolean branch, int k, boolean is_k)