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

Member predicate ConstexprIfStmt::getInitialization

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

For example, for

if constexpr (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 constexpr (b) { f(); }

or

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