C++: Add DefinitionByReferenceNode.getParameter

This commits also adds a test that uses `getParameter`. The new tests
demonstrate that support for array-to-pointer decay works, but we get
data flow to the array rather than its contents.
This commit is contained in:
Jonas Jensen
2019-02-28 09:10:38 +01:00
parent 2bc0a8d6fb
commit 8e6daafd7c
5 changed files with 55 additions and 0 deletions

View File

@@ -121,6 +121,13 @@ class DefinitionByReferenceNode extends Node, TDefinitionByReferenceNode {
override Location getLocation() { result = argument.getLocation() }
/** Gets the argument corresponding to this node. */
Expr getArgument() { result = argument }
/** Gets the parameter through which this value is assigned. */
Parameter getParameter() {
exists(FunctionCall call, int i |
argument = call.getArgument(i) and
result = call.getTarget().getParameter(i)
)
}
}
/**