File tree Expand file tree Collapse file tree 1 file changed +7
-19
lines changed
cpp/ql/src/semmle/code/cpp/stmts Expand file tree Collapse file tree 1 file changed +7
-19
lines changed Original file line number Diff line number Diff line change @@ -1604,30 +1604,18 @@ class EnumSwitch extends SwitchStmt {
16041604 * ```
16051605 * there are results `GREEN` and `BLUE`.
16061606 */
1607- pragma [ noopt]
16081607 EnumConstant getAMissingCase ( ) {
16091608 exists ( Enum et |
1610- exists ( Expr e , Type t |
1611- e = this .getExpr ( ) and
1612- this instanceof EnumSwitch and
1613- t = e .getType ( ) and
1614- et = t .getUnderlyingType ( )
1615- ) and
1609+ et = this .getExpr ( ) .getUnderlyingType ( ) and
16161610 result = et .getAnEnumConstant ( ) and
1617- not exists ( string value |
1618- exists ( SwitchCase sc , Expr e |
1619- sc = this .getASwitchCase ( ) and
1620- e = sc .getExpr ( ) and
1621- value = e .getValue ( )
1622- ) and
1623- exists ( Initializer init , Expr e |
1624- init = result .getInitializer ( ) and
1625- e = init .getExpr ( ) and
1626- e .getValue ( ) = value
1627- )
1628- )
1611+ not this .matchesValue ( result .getInitializer ( ) .getExpr ( ) .getValue ( ) )
16291612 )
16301613 }
1614+
1615+ pragma [ noinline]
1616+ private predicate matchesValue ( string value ) {
1617+ value = this .getASwitchCase ( ) .getExpr ( ) .getValue ( )
1618+ }
16311619}
16321620
16331621/**
You can’t perform that action at this time.
0 commit comments