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

Member predicate SwitchCase::getLastStmt

Gets the last statement under this ‘switch case’ statement. If the last statement is wrapped in one or more blocks then the result is the last statement in those blocks instead.

For example, for

switch (i) {
case 5:
    x = 1;
    break;
case 6:
case 7:
    { x = 2; break; }
default:
    { x = 3; { x = 4; break; } }
}

the case 5: has result break;, the case 6: has no result, the case 7: has results break;, and the default: has result break;.

Stmt getLastStmt()