mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
Merge pull request #9720 from jketema/linkage
C++: Support link targets for global and namespace variables
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: feature
|
||||
---
|
||||
* Added support for getting the link targets of global and namespace variables.
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -473,6 +473,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