Skip to content

Commit 95a62be

Browse files
C++: Update test expectations due to better dataflow analysis
1 parent 5dcd314 commit 95a62be

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,17 @@ void following_pointers(
140140
sink(sourceStruct1.m1); // flow (due to lack of no-alias tracking)
141141

142142
twoIntFields s = { source(), source() };
143-
// TODO: fix this by distinguishing between an AggregateLiteral that
144-
// initializes an array and one that initializes a struct.
145-
sink(s.m2); // no flow (due to limitations of the analysis)
143+
144+
145+
sink(s.m2); // flow (AST dataflow misses this due to limitations of the analysis)
146146

147147
twoIntFields sArray[1] = { { source(), source() } };
148148
// TODO: fix this like above
149149
sink(sArray[0].m2); // no flow (due to limitations of the analysis)
150150

151151
twoIntFields sSwapped = { .m2 = source(), .m1 = 0 };
152-
// TODO: fix this like above
153-
sink(sSwapped.m2); // no flow (due to limitations of the analysis)
152+
153+
sink(sSwapped.m2); // flow (AST dataflow misses this due to limitations of the analysis)
154154

155155
sink(sourceFunctionPointer()); // no flow
156156

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
| test.cpp:89:28:89:34 | test.cpp:92:8:92:14 | IR only |
22
| test.cpp:100:13:100:18 | test.cpp:103:10:103:12 | AST only |
33
| test.cpp:109:9:109:14 | test.cpp:110:10:110:12 | IR only |
4-
| test.cpp:120:9:120:20 | test.cpp:126:8:126:19 | AST only |
54
| test.cpp:122:18:122:30 | test.cpp:132:22:132:23 | IR only |
65
| test.cpp:122:18:122:30 | test.cpp:140:22:140:23 | IR only |
76
| test.cpp:136:27:136:32 | test.cpp:137:27:137:28 | AST only |
87
| test.cpp:136:27:136:32 | test.cpp:140:22:140:23 | AST only |
8+
| test.cpp:142:32:142:37 | test.cpp:145:10:145:11 | IR only |
9+
| test.cpp:151:35:151:40 | test.cpp:153:17:153:18 | IR only |
910
| test.cpp:395:17:395:22 | test.cpp:397:10:397:18 | AST only |
1011
| test.cpp:421:13:421:18 | test.cpp:423:10:423:14 | AST only |
1112
| test.cpp:430:48:430:54 | test.cpp:433:8:433:10 | AST only |

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
| test.cpp:90:8:90:14 | Load: source1 | test.cpp:89:28:89:34 | InitializeParameter: source1 |
1616
| test.cpp:92:8:92:14 | Load: source1 | test.cpp:89:28:89:34 | InitializeParameter: source1 |
1717
| test.cpp:110:10:110:12 | Load: (reference dereference) | test.cpp:109:9:109:14 | Call: call to source |
18+
| test.cpp:126:8:126:19 | Convert: (const int *)... | test.cpp:120:9:120:20 | InitializeParameter: sourceArray1 |
19+
| test.cpp:126:8:126:19 | Load: sourceArray1 | test.cpp:120:9:120:20 | InitializeParameter: sourceArray1 |
1820
| test.cpp:132:22:132:23 | Load: m1 | test.cpp:122:18:122:30 | InitializeParameter: sourceStruct1 |
1921
| test.cpp:140:22:140:23 | Load: m1 | test.cpp:122:18:122:30 | InitializeParameter: sourceStruct1 |
22+
| test.cpp:145:10:145:11 | Load: m2 | test.cpp:142:32:142:37 | Call: call to source |
23+
| test.cpp:153:17:153:18 | Load: m2 | test.cpp:151:35:151:40 | Call: call to source |
2024
| test.cpp:188:8:188:8 | Load: y | test.cpp:186:27:186:32 | Call: call to source |
2125
| test.cpp:192:8:192:8 | Load: s | test.cpp:199:33:199:38 | Call: call to source |
2226
| test.cpp:200:8:200:8 | Load: y | test.cpp:199:33:199:38 | Call: call to source |

0 commit comments

Comments
 (0)