@@ -25,33 +25,38 @@ import codingstandards.cpp.sideeffect.DefaultEffects
2525 */
2626class UnevaluatedOperand extends Expr {
2727 Expr operator ;
28+
2829 UnevaluatedOperand ( ) {
2930 exists ( SizeofExprOperator op | op .getExprOperand ( ) = this |
30- not this .getUnderlyingType ( ) .( ArrayType ) .hasArraySize ( )
31- and operator = op
31+ not this .getUnderlyingType ( ) .( ArrayType ) .hasArraySize ( ) and
32+ operator = op
33+ )
34+ or
35+ exists ( NoExceptExpr e |
36+ e .getExpr ( ) = this and
37+ operator = e
3238 )
3339 or
34- exists ( NoExceptExpr e | e .getExpr ( ) = this
35- and operator = e )
36- or
37- exists ( TypeidOperator t | t .getExpr ( ) = this
38- and operator = t )
39- or
40- exists ( FunctionCall declval | declval .getTarget ( ) .hasQualifiedName ( "std" , "declval" )
41- and declval .getAChild ( ) = this
42- and operator = declval )
40+ exists ( TypeidOperator t |
41+ t .getExpr ( ) = this and
42+ operator = t
43+ )
44+ or
45+ exists ( FunctionCall declval |
46+ declval .getTarget ( ) .hasQualifiedName ( "std" , "declval" ) and
47+ declval .getAChild ( ) = this and
48+ operator = declval
49+ )
4350 }
4451
45- Expr getOp ( ) {
46- result = operator
47- }
52+ Expr getOp ( ) { result = operator }
4853}
4954
5055from BinaryLogicalOperation op , Expr rhs
5156where
5257 not isExcluded ( op ,
5358 SideEffects1Package:: rightHandOperandOfALogicalAndOperatorsContainSideEffectsQuery ( ) ) and
5459 rhs = op .getRightOperand ( ) and
55- hasSideEffect ( rhs )
56- and not exists ( UnevaluatedOperand un | un .getOp ( ) = rhs )
60+ hasSideEffect ( rhs ) and
61+ not exists ( UnevaluatedOperand un | un .getOp ( ) = rhs )
5762select op , "The $@ may have a side effect that is not always evaluated." , rhs , "right-hand operand"
0 commit comments