mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C++: Support link targets for global and namespace variables
This commit is contained in:
@@ -41,6 +41,15 @@ class LinkTarget extends @link_target {
|
||||
* translation units which contributed to this link target.
|
||||
*/
|
||||
Class getAClass() { link_parent(unresolveElement(result), this) }
|
||||
|
||||
/**
|
||||
* Gets a global or namespace variable which was compiled into this
|
||||
* link target, or had its declaration included by one of the translation
|
||||
* units which contributed to this link target.
|
||||
*/
|
||||
GlobalOrNamespaceVariable getAGlobalOrNamespaceVariable() {
|
||||
link_parent(unresolveElement(result), this)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -471,6 +471,9 @@ class GlobalOrNamespaceVariable extends Variable, @globalvariable {
|
||||
override Type getType() { globalvariables(underlyingElement(this), unresolveElement(result), _) }
|
||||
|
||||
override Element getEnclosingElement() { none() }
|
||||
|
||||
/** Gets a link target which compiled or referenced this global or namespace variable. */
|
||||
LinkTarget getALinkTarget() { this = result.getAGlobalOrNamespaceVariable() }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user