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

Member predicate WhileStmt::conditionAlwaysTrueUponEntry

Holds if the loop condition is provably true upon entry, that is, at least one iteration of the loop is guaranteed.

For example, with

bool done = false;
while (!done) { ... done = true; ... }

the condition !done always evaluates to true upon entry since done = false, but the condition may evaluate to false after some iterations.

predicate conditionAlwaysTrueUponEntry()