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 {
1604
1604
* ```
1605
1605
* there are results `GREEN` and `BLUE`.
1606
1606
*/
1607
- pragma [ noopt]
1608
1607
EnumConstant getAMissingCase ( ) {
1609
1608
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
1616
1610
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 ( ) )
1629
1612
)
1630
1613
}
1614
+
1615
+ pragma [ noinline]
1616
+ private predicate matchesValue ( string value ) {
1617
+ value = this .getASwitchCase ( ) .getExpr ( ) .getValue ( )
1618
+ }
1631
1619
}
1632
1620
1633
1621
/**
You can’t perform that action at this time.
0 commit comments