Skip to content

Commit 419ea8f

Browse files
MathiasVPhvitved
authored andcommitted
C++: Add a test that needs an access path at the source.
1 parent 61ebe22 commit 419ea8f

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

cpp/ql/test/library-tests/dataflow/external-models/flow.ext.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ extensions:
44
extensible: sourceModel
55
data: # namespace, type, subtypes, name, signature, ext, output, kind, provenance
66
- ["", "", False, "ymlSource", "", "", "ReturnValue", "local", "manual"]
7+
- ["", "", False, "ymlFieldSource", "", "", "ReturnValue.Field[SourceWrapper::value]", "local", "manual"]
78
- addsTo:
89
pack: codeql/cpp-all
910
extensible: sinkModel

cpp/ql/test/library-tests/dataflow/external-models/sinks.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
| test.cpp:201:10:201:10 | x | test-sink |
2424
| test.cpp:218:11:218:11 | x | test-sink |
2525
| test.cpp:224:11:224:11 | c | test-sink |
26+
| test.cpp:236:18:236:22 | value | test-sink |

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,16 @@ void test_reverse_flow(unsigned i, unsigned j) {
223223
char c = s[j];
224224
ymlSink(c); // $ ir
225225
}
226-
}
226+
}
227+
228+
struct SourceWrapper {
229+
int value;
230+
};
231+
232+
SourceWrapper ymlFieldSource();
233+
234+
void test_source_access_path() {
235+
SourceWrapper wrapper = ymlFieldSource();
236+
ymlSink(wrapper.value); // $ MISSING: ir
237+
}
238+

0 commit comments

Comments
 (0)