Skip to content

Commit 302d35b

Browse files
committed
C++: Accept test changes.
1 parent cca5bd9 commit 302d35b

File tree

3 files changed

+22
-30
lines changed

3 files changed

+22
-30
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct Top {
88
virtual void isSink(int x) { }
99
virtual int notSource1() { return source(); }
1010
virtual int notSource2() { return source(); }
11-
virtual void notSink(int x) { sink(x); } // $ SPURIOUS: ast,ir=37:19 ast,ir=45:18
11+
virtual void notSink(int x) { sink(x); } // $ SPURIOUS: ast=37:19 ast=45:18
1212
};
1313

1414
// This class has the correct behavior for just the functions ending in 2.
@@ -32,16 +32,16 @@ void VirtualDispatch(Bottom *bottomPtr, Bottom &bottomRef) { // $ ast-def=bottom
3232
sink(topPtr->isSource2()); // $ ir MISSING: ast
3333
topPtr->isSink(source()); // causing a MISSING for ast
3434

35-
sink(topPtr->notSource1()); // $ SPURIOUS: ast,ir
36-
sink(topPtr->notSource2()); // $ SPURIOUS: ast,ir
35+
sink(topPtr->notSource1()); // $ SPURIOUS: ast
36+
sink(topPtr->notSource2()); // $ SPURIOUS: ast
3737
topPtr->notSink(source()); // causing SPURIOUS for ast,ir
3838

3939
sink(topRef.isSource1()); // $ ir MISSING: ast
4040
sink(topRef.isSource2()); // $ ir MISSING: ast
4141
topRef.isSink(source()); // causing a MISSING for ast
4242

43-
sink(topRef.notSource1()); // $ SPURIOUS: ast,ir
44-
sink(topRef.notSource2()); // $ SPURIOUS: ast,ir
43+
sink(topRef.notSource1()); // $ SPURIOUS: ast
44+
sink(topRef.notSource2()); // $ SPURIOUS: ast
4545
topRef.notSink(source()); // causing SPURIOUS for ast,ir
4646
}
4747

@@ -52,10 +52,10 @@ Top *readGlobalBottom() {
5252
}
5353

