mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C++: Use the new predicates in IR dataflow.
This commit is contained in:
@@ -29,9 +29,7 @@ private class PrimaryArgumentNode extends ArgumentNode {
|
||||
PrimaryArgumentNode() { exists(CallInstruction call | op = call.getAnArgumentOperand()) }
|
||||
|
||||
override predicate argumentOf(DataFlowCall call, int pos) {
|
||||
op = call.getPositionalArgumentOperand(pos)
|
||||
or
|
||||
op = call.getThisArgumentOperand() and pos = -1
|
||||
op = call.getPositionalOrThisArgumentOperand(pos)
|
||||
}
|
||||
|
||||
override string toString() {
|
||||
@@ -110,10 +108,10 @@ class ReturnIndirectionNode extends ReturnNode {
|
||||
override ReturnIndirectionInstruction primary;
|
||||
|
||||
override ReturnKind getKind() {
|
||||
result = TIndirectReturnKind(-1) and
|
||||
primary.isThisIndirection()
|
||||
or
|
||||
result = TIndirectReturnKind(primary.getParameter().getIndex())
|
||||
exists(int index |
|
||||
primary.isParameterOrThisIndirection(index) and
|
||||
result = TIndirectReturnKind(index)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -266,10 +266,8 @@ class ParameterIndirectionNode extends ParameterNode {
|
||||
|
||||
override predicate isParameterOf(Function f, int pos) {
|
||||
exists(int index |
|
||||
f.getParameter(index) = instr.getParameter()
|
||||
or
|
||||
index = -1 and
|
||||
instr.getIRVariable().(IRThisVariable).getEnclosingFunction() = f
|
||||
instr.getEnclosingFunction() = f and
|
||||
instr.isParameterOrQualifierIndex(index)
|
||||
|
|
||||
pos = getArgumentPosOfSideEffect(index)
|
||||
)
|
||||
@@ -476,16 +474,8 @@ class DefinitionByReferenceNode extends InstructionNode {
|
||||
instr
|
||||
.getPrimaryInstruction()
|
||||
.(CallInstruction)
|
||||
.getPositionalArgument(instr.getIndex())
|
||||
.getPositionalOrThisArgument(instr.getIndex())
|
||||
.getUnconvertedResultExpression()
|
||||
or
|
||||
result =
|
||||
instr
|
||||
.getPrimaryInstruction()
|
||||
.(CallInstruction)
|
||||
.getThisArgument()
|
||||
.getUnconvertedResultExpression() and
|
||||
instr.getIndex() = -1
|
||||
}
|
||||
|
||||
/** Gets the parameter through which this value is assigned. */
|
||||
|
||||
Reference in New Issue
Block a user