Files
codeql/cpp/ql/test/library-tests/rangeanalysis/rangeanalysis/RangeAnalysis.ql
Jonas Jensen b6038f3caa C++: Remove best-bound logic from test
This logic, in an improved form, is now part of the library itself.
2019-10-29 11:54:32 +01:00

20 lines
708 B
Plaintext

import semmle.code.cpp.rangeanalysis.RangeAnalysis
import semmle.code.cpp.ir.IR
import semmle.code.cpp.controlflow.IRGuards
import semmle.code.cpp.ir.ValueNumbering
query predicate instructionBounds(
Instruction i, Bound b, int delta, boolean upper, Reason reason, Location reasonLoc
) {
(
i.getAUse() instanceof ArgumentOperand
or
exists(ReturnValueInstruction retInstr | retInstr.getReturnValueOperand() = i.getAUse())
) and
boundedInstruction(i, b, delta, upper, reason) and
not valueNumber(b.getInstruction()) = valueNumber(i) and
if reason instanceof CondReason
then reasonLoc = reason.(CondReason).getCond().getLocation()
else reasonLoc instanceof UnknownDefaultLocation
}