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

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) { }


switch (; b) { }
Stmt getInitialization()