5454
void DispatchThroughGlobal() {
55-
sink(globalBottom->isSource1()); // $ ir MISSING: ast
55+
sink(globalBottom->isSource1()); // $ MISSING: ast,ir
5656
sink(globalMiddle->isSource1()); // no flow
5757

58-
sink(readGlobalBottom()->isSource1()); // $ ir MISSING: ast
58+
sink(readGlobalBottom()->isSource1()); // $ MISSING: ast,ir
5959

6060
globalBottom = new Bottom();
6161
globalMiddle = new Middle();
@@ -93,7 +93,7 @@ void callIdentityFunctions(Top *top, Bottom *bottom) { // $ ast-def=bottom ast-d
9393
using SinkFunctionType = void (*)(int);
9494

9595
void callSink(int x) {
96-
sink(x); // $ ir=107:17 ir=140:8 ir=144:8 MISSING: ast=107:17 ast=140:8 ast=144:8
96+
sink(x); // $ ir MISSING: ast,ir=107:17 ast,ir=140:8 ast,ir=144:8
9797
}
9898

9999
SinkFunctionType returnCallSink() {
@@ -126,8 +126,8 @@ namespace virtual_inheritance {
126126
// get flow from a `Middle` value to the call qualifier.
127127
Top *topPtr = bottomPtr, &topRef = bottomRef;
128128

129-
sink(topPtr->isSource()); // $ MISSING: ast,ir
130-
sink(topRef.isSource()); // $ MISSING: ast,ir
129+
sink(topPtr->isSource()); // $ ir MISSING: ast
130+
sink(topRef.isSource()); // $ ir MISSING: ast
131131
}
132132
}
133133

cpp/ql/test/library-tests/dataflow/dataflow-tests/test-source-sink.expected

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,26 +169,18 @@ irFlow
169169
| clang.cpp:50:35:50:40 | call to source | clang.cpp:53:17:53:26 | *stackArray |
170170
| clang.cpp:51:19:51:24 | call to source | clang.cpp:53:17:53:26 | *stackArray |
171171
| clang.cpp:57:21:57:28 | call to source | clang.cpp:59:8:59:8 | d |
172-
| dispatch.cpp:9:37:9:42 | call to source | dispatch.cpp:35:16:35:25 | call to notSource1 |
173-
| dispatch.cpp:9:37:9:42 | call to source | dispatch.cpp:43:15:43:24 | call to notSource1 |
174-
| dispatch.cpp:10:37:10:42 | call to source | dispatch.cpp:36:16:36:25 | call to notSource2 |
175-
| dispatch.cpp:10:37:10:42 | call to source | dispatch.cpp:44:15:44:24 | call to notSource2 |
176172
| dispatch.cpp:16:37:16:42 | call to source | dispatch.cpp:32:16:32:24 | call to isSource2 |
177173
| dispatch.cpp:16:37:16:42 | call to source | dispatch.cpp:40:15:40:23 | call to isSource2 |
178174
| dispatch.cpp:22:37:22:42 | call to source | dispatch.cpp:31:16:31:24 | call to isSource1 |
179175
| dispatch.cpp:22:37:22:42 | call to source | dispatch.cpp:39:15:39:23 | call to isSource1 |
180-
| dispatch.cpp:22:37:22:42 | call to source | dispatch.cpp:55:22:55:30 | call to isSource1 |
181-
| dispatch.cpp:22:37:22:42 | call to source | dispatch.cpp:58:28:58:36 | call to isSource1 |
182176
| dispatch.cpp:33:18:33:23 | call to source | dispatch.cpp:23:38:23:38 | x |
183-
| dispatch.cpp:37:19:37:24 | call to source | dispatch.cpp:11:38:11:38 | x |
184177
| dispatch.cpp:41:17:41:22 | call to source | dispatch.cpp:23:38:23:38 | x |
185-
| dispatch.cpp:45:18:45:23 | call to source | dispatch.cpp:11:38:11:38 | x |
186178
| dispatch.cpp:69:15:69:20 | call to source | dispatch.cpp:23:38:23:38 | x |
187179
| dispatch.cpp:73:14:73:19 | call to source | dispatch.cpp:23:38:23:38 | x |
188180
| dispatch.cpp:81:13:81:18 | call to source | dispatch.cpp:23:38:23:38 | x |
189181
| dispatch.cpp:107:17:107:22 | call to source | dispatch.cpp:96:8:96:8 | x |
190-
| dispatch.cpp:140:8:140:13 | call to source | dispatch.cpp:96:8:96:8 | x |
191-
| dispatch.cpp:144:8:144:13 | call to source | dispatch.cpp:96:8:96:8 | x |
182+
| dispatch.cpp:117:38:117:43 | call to source | dispatch.cpp:129:18:129:25 | call to isSource |
183+
| dispatch.cpp:117:38:117:43 | call to source | dispatch.cpp:130:17:130:24 | call to isSource |
192184
| flowOut.cpp:5:16:5:21 | call to source | flowOut.cpp:31:9:31:9 | x |
193185
| flowOut.cpp:5:16:5:21 | call to source | flowOut.cpp:61:8:61:11 | access to array |
194186
| flowOut.cpp:84:18:84:23 | call to source | flowOut.cpp:85:8:85:9 | * ... |

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ void test_simple() {
1919

2020
Base* b_ptr = &d;
2121
b_ptr->f(); // $ target=2
22-
b_ptr->virtual_f(); // $ target=8 SPURIOUS: target=3
22+
b_ptr->virtual_f(); // $ target=8
2323

2424
Base& b_ref = d;
2525
b_ref.f(); // $ target=2
26-
b_ref.virtual_f(); // $ target=8 SPURIOUS: target=3
26+
b_ref.virtual_f(); // $ target=8
2727

2828
Base* b_null = nullptr;
2929
b_null->f(); // $ target=2
3030
b_null->virtual_f(); // $ target=3
3131

3232
Base* base_is_derived = new Derived();
3333
base_is_derived->f(); // $ target=2
34-
base_is_derived->virtual_f(); // $ target=8 SPURIOUS: target=3
34+
base_is_derived->virtual_f(); // $ target=8
3535

3636
Base* base_is_base = new Base();
3737
base_is_base->f(); // $ target=2
@@ -59,12 +59,12 @@ void test_fields() {
5959
s.b2 = new Derived();
6060

6161
s.b1->virtual_f(); // $ target=3
62-
s.b2->virtual_f(); // $ SPURIOUS: target=3 MISSING: target=8
62+
s.b2->virtual_f(); // $ target=8
6363

6464
s.b1 = new Derived();
6565
s.b2 = new Base();
66-
s.b1->virtual_f(); // $ MISSING: target=8 SPURIOUS: target=3 // type-tracking has no 'clearsContent' feature and C/C++ doesn't have field-based SSA
67-
s.b2->virtual_f(); // $ target=3 // type-tracking has no 'clearsContent' feature and C/C++ doesn't have field-based SSA
66+
s.b1->virtual_f(); // $ target=8 SPURIOUS: target=3 // type-tracking has no 'clearsContent' feature and C/C++ doesn't have field-based SSA
67+
s.b2->virtual_f(); // $ target=3 SPURIOUS: target=8 // type-tracking has no 'clearsContent' feature and C/C++ doesn't have field-based SSA
6868
}
6969

7070
Base* getDerived() {
@@ -73,7 +73,7 @@ Base* getDerived() {
7373

7474
void test_getDerived() {
7575
Base* b = getDerived();
76-
b->virtual_f(); // $ target=8 SPURIOUS: target=3
76+
b->virtual_f(); // $ target=8
7777

7878
Derived d = *(Derived*)getDerived();
7979
d.virtual_f(); // $ target=8
@@ -98,7 +98,7 @@ void test_write_to_arg() {
9898
{
9999
Base* b;
100100
write_to_arg_2(&b);
101-
b->virtual_f(); // $ target=8 SPURIOUS: target=3
101+
b->virtual_f(); // $ target=8
102102
}
103103
}
104104

@@ -109,7 +109,7 @@ void set_global_to_derived() {
109109
}
110110

111111
void read_global() {
112-
global_derived->virtual_f(); // $ target=8 SPURIOUS: target=3
112+
global_derived->virtual_f(); // $ SPURIOUS: target=3 MISSING: target=8
113113
}
114114

115115
Base* global_base_or_derived;
@@ -123,5 +123,5 @@ void set_global_base_or_derived_2() {
123123
}
124124

125125
void read_global_base_or_derived() {
126-
global_base_or_derived->virtual_f(); // $ target=3 target=8
126+
global_base_or_derived->virtual_f(); // $ target=3 MISSING: target=8
127127
}

0 commit comments

Comments
 (0)