Skip to content

Commit 59b7458

Browse files
committed
C++: Add a test for cpp/empty-if (AI).
1 parent 868ba25 commit 59b7458

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
void emptyIfs(int value) {
2+
if (value) {} // $ Alert
3+
4+
if (value > 1) {
5+
} // $ Alert
6+
7+
if (value) {
8+
++value;
9+
}
10+
11+
if (value) {
12+
} else {
13+
++value;
14+
}
15+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| FutileConditional.cpp:2:3:2:15 | if (...) ... | If-statement with an empty then-branch and no else-branch. |
2+
| FutileConditional.cpp:4:3:5:3 | if (...) ... | If-statement with an empty then-branch and no else-branch. |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
query: Likely Bugs/Likely Typos/FutileConditional.ql
2+
postprocess: utils/test/InlineExpectationsTestQuery.ql

0 commit comments

Comments
 (0)