Merge pull request #12661 from geoffw0/elementstests

C++: Restrict tests that output all elements
This commit is contained in:
Jeroen Ketema
2023-03-27 09:04:11 +02:00
committed by GitHub
8 changed files with 48 additions and 229 deletions

View File

@@ -1,35 +1,21 @@
| CPP-205.cpp:0:0:0:0 | CPP-205.cpp | |
| CPP-205.cpp:1:20:1:20 | T | |
| CPP-205.cpp:1:20:1:20 | definition of T | |
| CPP-205.cpp:2:5:2:5 | definition of fn | function declaration entry for int fn<int>(int) |
| CPP-205.cpp:2:5:2:5 | fn | function int fn<int>(int) |
| CPP-205.cpp:2:5:2:6 | definition of fn | function declaration entry for int fn<T>(T) |
| CPP-205.cpp:2:5:2:6 | fn | function int fn<T>(T) |
| CPP-205.cpp:2:10:2:12 | definition of out | parameter declaration entry for int fn<T>(T) |
| CPP-205.cpp:2:10:2:12 | definition of out | parameter declaration entry for int fn<int>(int) |
| CPP-205.cpp:2:10:2:12 | out | parameter for int fn<T>(T) |
| CPP-205.cpp:2:10:2:12 | out | parameter for int fn<int>(int) |
| CPP-205.cpp:2:15:5:1 | { ... } | |
| CPP-205.cpp:2:15:5:1 | { ... } | |
| CPP-205.cpp:3:3:3:33 | declaration | |
| CPP-205.cpp:3:3:3:33 | declaration | |
| CPP-205.cpp:3:15:3:15 | declaration of y | |
| CPP-205.cpp:3:15:3:15 | y | |
| CPP-205.cpp:3:17:3:31 | 5 | |
| CPP-205.cpp:4:3:4:11 | return ... | |
| CPP-205.cpp:4:3:4:11 | return ... | |
| CPP-205.cpp:4:10:4:10 | 0 | |
| CPP-205.cpp:4:10:4:10 | 0 | |
| CPP-205.cpp:2:5:2:5 | definition of fn | function declaration entry for int fn<int>(int), isFromTemplateInstantiation(fn) |
| CPP-205.cpp:2:5:2:5 | fn | function int fn<int>(int), isFromTemplateInstantiation(fn) |
| CPP-205.cpp:2:5:2:6 | definition of fn | function declaration entry for int fn<T>(T), isFromUninstantiatedTemplate(fn) |
| CPP-205.cpp:2:5:2:6 | fn | function int fn<T>(T), isFromUninstantiatedTemplate(fn) |
| CPP-205.cpp:2:10:2:12 | definition of out | isFromTemplateInstantiation(fn), parameter declaration entry for int fn<int>(int) |
| CPP-205.cpp:2:10:2:12 | definition of out | isFromUninstantiatedTemplate(fn), parameter declaration entry for int fn<T>(T) |
| CPP-205.cpp:2:10:2:12 | out | isFromTemplateInstantiation(fn), parameter for int fn<int>(int) |
| CPP-205.cpp:2:10:2:12 | out | isFromUninstantiatedTemplate(fn), parameter for int fn<T>(T) |
| CPP-205.cpp:2:15:5:1 | { ... } | isFromTemplateInstantiation(fn) |
| CPP-205.cpp:2:15:5:1 | { ... } | isFromUninstantiatedTemplate(fn) |
| CPP-205.cpp:3:3:3:33 | declaration | isFromTemplateInstantiation(fn) |
| CPP-205.cpp:3:3:3:33 | declaration | isFromUninstantiatedTemplate(fn) |
| CPP-205.cpp:3:15:3:15 | declaration of y | isFromUninstantiatedTemplate(fn) |
| CPP-205.cpp:3:15:3:15 | y | isFromUninstantiatedTemplate(fn) |
| CPP-205.cpp:3:17:3:31 | 5 | isFromTemplateInstantiation(fn) |
| CPP-205.cpp:4:3:4:11 | return ... | isFromTemplateInstantiation(fn) |
| CPP-205.cpp:4:3:4:11 | return ... | isFromUninstantiatedTemplate(fn) |
| CPP-205.cpp:4:10:4:10 | 0 | isFromTemplateInstantiation(fn) |
| CPP-205.cpp:4:10:4:10 | 0 | isFromUninstantiatedTemplate(fn) |
| CPP-205.cpp:7:5:7:8 | definition of main | function declaration entry for int main() |
| CPP-205.cpp:7:5:7:8 | main | function int main() |
| CPP-205.cpp:7:12:9:1 | { ... } | |
| CPP-205.cpp:8:3:8:15 | return ... | |
| CPP-205.cpp:8:10:8:11 | call to fn | |
| CPP-205.cpp:8:13:8:13 | 0 | |
| file://:0:0:0:0 | (unnamed parameter 0) | parameter for __va_list_tag& __va_list_tag::operator=(__va_list_tag const&) |
| file://:0:0:0:0 | (unnamed parameter 0) | parameter for __va_list_tag& __va_list_tag::operator=(__va_list_tag&&) |
| file://:0:0:0:0 | __super | |
| file://:0:0:0:0 | __va_list_tag | |
| file://:0:0:0:0 | operator= | function __va_list_tag& __va_list_tag::operator=(__va_list_tag const&) |
| file://:0:0:0:0 | operator= | function __va_list_tag& __va_list_tag::operator=(__va_list_tag&&) |
| file://:0:0:0:0 | y | |

