Skip to content

Commit afd1a12

Browse files
authored
Merge pull request github#13182 from MathiasVP/add-conflation-in-dataflow
C++: Add example with conflation in dataflow
2 parents fc9fe13 + c450328 commit afd1a12

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ postWithInFlow
125125
| test.cpp:681:3:681:3 | s [post update] | PostUpdateNode should not be the target of local flow. |
126126
| test.cpp:689:3:689:3 | s [post update] | PostUpdateNode should not be the target of local flow. |
127127
| test.cpp:690:3:690:3 | s [post update] | PostUpdateNode should not be the target of local flow. |
128+
| test.cpp:694:4:694:6 | buf [inner post update] | PostUpdateNode should not be the target of local flow. |
129+
| test.cpp:704:23:704:25 | buf [inner post update] | PostUpdateNode should not be the target of local flow. |
128130
viableImplInCallContextTooLarge
129131
uniqueParameterNodeAtPosition
130132
uniqueParameterNodePosition

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,3 +690,16 @@ void test_static_local_9() {
690690
s = 0;
691691
}
692692

693+
void increment_buf(int** buf) { // $ ast-def=buf ir-def=*buf ir-def=**buf
694+
*buf += 10;
695+
sink(buf); // $ SPURIOUS: ast,ir // should only be flow to the indirect argument, but there's also flow to the non-indirect argument
696+
}
697+
698+
void call_increment_buf(int** buf) { // $ ast-def=buf
699+
increment_buf(buf);
700+
}
701+
702+
void test_conflation_regression(int* source) { // $ ast-def=source
703+
int* buf = source;
704+
call_increment_buf(&buf);
705+
}

0 commit comments

Comments
 (0)