mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C++: Tweak namespaces test
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | __va_list_tag | __va_list_tag |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | fp_offset | __va_list_tag::fp_offset |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | gp_offset | __va_list_tag::gp_offset |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | operator= | __va_list_tag::operator= |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | operator= | __va_list_tag::operator= |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | overflow_arg_area | __va_list_tag::overflow_arg_area |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | reg_save_area | __va_list_tag::reg_save_area |
|
||||
| file://:0:0:0:0 | B | namespaces.cpp:32:7:32:7 | x | B::x |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | file://:0:0:0:0 | p#0 | <none> |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | file://:0:0:0:0 | p#0 | <none> |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:13:17:13:17 | f | C::D::f |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:15:12:15:12 | E | C::D::E |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:15:12:15:12 | operator= | C::D::E::operator= |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:15:12:15:12 | operator= | C::D::E::operator= |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:17:12:17:12 | g | C::D::E::g |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:17:18:17:18 | p | <none> |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:18:12:18:12 | a | <none> |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:20:13:20:13 | b | <none> |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | __va_list_tag | __va_list_tag | true |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | fp_offset | __va_list_tag::fp_offset | false |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | gp_offset | __va_list_tag::gp_offset | false |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | operator= | __va_list_tag::operator= | false |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | operator= | __va_list_tag::operator= | false |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | overflow_arg_area | __va_list_tag::overflow_arg_area | false |
|
||||
| file://:0:0:0:0 | (global namespace) | file://:0:0:0:0 | reg_save_area | __va_list_tag::reg_save_area | false |
|
||||
| file://:0:0:0:0 | <none> | file://:0:0:0:0 | auto | <none> | false |
|
||||
| file://:0:0:0:0 | B | namespaces.cpp:32:7:32:7 | x | B::x | true |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | file://:0:0:0:0 | p#0 | <none> | false |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | file://:0:0:0:0 | p#0 | <none> | false |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:13:17:13:17 | f | C::D::f | true |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:15:12:15:12 | E | C::D::E | true |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:15:12:15:12 | operator= | C::D::E::operator= | false |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:15:12:15:12 | operator= | C::D::E::operator= | false |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:17:12:17:12 | g | C::D::E::g | false |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:17:18:17:18 | p | <none> | false |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:18:12:18:12 | a | <none> | false |
|
||||
| namespaces.cpp:11:13:11:13 | C::D | namespaces.cpp:20:13:20:13 | b | <none> | false |
|
||||
|
||||
@@ -6,7 +6,24 @@ string qual(Declaration d) {
|
||||
else result = "<none>"
|
||||
}
|
||||
|
||||
from Namespace n, Declaration d
|
||||
where n = d.getNamespace()
|
||||
select n, d, qual(d)
|
||||
newtype TMaybeNamespace = SomeNamespace(Namespace ns) or NoNamespace()
|
||||
|
||||
class MaybeNamespace extends TMaybeNamespace {
|
||||
string toString() {
|
||||
this = NoNamespace() and result = "<none>"
|
||||
or
|
||||
exists(Namespace ns | this = SomeNamespace(ns) and result = ns.toString())
|
||||
}
|
||||
|
||||
Location getLocation() {
|
||||
exists(Namespace ns |
|
||||
this = SomeNamespace(ns) and result = ns.getLocation())
|
||||
}
|
||||
}
|
||||
|
||||
from MaybeNamespace n, Declaration d
|
||||
where n = SomeNamespace(d.getNamespace())
|
||||
or n = NoNamespace() and not exists(d.getNamespace())
|
||||
select n, d,
|
||||
qual(d),
|
||||
any(boolean b | if d.isTopLevel() then b = true else b = false)
|
||||
|
||||
Reference in New Issue
Block a user