Skip to content

Commit e5eabc4

Browse files
committed
C++: Slightly tweak nullness test and update test results
1 parent d63b094 commit e5eabc4

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

cpp/ql/test/library-tests/controlflow/nullness/nullness.expected

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@
77
| test.cpp:15:8:15:23 | call to __builtin_expect | test.cpp:5:13:5:13 | v | is not null | is valid |
88
| test.cpp:16:8:16:23 | call to __builtin_expect | test.cpp:5:13:5:13 | v | is null | is not valid |
99
| test.cpp:17:9:17:17 | ... && ... | test.cpp:5:13:5:13 | v | is not null | is valid |
10-
| test.cpp:18:9:18:17 | ... && ... | test.cpp:5:13:5:13 | v | is not null | is not valid |
10+
| test.cpp:18:9:18:17 | ... && ... | test.cpp:5:13:5:13 | v | is not null | is valid |
1111
| test.cpp:19:9:19:18 | ... && ... | test.cpp:5:13:5:13 | v | is null | is not valid |
12-
| test.cpp:20:9:20:18 | ... && ... | test.cpp:5:13:5:13 | v | is not null | is not valid |
12+
| test.cpp:20:9:20:18 | ... && ... | test.cpp:5:13:5:13 | v | is null | is not valid |
1313
| test.cpp:21:9:21:14 | ... = ... | test.cpp:5:13:5:13 | v | is null | is not valid |
1414
| test.cpp:21:9:21:14 | ... = ... | test.cpp:7:10:7:10 | b | is not null | is valid |
15-
| test.cpp:22:17:22:17 | b | test.cpp:7:10:7:10 | b | is not null | is valid |
15+
| test.cpp:22:9:22:14 | ... = ... | test.cpp:5:13:5:13 | v | is not null | is not valid |
16+
| test.cpp:22:9:22:14 | ... = ... | test.cpp:7:13:7:13 | c | is not null | is not valid |
17+
| test.cpp:22:17:22:17 | c | test.cpp:7:13:7:13 | c | is not null | is valid |
18+
| test.cpp:23:21:23:21 | x | test.cpp:23:14:23:14 | x | is not null | is valid |
19+
| test.cpp:24:9:24:18 | (condition decl) | test.cpp:5:13:5:13 | v | is not null | is not valid |
20+
| test.cpp:24:9:24:18 | (condition decl) | test.cpp:24:14:24:14 | y | is not null | is valid |

cpp/ql/test/library-tests/controlflow/nullness/nullness.ql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import cpp
22

33
from AnalysedExpr a, LocalScopeVariable v, string isNullCheck, string isValidCheck
44
where
5-
a.getParent() instanceof IfStmt and
65
v.getAnAccess().getEnclosingStmt() = a.getParent() and
76
(if a.isNullCheck(v) then isNullCheck = "is null" else isNullCheck = "is not null") and
87
(if a.isValidCheck(v) then isValidCheck = "is valid" else isValidCheck = "is not valid")

cpp/ql/test/library-tests/controlflow/nullness/test.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ long __builtin_expect(long);
44

55
void f(int *v) {
66
int *w;
7-
bool b;
7+
bool b, c;
88

99
if (v) {}
1010
if (!v) {}
@@ -19,5 +19,7 @@ void f(int *v) {
1919
if (true && !v) {}
2020
if (!v && true) {}
2121
if (b = !v) {}
22-
if (b = !v; b) {}
22+
if (c = !v; c) {}
23+
if (int *x = v; x) {}
24+
if (int *y = v) {}
2325
}

0 commit comments

Comments
 (0)