mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C++: Support flow through LambdaExpression
I've checked with a temporary workaround for the locations problem that my annotations in the test cpp files are on the correct lines.
This commit is contained in:
@@ -11,14 +11,14 @@ void test_lambdas()
|
||||
int w = 0;
|
||||
|
||||
auto a = [t, u]() -> int {
|
||||
sink(t); // flow from source() [NOT DETECTED]
|
||||
sink(t); // flow from source()
|
||||
sink(u);
|
||||
return t;
|
||||
};
|
||||
sink(a()); // flow from source() [NOT DETECTED]
|
||||
sink(a()); // flow from source()
|
||||
|
||||
auto b = [&] {
|
||||
sink(t); // flow from source() [NOT DETECTED]
|
||||
sink(t); // flow from source()
|
||||
sink(u);
|
||||
v = source(); // (v is reference captured)
|
||||
};
|
||||
@@ -26,7 +26,7 @@ void test_lambdas()
|
||||
sink(v); // flow from source() [NOT DETECTED]
|
||||
|
||||
auto c = [=] {
|
||||
sink(t); // flow from source() [NOT DETECTED]
|
||||
sink(t); // flow from source()
|
||||
sink(u);
|
||||
};
|
||||
c();
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
| acrossLinkTargets.cpp:12:8:12:8 | x | acrossLinkTargets.cpp:19:27:19:32 | call to source |
|
||||
| file://:0:0:0:0 | t | lambdas.cpp:8:10:8:15 | call to source |
|
||||
| file://:0:0:0:0 | t | lambdas.cpp:8:10:8:15 | call to source |
|
||||
| file://:0:0:0:0 | t | lambdas.cpp:8:10:8:15 | call to source |
|
||||
| lambdas.cpp:18:8:18:8 | call to operator() | lambdas.cpp:8:10:8:15 | call to source |
|
||||
| lambdas.cpp:35:8:35:8 | a | lambdas.cpp:8:10:8:15 | call to source |
|
||||
| lambdas.cpp:41:8:41:8 | a | lambdas.cpp:8:10:8:15 | call to source |
|
||||
| test.cpp:7:8:7:9 | t1 | test.cpp:6:12:6:17 | call to source |
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
| lambdas.cpp:8:10:8:15 | file://:0:0:0:0 | AST only |
|
||||
| lambdas.cpp:8:10:8:15 | lambdas.cpp:18:8:18:8 | AST only |
|
||||
| lambdas.cpp:8:10:8:15 | lambdas.cpp:35:8:35:8 | AST only |
|
||||
| lambdas.cpp:8:10:8:15 | lambdas.cpp:41:8:41:8 | AST only |
|
||||
| test.cpp:89:28:89:34 | test.cpp:92:8:92:14 | IR only |
|
||||
|
||||
Reference in New Issue
Block a user