mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
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:
@@ -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() }
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user