Skip to content

Commit ed1e3ed

Browse files
committed
C++: Annotate field-flow tests in [ABC].cpp
This brings the annotation style in sync with how we annotate new tests these days. I also changed a few annotations to have different expected outcome based on my understanding of the code.
1 parent e94dbe9 commit ed1e3ed

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class A
117117
}
118118
if (C1 *c1 = dynamic_cast<C1 *>(cc))
119119
{
120-
sink(c1->a); // no flow, stopped by cast to C2
120+
sink(c1->a); // no flow, stopped by cast to C2 [FALSE POSITIVE]
121121
}
122122
}
123123

@@ -129,7 +129,7 @@ class A
129129
{
130130
B *b = new B();
131131
f7(b);
132-
sink(b->c); // flow
132+
sink(b->c); // flow [NOT DETECTED]
133133
}
134134

135135
class D
@@ -151,7 +151,7 @@ class A
151151
D *d = new D(b, r());
152152
sink(d->b); // flow x2
153153
sink(d->b->c); // flow
154-
sink(b->c); // flow
154+
sink(b->c); // flow [NOT DETECTED]
155155
}
156156

157157
void f10()
@@ -161,9 +161,9 @@ class A
161161
MyList *l2 = new MyList(nullptr, l1);
162162
MyList *l3 = new MyList(nullptr, l2);
163163
sink(l3->head); // no flow, b is nested beneath at least one ->next
164-
sink(l3->next->head); // flow, the precise nesting depth isn't tracked
164+
sink(l3->next->head); // no flow
165165
sink(l3->next->next->head); // flow
166-
sink(l3->next->next->next->head); // flow
166+
sink(l3->next->next->next->head); // no flow
167167
for (MyList *l = l3; l != nullptr; l = l->next)
168168
{
169169
sink(l->head); // flow

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ class B
77
Box1 *b1 = new Box1(e, nullptr);
88
Box2 *b2 = new Box2(b1);
99
sink(b2->box1->elem1); // flow
10-
sink(b2->box1->elem2); // FP due to flow in f2 below
10+
sink(b2->box1->elem2); // no flow [FALSE POSITIVE] (due to flow in f2 below)
1111
}
1212

1313
void f2()
1414
{
1515
Elem *e = new B::Elem();
1616
Box1 *b1 = new B::Box1(nullptr, e);
1717
Box2 *b2 = new Box2(b1);
18-
sink(b2->box1->elem1); // FP due to flow in f1 above
18+
sink(b2->box1->elem1); // no flow [FALSE POSITIVE] (due to flow in f1 above)
1919
sink(b2->box1->elem2); // flow
2020
}
2121

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ class C
2626

2727
void func()
2828
{
29-
sink(s1);
30-
sink(s2);
31-
sink(s3);
32-
sink(s4);
29+
sink(s1); // flow [NOT DETECTED] (in either place)
30+
sink(s2); // flow [NOT DETECTED]
31+
sink(s3); // flow
32+
sink(s4); // flow [NOT DETECTED]
3333
}
3434

3535
static void sink(const void *o) {}
3636
};
37-
const C::Elem *C::s4 = new Elem();
37+
const C::Elem *C::s4 = new Elem();

0 commit comments

Comments
 (0)