mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
C++: Remove getVariableAccess from def-by-ref node
This accessor may not be forward-compatible with an IR-based version, and it's unclear whether it has any use. The `VariableAccess` remains in the `TDefinitionByReferenceNode` constructor since it's used to implement `getType`.
This commit is contained in:
@@ -45,11 +45,6 @@ class Node extends TNode {
|
||||
/** Gets the argument that defines this `DefinitionByReferenceNode`, if any. */
|
||||
Expr asDefiningArgument() { result = this.(DefinitionByReferenceNode).getArgument() }
|
||||
|
||||
/** Gets the VariableAccess that defines this `DefinitionByReferenceNode`, if any. */
|
||||
VariableAccess asDefiningVariableAccess() {
|
||||
result = this.(DefinitionByReferenceNode).getVariableAccess()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the uninitialized local variable corresponding to this node, if
|
||||
* any.
|
||||
@@ -113,8 +108,7 @@ class ParameterNode extends Node, TParameterNode {
|
||||
* A typical example would be a call `f(&x)`. Firstly, there will be flow into
|
||||
* `x` from previous definitions of `x`. Secondly, there will be a
|
||||
* `DefinitionByReferenceNode` to represent the value of `x` after the call has
|
||||
* returned. This node will have its `getArgument()` equal to `&x` and its
|
||||
* `getVariableAccess()` equal to `x`.
|
||||
* returned. This node will have its `getArgument()` equal to `&x`.
|
||||
*/
|
||||
class DefinitionByReferenceNode extends Node, TDefinitionByReferenceNode {
|
||||
VariableAccess va;
|
||||
@@ -127,8 +121,6 @@ class DefinitionByReferenceNode extends Node, TDefinitionByReferenceNode {
|
||||
override Location getLocation() { result = argument.getLocation() }
|
||||
/** Gets the argument corresponding to this node. */
|
||||
Expr getArgument() { result = argument }
|
||||
/** Gets the variable access corresponding to this node. */
|
||||
VariableAccess getVariableAccess() { result = va }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,14 +176,6 @@ DefinitionByReferenceNode definitionByReferenceNodeFromArgument(Expr argument) {
|
||||
result.getArgument() = argument
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the `Node` corresponding to a definition by reference of the variable
|
||||
* that is passed by reference as `va` in a call argument.
|
||||
*/
|
||||
DefinitionByReferenceNode definitionByReferenceNodeFromVariableAccess(VariableAccess va) {
|
||||
result.getVariableAccess() = va
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the `Node` corresponding to the value of an uninitialized local
|
||||
* variable `v`.
|
||||
|
||||
Reference in New Issue
Block a user