Skip to content

Commit e00585c

Browse files
authored
Merge pull request #11154 from jketema/dataflow-test-fix
C++: Fix wrong return types and missing statement in dataflow test
2 parents d184819 + 0d4a223 commit e00585c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

cpp/ql/test/library-tests/dataflow/dataflow-tests/true_upon_entry.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ int source();
55
void sink(...);
66
bool random();
77

8-
int test1() {
8+
void test1() {
99
int x = source();
1010
for (int i = 0; i < 10; i++) {
1111
x = 0;
1212
}
1313
sink(x); // $ SPURIOUS: ir
1414
}
1515

16-
int test2(int iterations) {
16+
void test2(int iterations) {
1717
int x = source();
1818
for (int i = 0; i < iterations; i++) {
1919
x = 0;
2020
}
2121
sink(x); // $ ast,ir
2222
}
2323

24-
int test3() {
24+
void test3() {
2525
int x = 0;
2626
for (int i = 0; i < 10; i++) {
2727
x = source();
2828
}
2929
sink(x); // $ ast,ir
3030
}
3131

32-
int test4() {
32+
void test4() {
3333
int x = source();
3434
for (int i = 0; i < 10; i++) {
3535
if (random())
@@ -39,7 +39,7 @@ int test4() {
3939
sink(x); // $ ast,ir
4040
}
4141

42-
int test5() {
42+
void test5() {
4343
int x = source();
4444
for (int i = 0; i < 10; i++) {
4545
if (random())
@@ -49,15 +49,15 @@ int test5() {
4949
sink(x); // $ ast,ir
5050
}
5151

52-
int test6() {
52+
void test6() {
5353
int y;
5454
int x = source();
5555
for (int i = 0; i < 10 && (y = 1); i++) {
5656
}
5757
sink(x); // $ ast,ir
5858
}
5959

60-
int test7() {
60+
void test7() {
6161
int y;
6262
int x = source();
6363
for (int i = 0; i < 10 && (y = 1); i++) {
@@ -66,7 +66,7 @@ int test7() {
6666
sink(x); // $ SPURIOUS: ir
6767
}
6868

69-
int test8() {
69+
void test8() {
7070
int x = source();
7171
// It appears to the analysis that the condition can exit after `i < 10`
7272
// without having assigned to `x`. That is an effect of how the
@@ -78,29 +78,29 @@ int test8() {
7878
sink(x); // $ SPURIOUS: ast,ir
7979
}
8080

81-
int test9() {
81+
void test9() {
8282
int y;
8383
int x = source();
8484
for (int i = 0; (y = 1) && i < 10; i++) {
8585
}
8686
sink(x); // $ ast,ir
8787
}
8888

89-
int test10() {
89+
void test10() {
9090
int x = source();
9191
for (int i = 0; (x = 1) && i < 10; i++) {
9292
}
9393
sink(x); // no flow
9494
}
9595

96-
int test10(int b, int d) {
96+
void test10(int b, int d) {
9797
int i = 0;
9898
int x = source();
9999
if (b)
100100
goto L;
101101
for (; i < 10; i += d) {
102102
x = 0;
103-
L:
103+
L: ;
104104
}
105105
sink(x); // $ ir MISSING: ast
106106
}

0 commit comments

Comments
 (0)