View File

@@ -14,10 +14,20 @@ string describe(Element e) {
result =
"parameter declaration entry for " +
getIdentityString(e.(ParameterDeclarationEntry).getFunctionDeclarationEntry().getFunction())
or
exists(Element template |
e.isFromTemplateInstantiation(template) and
result = "isFromTemplateInstantiation(" + template.toString() + ")"
)
or
exists(Element template |
e.isFromUninstantiatedTemplate(template) and
result = "isFromUninstantiatedTemplate(" + template.toString() + ")"
)
}
from Element e
where
not e.getLocation() instanceof UnknownLocation and
e.getLocation().getFile().getBaseName() != "" and
not e instanceof Folder
select e, concat(describe(e), ", ")
select e, strictconcat(describe(e), ", ")

View File

@@ -1,26 +1,9 @@
| captures.cpp:0:0:0:0 | captures.cpp |
| 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 |
@@ -29,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) |
@@ -41,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) |
@@ -78,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) |
@@ -131,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 |
@@ -144,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 ... |
@@ -161,30 +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:0:0:0:0 | end_pos.cpp |
| 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) |
@@ -192,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 ... |
@@ -205,14 +117,10 @@
| 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 | |
| file://:0:0:0:0 | (global namespace) |
| file://:0:0:0:0 | (reference to) |
| file://:0:0:0:0 | (unnamed parameter 0) |
| file://:0:0:0:0 | (unnamed parameter 0) |
@@ -229,90 +137,8 @@
| 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 | ..()(..) |
| file://:0:0:0:0 | ..()(..) |
| file://:0:0:0:0 | ..(*)(..) |
| file://:0:0:0:0 | ..(*)(..) |
| file://:0:0:0:0 | ..(*)(..) |
| file://:0:0:0:0 | ..(..) |
| file://:0:0:0:0 | __super |
| file://:0:0:0:0 | __va_list_tag |
| file://:0:0:0:0 | __va_list_tag & |
| file://:0:0:0:0 | __va_list_tag && |
| file://:0:0:0:0 | auto |
| file://:0:0:0:0 | const __va_list_tag |
| file://:0:0:0:0 | const __va_list_tag & |
| file://:0:0:0:0 | const foo |
| file://:0:0:0:0 | const foo & |
| file://:0:0:0:0 | const lambda [] type at line 3, col. 5 |
| file://:0:0:0:0 | const lambda [] type at line 3, col. 5 & |
| file://:0:0:0:0 | const lambda [] type at line 3, col. 5 * |
| file://:0:0:0:0 | const lambda [] type at line 9, col. 5 |
| file://:0:0:0:0 | const lambda [] type at line 9, col. 5 & |
| file://:0:0:0:0 | const lambda [] type at line 9, col. 5 * |
| file://:0:0:0:0 | const lambda [] type at line 9, col. 15 |
| file://:0:0:0:0 | const lambda [] type at line 9, col. 15 & |
| file://:0:0:0:0 | const lambda [] type at line 9, col. 15 * |
| file://:0:0:0:0 | const lambda [] type at line 15, col. 5 |
| file://:0:0:0:0 | const lambda [] type at line 15, col. 5 & |
| file://:0:0:0:0 | const lambda [] type at line 15, col. 5 * |
| file://:0:0:0:0 | const lambda [] type at line 22, col. 19 |
| file://:0:0:0:0 | const lambda [] type at line 22, col. 19 & |
| file://:0:0:0:0 | const lambda [] type at line 22, col. 19 * |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| file://:0:0:0:0 | declaration of 1st parameter |
| 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([...](...){...}) |
| file://:0:0:0:0 | definition of fp_offset |
| file://:0:0:0:0 | definition of gp_offset |
| file://:0:0:0:0 | definition of overflow_arg_area |
| file://:0:0:0:0 | definition of reg_save_area |
| file://:0:0:0:0 | foo & |
| file://:0:0:0:0 | foo && |
| file://:0:0:0:0 | foo * |
| file://:0:0:0:0 | foo *const |
| file://:0:0:0:0 | fp_offset |
| file://:0:0:0:0 | gp_offset |
| file://:0:0:0:0 | int & |
| file://:0:0:0:0 | lambda [] type at line 3, col. 5 & |
| file://:0:0:0:0 | lambda [] type at line 3, col. 5 && |
| file://:0:0:0:0 | lambda [] type at line 3, col. 5 * |
| file://:0:0:0:0 | lambda [] type at line 9, col. 5 & |
| file://:0:0:0:0 | lambda [] type at line 9, col. 5 && |
| file://:0:0:0:0 | lambda [] type at line 9, col. 5 * |
| file://:0:0:0:0 | lambda [] type at line 9, col. 15 & |
| file://:0:0:0:0 | lambda [] type at line 9, col. 15 && |
| file://:0:0:0:0 | lambda [] type at line 9, col. 15 * |
| file://:0:0:0:0 | lambda [] type at line 15, col. 5 & |
| file://:0:0:0:0 | lambda [] type at line 15, col. 5 && |
| file://:0:0:0:0 | lambda [] type at line 15, col. 5 * |
| file://:0:0:0:0 | lambda [] type at line 22, col. 19 & |
| file://:0:0:0:0 | lambda [] type at line 22, col. 19 && |
| file://:0:0:0:0 | lambda [] type at line 22, col. 19 * |
| file://:0:0:0:0 | operator= |
| file://:0:0:0:0 | operator= |
| file://:0:0:0:0 | overflow_arg_area |
| file://:0:0:0:0 | reg_save_area |
| file://:0:0:0:0 | void * |

