@@ -25,33 +25,38 @@ import codingstandards.cpp.sideeffect.DefaultEffects
25
25
*/
26
26
class UnevaluatedOperand extends Expr {
27
27
Expr operator ;
28
+
28
29
UnevaluatedOperand ( ) {
29
30
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
32
38
)
33
39
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
+ )
43
50
}
44
51
45
- Expr getOp ( ) {
46
- result = operator
47
- }
52
+ Expr getOp ( ) { result = operator }
48
53
}
49
54
50
55
from BinaryLogicalOperation op , Expr rhs
51
56
where
52
57
not isExcluded ( op ,
53
58
SideEffects1Package:: rightHandOperandOfALogicalAndOperatorsContainSideEffectsQuery ( ) ) and
54
59
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 )
57
62
select op , "The $@ may have a side effect that is not always evaluated." , rhs , "right-hand operand"
0 commit comments