Skip to content

Commit 2bef82b

Browse files
authored
Merge pull request github#11163 from jketema/missing-return
C++: Add dataflow test that deliberately omits the return of a non-void function
2 parents d93bda2 + fa2d58a commit 2bef82b

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-consistency.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,7 @@ postWithInFlow
8787
| test.cpp:465:3:465:4 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
8888
| test.cpp:465:4:465:4 | p [inner post update] | PostUpdateNode should not be the target of local flow. |
8989
| test.cpp:470:22:470:22 | x [inner post update] | PostUpdateNode should not be the target of local flow. |
90+
| test.cpp:499:3:499:4 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
91+
| test.cpp:499:4:499:4 | p [inner post update] | PostUpdateNode should not be the target of local flow. |
92+
| test.cpp:505:35:505:35 | x [inner post update] | PostUpdateNode should not be the target of local flow. |
9093
viableImplInCallContextTooLarge

cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,13 @@ postWithInFlow
582582
| test.cpp:489:7:489:7 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
583583
| test.cpp:491:5:491:5 | x [post update] | PostUpdateNode should not be the target of local flow. |
584584
| test.cpp:494:5:494:5 | x [post update] | PostUpdateNode should not be the target of local flow. |
585+
| test.cpp:499:3:499:4 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
586+
| test.cpp:499:4:499:4 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
587+
| test.cpp:499:4:499:4 | p [post update] | PostUpdateNode should not be the target of local flow. |
588+
| test.cpp:504:7:504:7 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
589+
| test.cpp:505:34:505:35 | & ... [post update] | PostUpdateNode should not be the target of local flow. |
590+
| test.cpp:505:34:505:35 | & ... [post update] | PostUpdateNode should not be the target of local flow. |
591+
| test.cpp:505:35:505:35 | x [post update] | PostUpdateNode should not be the target of local flow. |
585592
| true_upon_entry.cpp:9:7:9:7 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
586593
| true_upon_entry.cpp:10:12:10:12 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
587594
| true_upon_entry.cpp:10:27:10:27 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,3 +494,14 @@ void regression_with_phi_flow(int clean1) {
494494
x = source();
495495
}
496496
}
497+
498+
int intOutparamSourceMissingReturn(int *p) {
499+
*p = source();
500+
// return deliberately omitted to test IR dataflow behavior
501+
}
502+
503+
void viaOutparamMissingReturn() {
504+
int x = 0;
505+
intOutparamSourceMissingReturn(&x);
506+
sink(x); // $ ast,ir
507+
}

0 commit comments

Comments
 (0)