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

Member predicate SwitchCase::getPreviousSwitchCase

Gets the previous SwitchCase belonging to the same ‘switch’ statement, if any.

For example, for

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

the default: has result case 7:, which has result case 6:, which has result case 5:, which has no result.

SwitchCase getPreviousSwitchCase()