Skip to content

Commit a4388e9

Browse files
committed
C++: Add example demonstrating missing flow
1 parent 4b16067 commit a4388e9

File tree

1 file changed

+24
-0
lines changed
  • cpp/ql/test/library-tests/dataflow/fields

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,28 @@ void test_deep_structs_setter() {
144144
read_from_y_deref(&d3.d2_2);
145145
}
146146

147+
struct Inner
148+
{
149+
int f;
150+
int g;
151+
};
152+
153+
struct Outer
154+
{
155+
Inner inner;
156+
int h;
157+
};
158+
159+
void read_f(Inner *inner)
160+
{
161+
sink(inner->f); //$ast $f-:ir
162+
}
163+
164+
void test()
165+
{
166+
Outer outer;
167+
outer.inner.f = user_input();
168+
read_f(&outer.inner);
169+
}
170+
147171
} // namespace Simple

0 commit comments

Comments
 (0)