C++: Ignore complex guards and the comma operator

This commit is contained in:
Jeroen Ketema
2024-11-14 12:53:54 +01:00
parent 176acabd9d
commit b581723a63
3 changed files with 5 additions and 5 deletions

View File

@@ -40,5 +40,7 @@ where
strictcount(bb.(BlockStmt).getAStmt()) = 1
) and
strictcount(BasicBlock bb2 | gc.ensuresEq(_, 0, bb2, _) | bb2) = 1 and
not isAffectedByMacro(fc, bb)
not isAffectedByMacro(fc, bb) and
not (gc instanceof BinaryOperation and not gc instanceof ComparisonOperation) and
not exists(CommaExpr c | c.getAChild*() = fc)
select gc, "unnecessary NULL check before call to $@", fc, "free"