Skip to content

Commit 0963af2

Browse files
committed
C++: Add failing tests.
1 parent cad003a commit 0963af2

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ argHasPostUpdate
2323
| lambdas.cpp:38:2:38:2 | d | ArgumentNode is missing PostUpdateNode. |
2424
| lambdas.cpp:45:2:45:2 | e | ArgumentNode is missing PostUpdateNode. |
2525
| test.cpp:67:29:67:35 | source1 | ArgumentNode is missing PostUpdateNode. |
26+
| test.cpp:813:19:813:35 | * ... | ArgumentNode is missing PostUpdateNode. |
2627
postWithInFlow
2728
| BarrierGuard.cpp:49:6:49:6 | x [post update] | PostUpdateNode should not be the target of local flow. |
2829
| BarrierGuard.cpp:60:7:60:7 | x [post update] | PostUpdateNode should not be the target of local flow. |
@@ -136,6 +137,9 @@ postWithInFlow
136137
| test.cpp:728:3:728:4 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
137138
| test.cpp:728:4:728:4 | p [inner post update] | PostUpdateNode should not be the target of local flow. |
138139
| test.cpp:734:41:734:41 | x [inner post update] | PostUpdateNode should not be the target of local flow. |
140+
| test.cpp:808:5:808:21 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
141+
| test.cpp:808:6:808:21 | global_indirect1 [inner post update] | PostUpdateNode should not be the target of local flow. |
142+
| test.cpp:832:5:832:17 | global_direct [post update] | PostUpdateNode should not be the target of local flow. |
139143
viableImplInCallContextTooLarge
140144
uniqueParameterNodeAtPosition
141145
uniqueParameterNodePosition

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,4 +796,44 @@ void test() {
796796
MyStruct a;
797797
intPointerSource(a.content, a.content);
798798
indirect_sink(a.content); // $ ast ir
799+
}
800+
801+
namespace MoreGlobalTests {
802+
int **global_indirect1;
803+
int **global_indirect2;
804+
int **global_direct;
805+
806+
void set_indirect1()
807+
{
808+
*global_indirect1 = indirect_source();
809+
}
810+
811+
void read_indirect1() {
812+
sink(global_indirect1); // clean
813+
indirect_sink(*global_indirect1); // $ MISSING: ir,ast
814+
}
815+
816+
void set_indirect2()
817+
{
818+
**global_indirect2 = source();
819+
}
820+
821+
void read_indirect2() {
822+
sink(global_indirect2); // clean
823+
sink(**global_indirect2); // $ MISSING: ir,ast
824+
}
825+
826+
// overload source with a boolean parameter so
827+
// that we can define a variant that return an int**.
828+
int** source(bool);
829+
830+
void set_direct()
831+
{
832+
global_direct = source(true);
833+
}
834+
835+
void read_direct() {
836+
sink(global_direct); // $ ir MISSING: ast
837+
indirect_sink(global_direct); // clean
838+
}
799839
}

0 commit comments

Comments
 (0)