C++: Fix the definition of GlobalNamespace.getADeclaration()

Globals can still have declarations in declaration statements.
We already rule out local variables etc via the isTopLevel check,
so we don't need to consider DeclStmt.
This commit is contained in:
Ian Lynagh
2018-09-03 13:17:06 +01:00
parent 1fcf156e7e
commit 3fd6a8de7d
2 changed files with 1 additions and 6 deletions

View File

@@ -190,11 +190,6 @@ class GlobalNamespace extends Namespace {
override Declaration getADeclaration() {
suppressWarningForUnused(this) and
not exists(DeclStmt d |
d.getADeclaration() = result and
not result instanceof Function
) and
not exists(ConditionDeclExpr cde | cde.getVariable() = result) and
result.isTopLevel() and
not namespacembrs(_, unresolveElement(result))
}

View File

@@ -5,9 +5,9 @@
| 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 | (global namespace) | namespaces.cpp:40:5:40:13 | globalInt | globalInt | true |
| file://:0:0:0:0 | (global namespace) | namespaces.cpp:42:6:42:18 | globalIntUser | globalIntUser | true |
| file://:0:0:0:0 | <none> | file://:0:0:0:0 | auto | <none> | false |
| file://:0:0:0:0 | <none> | namespaces.cpp:40:5:40:13 | globalInt | <none> | true |
| 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 |