Skip to content

Commit 34320cb

Browse files
committed
C/C++: Useless Test Fully converted verification
1 parent 46c1744 commit 34320cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cpp/ql/src/experimental/Best Practices/UselessTest.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/**
23
* @name Useless Test
34
* @description A boolean condition that is guaranteed to never be evaluated should be deleted.
@@ -38,6 +39,8 @@ where
3839
) and
3940
eq.getRightOperand() instanceof Literal and
4041
ne.getRightOperand() instanceof Literal and
42+
eq.getLeftOperand().getFullyConverted().getType() =
43+
ne.getLeftOperand().getFullyConverted().getType() and
4144
nearestParent(eq) = nearestParent(ne) and
4245
sameExpr(eq.getLeftOperand(), ne.getLeftOperand())
43-
select ne,"Useless Test"
46+
select ne, "Useless Test"

0 commit comments

Comments
 (0)