C/C++: Useless Test Fully converted verification

This commit is contained in:
BACK Yonah
2022-02-04 18:03:29 +01:00
parent 46c1744204
commit 34320cb57b

View File

@@ -1,3 +1,4 @@
/**
* @name Useless Test
* @description A boolean condition that is guaranteed to never be evaluated should be deleted.
@@ -38,6 +39,8 @@ where
) and
eq.getRightOperand() instanceof Literal and
ne.getRightOperand() instanceof Literal and
eq.getLeftOperand().getFullyConverted().getType() =
ne.getLeftOperand().getFullyConverted().getType() and
nearestParent(eq) = nearestParent(ne) and
sameExpr(eq.getLeftOperand(), ne.getLeftOperand())
select ne,"Useless Test"
select ne, "Useless Test"