C++: Combine the usings tests and add detail about classes.

This commit is contained in:
Geoffrey White
2020-05-04 17:24:04 +01:00
parent 9fc37d174e
commit 3d431607e7
4 changed files with 18 additions and 20 deletions

View File

@@ -1,7 +1,7 @@
| templates.cpp:9:5:9:14 | using declaration |
| usings.cpp:8:1:8:11 | using declaration |
| usings.cpp:9:1:9:17 | using namespace N |
| usings.cpp:18:3:18:13 | using declaration |
| usings.cpp:21:5:21:14 | using declaration |
| usings.cpp:34:3:34:20 | using declaration |
| usings.cpp:42:5:42:22 | using declaration |
| templates.cpp:9:5:9:14 | using declaration | UsingDeclarationEntry, enclosingElement:std |
| usings.cpp:8:1:8:11 | using declaration | UsingDeclarationEntry, enclosingElement:(global namespace) |
| usings.cpp:9:1:9:17 | using namespace N | UsingDirectiveEntry, enclosingElement:(global namespace) |
| usings.cpp:18:3:18:13 | using declaration | UsingDeclarationEntry, enclosingElement:D |
| usings.cpp:21:5:21:14 | using declaration | UsingDeclarationEntry, enclosingElement:{ ... } |
| usings.cpp:34:3:34:20 | using declaration | UsingDeclarationEntry, enclosingElement:TD |
| usings.cpp:42:5:42:22 | using declaration | UsingDeclarationEntry, enclosingElement:nsbar |

View File

@@ -1,4 +1,14 @@
import cpp
string describe(UsingEntry ue) {
ue instanceof UsingDeclarationEntry and
result = "UsingDeclarationEntry"
or
ue instanceof UsingDirectiveEntry and
result = "UsingDirectiveEntry"
or
result = "enclosingElement:" + ue.getEnclosingElement().toString()
}
from UsingEntry ue
select ue
select ue, concat(describe(ue), ", ")

View File

@@ -1,7 +0,0 @@
| templates.cpp:9:5:9:14 | using declaration | file://:0:0:0:0 | std |
| usings.cpp:8:1:8:11 | using declaration | file://:0:0:0:0 | (global namespace) |
| usings.cpp:9:1:9:17 | using namespace N | file://:0:0:0:0 | (global namespace) |
| usings.cpp:18:3:18:13 | using declaration | usings.cpp:16:8:16:8 | D |
| usings.cpp:21:5:21:14 | using declaration | usings.cpp:20:13:23:3 | { ... } |
| usings.cpp:34:3:34:20 | using declaration | usings.cpp:32:8:32:9 | TD |
| usings.cpp:42:5:42:22 | using declaration | usings.cpp:41:11:41:15 | nsbar |

View File

@@ -1,5 +0,0 @@
import cpp
from UsingEntry ue, Element e
where e = ue.getEnclosingElement()
select ue, e