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

Member predicate SwitchStmt::getInitialization

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

For example, for

switch (int x = y; b) { }

the result is int x = y;.

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

switch (b) { }

or

switch (; b) { }
Stmt getInitialization()