C++: Use the new names in IR dataflow. Turns out DataFlowCall had its own implementation of getArgument already (which didn't handle qualifiers). The predicate wasn't used anywhere, so I simply removed it, as a better predicate is now available on the base class of DataFlowCall.

This commit is contained in:
Mathias Vorreiter Pedersen
2020-11-21 01:00:59 +01:00
parent 61bbceb201
commit a7644db762
2 changed files with 4 additions and 13 deletions

View File

@@ -28,9 +28,7 @@ private class PrimaryArgumentNode extends ArgumentNode {
PrimaryArgumentNode() { exists(CallInstruction call | op = call.getAnArgumentOperand()) }
override predicate argumentOf(DataFlowCall call, int pos) {
op = call.getPositionalOrThisArgumentOperand(pos)
}
override predicate argumentOf(DataFlowCall call, int pos) { op = call.getArgumentOperand(pos) }
override string toString() {
result = "Argument " + op.(PositionalArgumentOperand).getIndex()
@@ -109,7 +107,7 @@ class ReturnIndirectionNode extends ReturnNode {
override ReturnKind getKind() {
exists(int index |
primary.isParameterOrThisIndirection(index) and
primary.hasIndex(index) and
result = TIndirectReturnKind(index)
)
}
@@ -498,13 +496,6 @@ class DataFlowType = IRType;
/** A function call relevant for data flow. */
class DataFlowCall extends CallInstruction {
/**
* Gets the nth argument for this call.
*
* The range of `n` is from `0` to `getNumberOfArguments() - 1`.
*/
Node getArgument(int n) { result.asInstruction() = this.getPositionalArgument(n) }
Function getEnclosingCallable() { result = this.getEnclosingFunction() }
}

View File

@@ -267,7 +267,7 @@ class ParameterIndirectionNode extends ParameterNode {
override predicate isParameterOf(Function f, int pos) {
exists(int index |
instr.getEnclosingFunction() = f and
instr.isParameterOrQualifierIndex(index)
instr.hasIndex(index)
|
pos = getArgumentPosOfSideEffect(index)
)
@@ -474,7 +474,7 @@ class DefinitionByReferenceNode extends InstructionNode {
instr
.getPrimaryInstruction()
.(CallInstruction)
.getPositionalOrThisArgument(instr.getIndex())
.getArgument(instr.getIndex())
.getUnconvertedResultExpression()
}