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

Member predicate IfStmt::getInitialization

Gets the initialization statement of this ‘if’ statement, if any.

For example, for

if (int x = y; b) { f(); }

the result is int x = y;.

Does not hold if the initialization statement is missing or an empty statement, as in

if (b) { f(); }

or

if (; b) { f(); }
Stmt getInitialization()