Skip to content

Commit 2bc0a8d

Browse files
committed
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`.
1 parent 7ff732d commit 2bc0a8d

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowUtil.qll

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ class Node extends TNode {
4545
/** Gets the argument that defines this `DefinitionByReferenceNode`, if any. */
4646
Expr asDefiningArgument() { result = this.(DefinitionByReferenceNode).getArgument() }
4747

48-
/** Gets the VariableAccess that defines this `DefinitionByReferenceNode`, if any. */
49-
VariableAccess asDefiningVariableAccess() {
50-
result = this.(DefinitionByReferenceNode).getVariableAccess()
51-
}
52-
5348
/**
5449
* Gets the uninitialized local variable corresponding to this node, if
5550
* any.
@@ -113,8 +108,7 @@ class ParameterNode extends Node, TParameterNode {
113108
* A typical example would be a call `f(&x)`. Firstly, there will be flow into
114109
* `x` from previous definitions of `x`. Secondly, there will be a
115110
* `DefinitionByReferenceNode` to represent the value of `x` after the call has
116-
* returned. This node will have its `getArgument()` equal to `&x` and its
117-
* `getVariableAccess()` equal to `x`.
111+
* returned. This node will have its `getArgument()` equal to `&x`.
118112
*/
119113
class DefinitionByReferenceNode extends Node, TDefinitionByReferenceNode {
120114
VariableAccess va;
@@ -127,8 +121,6 @@ class DefinitionByReferenceNode extends Node, TDefinitionByReferenceNode {
127121
override Location getLocation() { result = argument.getLocation() }
128122
/** Gets the argument corresponding to this node. */
129123
Expr getArgument() { result = argument }
130-
/** Gets the variable access corresponding to this node. */
131-
VariableAccess getVariableAccess() { result = va }
132124
}
133125

134126
/**
@@ -184,14 +176,6 @@ DefinitionByReferenceNode definitionByReferenceNodeFromArgument(Expr argument) {
184176
result.getArgument() = argument
185177
}
186178

187-
/**
188-
* Gets the `Node` corresponding to a definition by reference of the variable
189-
* that is passed by reference as `va` in a call argument.
190-
*/
191-
DefinitionByReferenceNode definitionByReferenceNodeFromVariableAccess(VariableAccess va) {
192-
result.getVariableAccess() = va
193-
}
194-
195179
/**
196180
* Gets the `Node` corresponding to the value of an uninitialized local
197181
* variable `v`.

0 commit comments

Comments
 (0)