Skip to content

Commit 1576bcf

Browse files
author
Robert Marsh
committed
C++: remove unused predicates
1 parent 3bfcf0b commit 1576bcf

File tree

2 files changed

+2
-34
lines changed

2 files changed

+2
-34
lines changed

cpp/ql/src/semmle/code/cpp/ir/dataflow/DefaultTaintTracking.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private predicate instructionTaintStep(Instruction i1, Instruction i2) {
172172
any(CallInstruction call |
173173
exists(int indexIn |
174174
modelTaintToReturnValue(call.getStaticCallTarget(), indexIn) and
175-
i1 = DataFlow::getACallArgumentOrIndirection(call, indexIn)
175+
i1 = getACallArgumentOrIndirection(call, indexIn)
176176
)
177177
)
178178
or
@@ -185,7 +185,7 @@ private predicate instructionTaintStep(Instruction i1, Instruction i2) {
185185
any(WriteSideEffectInstruction outNode |
186186
exists(CallInstruction call, int indexIn, int indexOut |
187187
modelTaintToParameter(call.getStaticCallTarget(), indexIn, indexOut) and
188-
i1 = DataFlow::getACallArgumentOrIndirection(call, indexIn) and
188+
i1 = getACallArgumentOrIndirection(call, indexIn) and
189189
outNode.getIndex() = indexOut and
190190
outNode.getPrimaryInstruction() = call
191191
)

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

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -337,38 +337,6 @@ private predicate modelFlow(Instruction iFrom, Instruction iTo) {
337337
)
338338
}
339339

340-
/**
341-
* Get an instruction that goes into argument `argumentIndex` of `call`. This
342-
* can be either directly or through one pointer indirection.
343-
*/
344-
Instruction getACallArgumentOrIndirection(CallInstruction call, int argumentIndex) {
345-
result = call.getPositionalArgument(argumentIndex)
346-
or
347-
exists(ReadSideEffectInstruction readSE |
348-
// TODO: why are read side effect operands imprecise?
349-
result = readSE.getSideEffectOperand().getAnyDef() and
350-
readSE.getPrimaryInstruction() = call and
351-
readSE.getIndex() = argumentIndex
352-
)
353-
}
354-
355-
private predicate modelFlowToParameter(Function f, int parameterIn, int parameterOut) {
356-
exists(FunctionInput modelIn, FunctionOutput modelOut |
357-
f.(DataFlowFunction).hasDataFlow(modelIn, modelOut) and
358-
(modelIn.isParameter(parameterIn) or modelIn.isParameterDeref(parameterIn)) and
359-
modelOut.isParameterDeref(parameterOut)
360-
)
361-
}
362-
363-
private predicate modelFlowToReturnValue(Function f, int parameterIn) {
364-
// Data flow from parameter to return value
365-
exists(FunctionInput modelIn, FunctionOutput modelOut |
366-
f.(DataFlowFunction).hasDataFlow(modelIn, modelOut) and
367-
(modelIn.isParameter(parameterIn) or modelIn.isParameterDeref(parameterIn)) and
368-
(modelOut.isReturnValue() or modelOut.isReturnValueDeref())
369-
)
370-
}
371-
372340
/**
373341
* Holds if data flows from `source` to `sink` in zero or more local
374342
* (intra-procedural) steps.

0 commit comments

Comments
 (0)