Skip to content

Commit a7644db

Browse files
committed
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.
1 parent 61bbceb commit a7644db

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ private class PrimaryArgumentNode extends ArgumentNode {
2828

2929
PrimaryArgumentNode() { exists(CallInstruction call | op = call.getAnArgumentOperand()) }
3030

31-
override predicate argumentOf(DataFlowCall call, int pos) {
32-
op = call.getPositionalOrThisArgumentOperand(pos)
33-
}
31+
override predicate argumentOf(DataFlowCall call, int pos) { op = call.getArgumentOperand(pos) }
3432

3533
override string toString() {
3634
result = "Argument " + op.(PositionalArgumentOperand).getIndex()
@@ -109,7 +107,7 @@ class ReturnIndirectionNode extends ReturnNode {
109107

110108
override ReturnKind getKind() {
111109
exists(int index |
112-
primary.isParameterOrThisIndirection(index) and
110+
primary.hasIndex(index) and
113111
result = TIndirectReturnKind(index)
114112
)
115113
}
@@ -498,13 +496,6 @@ class DataFlowType = IRType;
498496

499497
/** A function call relevant for data flow. */
500498
class DataFlowCall extends CallInstruction {
501-
/**
502-
* Gets the nth argument for this call.
503-
*
504-
* The range of `n` is from `0` to `getNumberOfArguments() - 1`.
505-
*/
506-
Node getArgument(int n) { result.asInstruction() = this.getPositionalArgument(n) }
507-
508499
Function getEnclosingCallable() { result = this.getEnclosingFunction() }
509500
}
510501

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class ParameterIndirectionNode extends ParameterNode {
267267
override predicate isParameterOf(Function f, int pos) {
268268
exists(int index |
269269
instr.getEnclosingFunction() = f and
270-
instr.isParameterOrQualifierIndex(index)
270+
instr.hasIndex(index)
271271
|
272272
pos = getArgumentPosOfSideEffect(index)
273273
)
@@ -474,7 +474,7 @@ class DefinitionByReferenceNode extends InstructionNode {
474474
instr
475475
.getPrimaryInstruction()
476476
.(CallInstruction)
477-
.getPositionalOrThisArgument(instr.getIndex())
477+
.getArgument(instr.getIndex())
478478
.getUnconvertedResultExpression()
479479
}
480480

0 commit comments

Comments
 (0)