@@ -53,20 +53,27 @@ class WrongCheckErrorOperatorNew extends FunctionCall {
5353 * Holds if results call `operator new` check in `operator if`.
5454 */
5555 predicate isExistsIfCondition ( ) {
56- exists ( IfCompareWithZero ifc , AssignExpr aex , Initializer it |
56+ exists ( IfCompareWithZero ifc |
5757 // call `operator new` directly from the condition of `operator if`.
5858 this = ifc .getCondition ( ) .getAChild * ( )
5959 or
60- // check results call `operator new` with variable appropriation
6160 postDominates ( ifc , this ) and
62- aex .getAChild ( ) = exp and
63- ifc .getCondition ( ) .getAChild ( ) .( VariableAccess ) .getTarget ( ) =
64- aex .getLValue ( ) .( VariableAccess ) .getTarget ( )
65- or
66- // check results call `operator new` with declaration variable
67- postDominates ( ifc , this ) and
68- exp = it .getExpr ( ) and
69- it .getDeclaration ( ) = ifc .getCondition ( ) .getAChild ( ) .( VariableAccess ) .getTarget ( )
61+ exists ( Variable v |
62+ v = ifc .getCondition ( ) .getAChild ( ) .( VariableAccess ) .getTarget ( ) and
63+ (
64+ exists ( AssignExpr aex |
65+ // check results call `operator new` with variable appropriation
66+ aex .getAChild ( ) = exp and
67+ v = aex .getLValue ( ) .( VariableAccess ) .getTarget ( )
68+ )
69+ or
70+ exists ( Initializer it |
71+ // check results call `operator new` with declaration variable
72+ exp = it .getExpr ( ) and
73+ it .getDeclaration ( ) = v
74+ )
75+ )
76+ )
7077 )
7178 }
7279
0 commit comments