View File

@@ -1,8 +1,13 @@
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
not e instanceof BuiltInType and
not e instanceof Specifier and
not e instanceof Folder
where interesting(e.getEnclosingElement*())
select e

View File

@@ -0,0 +1,3 @@
| extern.cpp:1:20:1:20 | T |
| extern.cpp:2:5:2:5 | f |
| extern.cpp:2:7:2:7 | (unnamed parameter 0) |

View File

@@ -0,0 +1,5 @@
import cpp
from Declaration d
where d.getLocation().getFile().getBaseName() != ""
select d

View File

@@ -1,8 +0,0 @@
| extern.cpp:0:0:0:0 | extern.cpp |
| extern.cpp:1:20:1:20 | T |
| extern.cpp:1:20:1:20 | definition of T |
| extern.cpp:2:5:2:5 | declaration of f |
| extern.cpp:2:5:2:5 | f |
| extern.cpp:2:7:2:7 | (unnamed parameter 0) |
| extern.cpp:2:7:2:7 | declaration of 1st parameter |
| extern.cpp:4:1:4:58 | // Currently we don't have an element for this declaration |

View File

@@ -1,8 +0,0 @@
import cpp
from Element e
where
exists(e.getLocation()) and
not e.getLocation() instanceof UnknownLocation and
not e instanceof Folder
select e