Skip to content

Commit c9e9322

Browse files
committed
C++: Add an example of missing MaD supporrt for non-type template parameters.
1 parent 14f9997 commit c9e9322

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ extensions:
1717
- ["", "", False, "ymlStepGenerated", "", "", "Argument[0]", "ReturnValue", "taint", "df-generated"]
1818
- ["", "", False, "ymlStepManual_with_body", "", "", "Argument[0]", "ReturnValue", "taint", "manual"]
1919
- ["", "", False, "ymlStepGenerated_with_body", "", "", "Argument[0]", "ReturnValue", "taint", "df-generated"]
20-
- ["", "", False, "callWithArgument", "", "", "Argument[1]", "Argument[0].Parameter[0]", "value", "manual"]
20+
- ["", "", False, "callWithArgument", "", "", "Argument[1]", "Argument[0].Parameter[0]", "value", "manual"]
21+
- ["", "", False, "callWithNonTypeTemplate<T>", "(const T &)", "", "Argument[*0]", "ReturnValue", "value", "manual"]

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
| test.cpp:75:11:75:11 | y | test-sink |
1414
| test.cpp:83:11:83:11 | y | test-sink |
1515
| test.cpp:89:11:89:11 | y | test-sink |
16+
| test.cpp:113:10:113:10 | y | test-sink |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
| test.cpp:10:10:10:18 | call to ymlSource | local |
33
| test.cpp:56:8:56:16 | call to ymlSource | local |
44
| test.cpp:94:10:94:18 | call to ymlSource | local |
5+
| test.cpp:111:10:111:18 | call to ymlSource | local |
56
| windows.cpp:22:15:22:29 | *call to GetCommandLineA | local |
67
| windows.cpp:34:17:34:38 | *call to GetEnvironmentStringsA | local |
78
| windows.cpp:39:36:39:38 | GetEnvironmentVariableA output argument | local |

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,13 @@ void test_callWithArgument() {
102102
}
103103
callWithArgument(StructWithOperatorCall_has_constructor_2(), x);
104104
callWithArgument(StructWithOperatorCall_no_constructor_2(), x);
105+
}
106+
107+
template<int N, typename T>
108+
T callWithNonTypeTemplate(const T&);
109+
110+
void test_callWithNonTypeTemplate() {
111+
int x = ymlSource();
112+
int y = callWithNonTypeTemplate<10, int>(x);
113+
ymlSink(y); // $ MISSING: ir
105114
}

0 commit comments

Comments
 (0)