@@ -233,32 +233,29 @@ class IgnorableAssignmentBitwiseOperation extends IgnorableOperation instanceof
233233class IgnorablePointerOrCharArithmetic extends IgnorableOperation {
234234 IgnorablePointerOrCharArithmetic ( ) {
235235 this instanceof BinaryArithmeticOperation and
236- (
237- this . ( BinaryArithmeticOperation ) . getAnOperand ( ) .getUnspecifiedType ( ) instanceof PointerType
236+ exists ( Expr op | op = this . ( BinaryArithmeticOperation ) . getAnOperand ( ) |
237+ op .getUnspecifiedType ( ) instanceof PointerType
238238 or
239- this . ( BinaryArithmeticOperation ) . getAnOperand ( ) .getUnspecifiedType ( ) instanceof CharType
239+ op .getUnspecifiedType ( ) instanceof CharType
240240 or
241241 // Operations on calls to functions that accept char or char*
242- this .( BinaryArithmeticOperation )
243- .getAnOperand ( )
244- .( Call )
245- .getAnArgument ( )
246- .getUnspecifiedType ( )
247- .stripType ( ) instanceof CharType
242+ op .( Call ) .getAnArgument ( ) .getUnspecifiedType ( ) .stripType ( ) instanceof CharType
248243 or
249244 // Operations on calls to functions named like "strlen", "wcslen", etc
250245 // NOTE: workaround for cases where the wchar_t type is not a char, but an unsigned short
251246 // unclear if there is a best way to filter cases like these out based on type info.
252- this . ( BinaryArithmeticOperation ) . getAnOperand ( ) .( Call ) .getTarget ( ) .getName ( ) .matches ( "%len%" )
247+ op .( Call ) .getTarget ( ) .getName ( ) .matches ( "%len%" )
253248 )
254249 or
255250 exists ( AssignArithmeticOperation a | a .getRValue ( ) = this |
256- a .getAnOperand ( ) .getUnspecifiedType ( ) instanceof PointerType
257- or
258- a .getAnOperand ( ) .getUnspecifiedType ( ) instanceof CharType
259- or
260- // Operations on calls to functions that accept char or char*
261- a .getAnOperand ( ) .( Call ) .getAnArgument ( ) .getUnspecifiedType ( ) .stripType ( ) instanceof CharType
251+ exists ( Expr op | op = a .getAnOperand ( ) |
252+ op .getUnspecifiedType ( ) instanceof PointerType
253+ or
254+ op .getUnspecifiedType ( ) instanceof CharType
255+ or
256+ // Operations on calls to functions that accept char or char*
257+ op .( Call ) .getAnArgument ( ) .getUnspecifiedType ( ) .stripType ( ) instanceof CharType
258+ )
262259 or
263260 // Operations on calls to functions named like "strlen", "wcslen", etc
264261 this .( BinaryArithmeticOperation ) .getAnOperand ( ) .( Call ) .getTarget ( ) .getName ( ) .matches ( "%len%" )
0 commit comments