mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
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:
@@ -190,11 +190,6 @@ class GlobalNamespace extends Namespace {
|
|||||||
|
|
||||||
override Declaration getADeclaration() {
|
override Declaration getADeclaration() {
|
||||||
suppressWarningForUnused(this) and
|
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
|
result.isTopLevel() and
|
||||||
not namespacembrs(_, unresolveElement(result))
|
not namespacembrs(_, unresolveElement(result))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 | 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 | 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) | 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 | (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> | 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 |
|
| 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 | 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 |
|
||||||
|
|||||||
Reference in New Issue
Block a user