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

Predicate relOpWithSwap

Holds if rel is a relational operation (<, >, <= or >=) with fully-converted children a and b, described by dir and strict.

This allows for the relation to be either as written, or with its arguments reversed; for example, if rel is x < 5 then both relOpWithSwap(rel, x, 5, Lesser(), Strict()) and relOpWithSwap(rel, 5, x, Greater(), Strict()) hold.

Import path

import semmle.code.cpp.rangeanalysis.RangeAnalysisUtils
predicate relOpWithSwap(RelationalOperation rel, Expr a, Expr b, RelationDirection dir, RelationStrictness strict)