C++: Fix 'asParameter' to handle references.

This commit is contained in:
Mathias Vorreiter Pedersen
2022-11-16 14:05:42 +00:00
parent 2cebd5c51d
commit 235a06903e

View File

@@ -235,7 +235,13 @@ class Node extends TIRDataFlowNode {
Expr asIndirectArgument() { result = this.asIndirectArgument(_) }
/** Gets the positional parameter corresponding to this node, if any. */
Parameter asParameter() { result = this.asParameter(0) }
Parameter asParameter() {
exists(int indirectionIndex | result = this.asParameter(indirectionIndex) |
if result.getUnspecifiedType() instanceof ReferenceType
then indirectionIndex = 1
else indirectionIndex = 0
)
}
/**
* Gets the uninitialized local variable corresponding to this node, if