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

Member predicate RangeBasedForStmt::getInitialization

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

For example, for

for (int x = y; auto z : ... ) { }

the result is int x = y;.

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

for (auto z : ...) { }

or

for (; auto z : ) { }
Stmt getInitialization()