Skip to content

Commit d5b9cea

Browse files
committed
C++: Focus the CPP-205 test on the templates.
1 parent 41a5dc8 commit d5b9cea

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed
Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
1-
| CPP-205.cpp:0:0:0:0 | CPP-205.cpp | |
2-
| CPP-205.cpp:1:20:1:20 | T | |
3-
| CPP-205.cpp:1:20:1:20 | definition of T | |
4-
| CPP-205.cpp:2:5:2:5 | definition of fn | function declaration entry for int fn<int>(int) |
5-
| CPP-205.cpp:2:5:2:5 | fn | function int fn<int>(int) |
6-
| CPP-205.cpp:2:5:2:6 | definition of fn | function declaration entry for int fn<T>(T) |
7-
| CPP-205.cpp:2:5:2:6 | fn | function int fn<T>(T) |
8-
| CPP-205.cpp:2:10:2:12 | definition of out | parameter declaration entry for int fn<T>(T) |
9-
| CPP-205.cpp:2:10:2:12 | definition of out | parameter declaration entry for int fn<int>(int) |
10-
| CPP-205.cpp:2:10:2:12 | out | parameter for int fn<T>(T) |
11-
| CPP-205.cpp:2:10:2:12 | out | parameter for int fn<int>(int) |
12-
| CPP-205.cpp:2:15:5:1 | { ... } | |
13-
| CPP-205.cpp:2:15:5:1 | { ... } | |
14-
| CPP-205.cpp:3:3:3:33 | declaration | |
15-
| CPP-205.cpp:3:3:3:33 | declaration | |
16-
| CPP-205.cpp:3:15:3:15 | declaration of y | |
17-
| CPP-205.cpp:3:15:3:15 | y | |
18-
| CPP-205.cpp:3:17:3:31 | 5 | |
19-
| CPP-205.cpp:4:3:4:11 | return ... | |
20-
| CPP-205.cpp:4:3:4:11 | return ... | |
21-
| CPP-205.cpp:4:10:4:10 | 0 | |
22-
| CPP-205.cpp:4:10:4:10 | 0 | |
1+
| CPP-205.cpp:2:5:2:5 | definition of fn | function declaration entry for int fn<int>(int), isFromTemplateInstantiation(fn) |
2+
| CPP-205.cpp:2:5:2:5 | fn | function int fn<int>(int), isFromTemplateInstantiation(fn) |
3+
| CPP-205.cpp:2:5:2:6 | definition of fn | function declaration entry for int fn<T>(T), isFromUninstantiatedTemplate(fn) |
4+
| CPP-205.cpp:2:5:2:6 | fn | function int fn<T>(T), isFromUninstantiatedTemplate(fn) |
5+
| CPP-205.cpp:2:10:2:12 | definition of out | isFromTemplateInstantiation(fn), parameter declaration entry for int fn<int>(int) |
6+
| CPP-205.cpp:2:10:2:12 | definition of out | isFromUninstantiatedTemplate(fn), parameter declaration entry for int fn<T>(T) |
7+
| CPP-205.cpp:2:10:2:12 | out | isFromTemplateInstantiation(fn), parameter for int fn<int>(int) |
8+
| CPP-205.cpp:2:10:2:12 | out | isFromUninstantiatedTemplate(fn), parameter for int fn<T>(T) |
9+
| CPP-205.cpp:2:15:5:1 | { ... } | isFromTemplateInstantiation(fn) |
10+
| CPP-205.cpp:2:15:5:1 | { ... } | isFromUninstantiatedTemplate(fn) |
11+
| CPP-205.cpp:3:3:3:33 | declaration | isFromTemplateInstantiation(fn) |
12+
| CPP-205.cpp:3:3:3:33 | declaration | isFromUninstantiatedTemplate(fn) |
13+
| CPP-205.cpp:3:15:3:15 | declaration of y | isFromUninstantiatedTemplate(fn) |
14+
| CPP-205.cpp:3:15:3:15 | y | isFromUninstantiatedTemplate(fn) |
15+
| CPP-205.cpp:3:17:3:31 | 5 | isFromTemplateInstantiation(fn) |
16+
| CPP-205.cpp:4:3:4:11 | return ... | isFromTemplateInstantiation(fn) |
17+
| CPP-205.cpp:4:3:4:11 | return ... | isFromUninstantiatedTemplate(fn) |
18+
| CPP-205.cpp:4:10:4:10 | 0 | isFromTemplateInstantiation(fn) |
19+
| CPP-205.cpp:4:10:4:10 | 0 | isFromUninstantiatedTemplate(fn) |
2320
| CPP-205.cpp:7:5:7:8 | definition of main | function declaration entry for int main() |
2421
| CPP-205.cpp:7:5:7:8 | main | function int main() |
25-
| CPP-205.cpp:7:12:9:1 | { ... } | |
26-
| CPP-205.cpp:8:3:8:15 | return ... | |
27-
| CPP-205.cpp:8:10:8:11 | call to fn | |
28-
| CPP-205.cpp:8:13:8:13 | 0 | |

cpp/ql/test/library-tests/CPP-205/elements.ql

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,20 @@ string describe(Element e) {
1414
result =
1515
"parameter declaration entry for " +
1616
getIdentityString(e.(ParameterDeclarationEntry).getFunctionDeclarationEntry().getFunction())
17+
or
18+
exists(Element template |
19+
e.isFromTemplateInstantiation(template) and
20+
result = "isFromTemplateInstantiation(" + template.toString() + ")"
21+
)
22+
or
23+
exists(Element template |
24+
e.isFromUninstantiatedTemplate(template) and
25+
result = "isFromUninstantiatedTemplate(" + template.toString() + ")"
26+
)
1727
}
1828

1929
from Element e
2030
where
2131
e.getLocation().getFile().getBaseName() != "" and
2232
not e instanceof Folder
23-
select e, concat(describe(e), ", ")
33+
select e, strictconcat(describe(e), ", ")

0 commit comments

Comments
 (0)