Skip to content

Commit d0bd6eb

Browse files
committed
C++: Remove the type restriction on 'GuardConditionFromNotExpr' since this class also applies to C++.
1 parent 54faba2 commit d0bd6eb

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

cpp/ql/lib/semmle/code/cpp/controlflow/IRGuards.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ private class GuardConditionFromNotExpr extends GuardConditionImpl {
268268
exists(NotExpr notExpr, Type t |
269269
this = notExpr.getOperand() and
270270
t = this.getUnspecifiedType() and
271-
not t instanceof BoolType and
272271
ir.getUnconvertedResultExpression() = notExpr
273272
)
274273
}

cpp/ql/test/library-tests/controlflow/guards/GuardsCompare.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,13 @@
262262
| 122 | b == 0 when b is false |
263263
| 122 | b == 1 when b is true |
264264
| 125 | ! ... != 0 when ! ... is true |
265+
| 125 | ! ... != 0 when call to safe is false |
265266
| 125 | ! ... != 1 when ! ... is false |
267+
| 125 | ! ... != 1 when call to safe is true |
266268
| 125 | ! ... == 0 when ! ... is false |
269+
| 125 | ! ... == 0 when call to safe is true |
267270
| 125 | ! ... == 1 when ! ... is true |
271+
| 125 | ! ... == 1 when call to safe is false |
268272
| 125 | call to safe != 0 when ! ... is false |
269273
| 125 | call to safe != 0 when call to safe is true |
270274
| 125 | call to safe != 1 when ! ... is true |

cpp/ql/test/library-tests/controlflow/guards/GuardsEnsure.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,8 @@ unary
540540
| test.cpp:125:13:125:20 | ! ... | test.cpp:125:13:125:20 | ! ... | == | 1 | 125 | 125 |
541541
| test.cpp:125:13:125:20 | ! ... | test.cpp:125:14:125:17 | call to safe | != | 1 | 125 | 125 |
542542
| test.cpp:125:13:125:20 | ! ... | test.cpp:125:14:125:17 | call to safe | == | 0 | 125 | 125 |
543+
| test.cpp:125:14:125:17 | call to safe | test.cpp:125:13:125:20 | ! ... | != | 0 | 125 | 125 |
544+
| test.cpp:125:14:125:17 | call to safe | test.cpp:125:13:125:20 | ! ... | == | 1 | 125 | 125 |
543545
| test.cpp:125:14:125:17 | call to safe | test.cpp:125:14:125:17 | call to safe | != | 1 | 125 | 125 |
544546
| test.cpp:125:14:125:17 | call to safe | test.cpp:125:14:125:17 | call to safe | == | 0 | 125 | 125 |
545547
| test.cpp:131:6:131:21 | call to __builtin_expect | test.cpp:131:6:131:21 | call to __builtin_expect | != | 0 | 131 | 132 |

0 commit comments

Comments
 (0)