Skip to content

Commit 226756e

Browse files
authored
Merge pull request github#17826 from MathiasVP/missing-flow-with-aliasing-fields
C++: Add test with missing flow
2 parents 779ee25 + 7c5f561 commit 226756e

File tree

5 files changed

+27
-1
lines changed

5 files changed

+27
-1
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ postWithInFlow
185185
| simple.cpp:83:12:83:13 | f1 [post update] | PostUpdateNode should not be the target of local flow. |
186186
| simple.cpp:92:7:92:7 | i [post update] | PostUpdateNode should not be the target of local flow. |
187187
| simple.cpp:118:7:118:7 | i [post update] | PostUpdateNode should not be the target of local flow. |
188+
| simple.cpp:124:5:124:6 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
189+
| simple.cpp:124:6:124:6 | p [inner post update] | PostUpdateNode should not be the target of local flow. |
188190
| struct_init.c:24:11:24:12 | ab [inner post update] | PostUpdateNode should not be the target of local flow. |
189191
| struct_init.c:36:17:36:24 | nestedAB [inner post update] | PostUpdateNode should not be the target of local flow. |
190192
viableImplInCallContextTooLarge

cpp/ql/test/library-tests/dataflow/fields/partial-definition-diff.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,6 @@ WARNING: module 'DataFlow' has been deprecated and may be removed in future (par
291291
| simple.cpp:94:10:94:11 | a2 | IR only |
292292
| simple.cpp:118:7:118:7 | i | AST only |
293293
| simple.cpp:120:8:120:8 | a | IR only |
294+
| simple.cpp:124:5:124:6 | * ... | AST only |
295+
| simple.cpp:131:14:131:14 | a | IR only |
296+
| simple.cpp:136:10:136:10 | a | IR only |

cpp/ql/test/library-tests/dataflow/fields/partial-definition-ir.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,9 @@
651651
| simple.cpp:94:10:94:11 | a2 |
652652
| simple.cpp:118:5:118:5 | a |
653653
| simple.cpp:120:8:120:8 | a |
654+
| simple.cpp:131:14:131:14 | a |
655+
| simple.cpp:135:20:135:20 | q |
656+
| simple.cpp:136:10:136:10 | a |
654657
| struct_init.c:15:8:15:9 | ab |
655658
| struct_init.c:15:12:15:12 | a |
656659
| struct_init.c:16:8:16:9 | ab |

cpp/ql/test/library-tests/dataflow/fields/partial-definition.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,8 @@ WARNING: module 'DataFlow' has been deprecated and may be removed in future (par
581581
| simple.cpp:92:7:92:7 | i |
582582
| simple.cpp:118:5:118:5 | a |
583583
| simple.cpp:118:7:118:7 | i |
584+
| simple.cpp:124:5:124:6 | * ... |
585+
| simple.cpp:135:20:135:20 | q |
584586
| struct_init.c:15:8:15:9 | ab |
585587
| struct_init.c:15:12:15:12 | a |
586588
| struct_init.c:16:8:16:9 | ab |

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,20 @@ void post_update_to_phi_input(bool b)
120120
sink(a.i); // $ ast,ir
121121
}
122122

123-
} // namespace Simple
123+
void write_to_param(int* p) {
124+
*p = user_input();
125+
}
126+
127+
void alias_with_fields(bool b) {
128+
A a;
129+
int* q;
130+
if(b) {
131+
q = &a.i;
132+
} else {
133+
q = nullptr;
134+
}
135+
write_to_param(q);
136+
sink(a.i); // $ MISSING: ast,ir
137+
}
138+
139+
} // namespace Simple

0 commit comments

Comments
 (0)