mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
C++: Focus the lambda captures test on stuff inside the lambdas (including some that don't currently have locations).
This commit is contained in:
@@ -1,25 +1,9 @@
|
||||
| captures.cpp:1:8:1:8 | declaration of operator= |
|
||||
| captures.cpp:1:8:1:8 | declaration of operator= |
|
||||
| captures.cpp:1:8:1:8 | operator= |
|
||||
| captures.cpp:1:8:1:8 | operator= |
|
||||
| captures.cpp:1:8:1:10 | definition of foo |
|
||||
| captures.cpp:1:8:1:10 | foo |
|
||||
| captures.cpp:2:8:2:8 | a |
|
||||
| captures.cpp:2:8:2:8 | definition of a |
|
||||
| captures.cpp:2:14:2:14 | definition of x |
|
||||
| captures.cpp:2:14:2:14 | x |
|
||||
| captures.cpp:2:17:6:3 | { ... } |
|
||||
| captures.cpp:3:5:3:5 | (unnamed constructor) |
|
||||
| captures.cpp:3:5:3:5 | (unnamed constructor) |
|
||||
| captures.cpp:3:5:3:5 | (unnamed constructor) |
|
||||
| captures.cpp:3:5:3:5 | declaration of (unnamed constructor) |
|
||||
| captures.cpp:3:5:3:5 | declaration of (unnamed constructor) |
|
||||
| captures.cpp:3:5:3:5 | definition of (unnamed constructor) |
|
||||
| captures.cpp:3:5:3:5 | definition of operator= |
|
||||
| captures.cpp:3:5:3:5 | operator= |
|
||||
| captures.cpp:3:5:5:5 | [...](...){...} |
|
||||
| captures.cpp:3:5:5:5 | {...} |
|
||||
| captures.cpp:3:5:5:6 | ExprStmt |
|
||||
| captures.cpp:3:6:3:6 | definition of x |
|
||||
| captures.cpp:3:6:3:6 | x |
|
||||
| captures.cpp:3:6:3:6 | x |
|
||||
@@ -28,7 +12,6 @@
|
||||
| captures.cpp:3:9:3:9 | definition of (captured this) |
|
||||
| captures.cpp:3:9:3:12 | (captured this) |
|
||||
| captures.cpp:3:9:3:12 | this |
|
||||
| captures.cpp:3:15:3:15 | definition of operator() |
|
||||
| captures.cpp:3:15:3:15 | operator() |
|
||||
| captures.cpp:3:15:5:5 | { ... } |
|
||||
| captures.cpp:4:7:4:7 | (captured this) |
|
||||
@@ -40,26 +23,14 @@
|
||||
| captures.cpp:4:9:4:13 | x |
|
||||
| captures.cpp:4:13:4:13 | 1 |
|
||||
| captures.cpp:5:5:5:5 | return ... |
|
||||
| captures.cpp:6:3:6:3 | return ... |
|
||||
| captures.cpp:8:8:8:8 | b |
|
||||
| captures.cpp:8:8:8:8 | definition of b |
|
||||
| captures.cpp:8:14:8:14 | definition of x |
|
||||
| captures.cpp:8:14:8:14 | x |
|
||||
| captures.cpp:8:17:12:3 | { ... } |
|
||||
| captures.cpp:9:5:9:5 | (unnamed constructor) |
|
||||
| captures.cpp:9:5:9:5 | (unnamed constructor) |
|
||||
| captures.cpp:9:5:9:5 | (unnamed constructor) |
|
||||
| captures.cpp:9:5:9:5 | declaration of (unnamed constructor) |
|
||||
| captures.cpp:9:5:9:5 | declaration of (unnamed constructor) |
|
||||
| captures.cpp:9:5:9:5 | definition of (unnamed constructor) |
|
||||
| captures.cpp:9:5:9:5 | definition of operator= |
|
||||
| captures.cpp:9:5:9:5 | operator= |
|
||||
| captures.cpp:9:5:11:5 | [...](...){...} |
|
||||
| captures.cpp:9:5:11:5 | this |
|
||||
| captures.cpp:9:5:11:5 | x |
|
||||
| captures.cpp:9:5:11:5 | {...} |
|
||||
| captures.cpp:9:5:11:6 | ExprStmt |
|
||||
| captures.cpp:9:9:9:9 | definition of operator() |
|
||||
| captures.cpp:9:9:9:9 | operator() |
|
||||
| captures.cpp:9:9:11:5 | { ... } |
|
||||
| captures.cpp:10:7:10:7 | (captured this) |
|
||||
@@ -77,48 +48,23 @@
|
||||
| captures.cpp:10:9:10:13 | x |
|
||||
| captures.cpp:10:13:10:13 | 1 |
|
||||
| captures.cpp:11:5:11:5 | return ... |
|
||||
| captures.cpp:12:3:12:3 | return ... |
|
||||
| captures.cpp:14:15:14:15 | c |
|
||||
| captures.cpp:14:15:14:15 | definition of c |
|
||||
| captures.cpp:14:21:14:21 | definition of x |
|
||||
| captures.cpp:14:21:14:21 | x |
|
||||
| captures.cpp:14:24:18:3 | { ... } |
|
||||
| captures.cpp:15:5:15:5 | (unnamed constructor) |
|
||||
| captures.cpp:15:5:15:5 | (unnamed constructor) |
|
||||
| captures.cpp:15:5:15:5 | (unnamed constructor) |
|
||||
| captures.cpp:15:5:15:5 | declaration of (unnamed constructor) |
|
||||
| captures.cpp:15:5:15:5 | declaration of (unnamed constructor) |
|
||||
| captures.cpp:15:5:15:5 | definition of (unnamed constructor) |
|
||||
| captures.cpp:15:5:15:5 | definition of operator= |
|
||||
| captures.cpp:15:5:15:5 | operator= |
|
||||
| captures.cpp:15:5:17:5 | [...](...){...} |
|
||||
| captures.cpp:15:5:17:5 | {...} |
|
||||
| captures.cpp:15:5:17:6 | ExprStmt |
|
||||
| captures.cpp:15:6:15:6 | definition of x |
|
||||
| captures.cpp:15:6:15:6 | x |
|
||||
| captures.cpp:15:6:15:6 | x |
|
||||
| captures.cpp:15:6:15:6 | x |
|
||||
| captures.cpp:15:9:15:9 | definition of operator() |
|
||||
| captures.cpp:15:9:15:9 | operator() |
|
||||
| captures.cpp:15:9:17:5 | { ... } |
|
||||
| captures.cpp:16:7:16:7 | call to c |
|
||||
| captures.cpp:16:7:16:11 | ExprStmt |
|
||||
| captures.cpp:16:9:16:9 | 0 |
|
||||
| captures.cpp:16:13:16:49 | // `x` is unused, but still captured. |
|
||||
| captures.cpp:17:5:17:5 | return ... |
|
||||
| captures.cpp:18:3:18:3 | return ... |
|
||||
| captures.cpp:21:5:21:5 | d |
|
||||
| captures.cpp:21:5:21:5 | definition of d |
|
||||
| captures.cpp:21:11:21:11 | definition of x |
|
||||
| captures.cpp:21:11:21:11 | x |
|
||||
| captures.cpp:21:18:21:18 | definition of y |
|
||||
| captures.cpp:21:18:21:18 | y |
|
||||
| captures.cpp:21:21:27:1 | { ... } |
|
||||
| captures.cpp:22:3:24:4 | declaration |
|
||||
| captures.cpp:22:8:22:15 | definition of myLambda |
|
||||
| captures.cpp:22:8:22:15 | myLambda |
|
||||
| captures.cpp:22:18:24:3 | [...](...){...} |
|
||||
| captures.cpp:22:18:24:3 | initializer for myLambda |
|
||||
| captures.cpp:22:18:24:3 | y |
|
||||
| captures.cpp:22:18:24:3 | {...} |
|
||||
| captures.cpp:22:19:22:19 | (reference dereference) |
|
||||
@@ -130,10 +76,6 @@
|
||||
| captures.cpp:22:19:22:19 | (unnamed parameter 0) |
|
||||
| captures.cpp:22:19:22:19 | constructor init of field x |
|
||||
| captures.cpp:22:19:22:19 | constructor init of field y |
|
||||
| captures.cpp:22:19:22:19 | declaration of (unnamed constructor) |
|
||||
| captures.cpp:22:19:22:19 | definition of (unnamed constructor) |
|
||||
| captures.cpp:22:19:22:19 | definition of (unnamed constructor) |
|
||||
| captures.cpp:22:19:22:19 | definition of operator= |
|
||||
| captures.cpp:22:19:22:19 | operator= |
|
||||
| captures.cpp:22:19:22:19 | return ... |
|
||||
| captures.cpp:22:19:22:19 | x |
|
||||
@@ -143,9 +85,7 @@
|
||||
| captures.cpp:22:23:22:23 | x |
|
||||
| captures.cpp:22:23:22:23 | x |
|
||||
| captures.cpp:22:23:22:23 | x |
|
||||
| captures.cpp:22:25:22:25 | definition of operator() |
|
||||
| captures.cpp:22:25:22:25 | operator() |
|
||||
| captures.cpp:22:30:22:30 | definition of z |
|
||||
| captures.cpp:22:30:22:30 | z |
|
||||
| captures.cpp:22:40:24:3 | { ... } |
|
||||
| captures.cpp:23:5:23:21 | return ... |
|
||||
@@ -160,29 +100,7 @@
|
||||
| captures.cpp:23:16:23:16 | y |
|
||||
| captures.cpp:23:16:23:16 | y |
|
||||
| captures.cpp:23:20:23:20 | z |
|
||||
| captures.cpp:26:3:26:24 | return ... |
|
||||
| captures.cpp:26:10:26:17 | (const lambda [] type at line 22, col. 19)... |
|
||||
| captures.cpp:26:10:26:17 | myLambda |
|
||||
| captures.cpp:26:18:26:18 | call to operator() |
|
||||
| captures.cpp:26:19:26:22 | 1000 |
|
||||
| end_pos.cpp:2:1:2:14 | #define OPEN { |
|
||||
| end_pos.cpp:3:6:3:10 | definition of igFun |
|
||||
| end_pos.cpp:3:6:3:10 | igFun |
|
||||
| end_pos.cpp:3:14:12:1 | { ... } |
|
||||
| end_pos.cpp:4:5:4:8 | OPEN |
|
||||
| end_pos.cpp:4:5:5:5 | { ... } |
|
||||
| end_pos.cpp:6:5:6:15 | declaration |
|
||||
| end_pos.cpp:6:9:6:10 | definition of ii |
|
||||
| end_pos.cpp:6:9:6:10 | ii |
|
||||
| end_pos.cpp:6:13:6:14 | 0 |
|
||||
| end_pos.cpp:6:13:6:14 | initializer for ii |
|
||||
| end_pos.cpp:7:5:7:69 | // EDG used to not give the initialization for this ii capture an |
|
||||
| end_pos.cpp:8:5:8:20 | // end location: |
|
||||
| end_pos.cpp:9:5:11:6 | declaration |
|
||||
| end_pos.cpp:9:10:9:11 | definition of fp |
|
||||
| end_pos.cpp:9:10:9:11 | fp |
|
||||
| end_pos.cpp:9:14:11:5 | [...](...){...} |
|
||||
| end_pos.cpp:9:14:11:5 | initializer for fp |
|
||||
| end_pos.cpp:9:14:11:5 | {...} |
|
||||
| end_pos.cpp:9:15:9:15 | (reference dereference) |
|
||||
| end_pos.cpp:9:15:9:15 | (unnamed constructor) |
|
||||
@@ -190,10 +108,6 @@
|
||||
| end_pos.cpp:9:15:9:15 | (unnamed constructor) |
|
||||
| end_pos.cpp:9:15:9:15 | (unnamed parameter 0) |
|
||||
| end_pos.cpp:9:15:9:15 | constructor init of field ii |
|
||||
| end_pos.cpp:9:15:9:15 | declaration of (unnamed constructor) |
|
||||
| end_pos.cpp:9:15:9:15 | definition of (unnamed constructor) |
|
||||
| end_pos.cpp:9:15:9:15 | definition of (unnamed constructor) |
|
||||
| end_pos.cpp:9:15:9:15 | definition of operator= |
|
||||
| end_pos.cpp:9:15:9:15 | ii |
|
||||
| end_pos.cpp:9:15:9:15 | operator= |
|
||||
| end_pos.cpp:9:15:9:15 | return ... |
|
||||
@@ -203,9 +117,28 @@
|
||||
| end_pos.cpp:9:17:9:18 | (reference to) |
|
||||
| end_pos.cpp:9:17:9:18 | ii |
|
||||
| end_pos.cpp:9:17:9:18 | ii |
|
||||
| end_pos.cpp:9:20:9:20 | definition of operator() |
|
||||
| end_pos.cpp:9:20:9:20 | operator() |
|
||||
| end_pos.cpp:9:27:11:5 | { ... } |
|
||||
| end_pos.cpp:10:9:10:17 | return ... |
|
||||
| end_pos.cpp:10:16:10:16 | 1 |
|
||||
| end_pos.cpp:12:1:12:1 | return ... |
|
||||
| file://:0:0:0:0 | (reference to) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | (unnamed parameter 0) |
|
||||
| file://:0:0:0:0 | decltype([...](...){...}) |
|
||||
| file://:0:0:0:0 | decltype([...](...){...}) |
|
||||
| file://:0:0:0:0 | decltype([...](...){...}) |
|
||||
| file://:0:0:0:0 | decltype([...](...){...}) |
|
||||
| file://:0:0:0:0 | decltype([...](...){...}) |
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import cpp
|
||||
|
||||
predicate interesting(Element e) {
|
||||
e instanceof LambdaCapture or
|
||||
e instanceof LambdaExpression or
|
||||
e = any(LambdaExpression le).getLambdaFunction() or
|
||||
e = any(LambdaExpression le).getInitializer() or
|
||||
e instanceof Closure
|
||||
}
|
||||
|
||||
from Element e
|
||||
where
|
||||
e.getLocation().getFile().getBaseName() != "" and
|
||||
not e instanceof Container
|
||||
interesting(e.getEnclosingElement*())
|
||||
select e
|
||||
|
||||
Reference in New Issue
Block a user