Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5121d7

Browse files
C++: Fix range analysis for new API
1 parent c224bbd commit f5121d7

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

cpp/ql/src/semmle/code/cpp/rangeanalysis/RangeAnalysis.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ private predicate boundedNonPhiOperand(NonPhiOperand op, Bound b, int delta, boo
379379
private predicate boundFlowStepPhi(
380380
PhiOperand op2, Operand op1, int delta, boolean upper, Reason reason
381381
) {
382-
op2.getDefinitionInstruction().getAnOperand().(CopySourceOperand) = op1 and
382+
op2.getDefinitionInstruction().(CopyInstruction).getSourceValueOperand() = op1 and
383383
(upper = true or upper = false) and
384384
reason = TNoReason() and
385385
delta = 0

cpp/ql/src/semmle/code/cpp/rangeanalysis/RangeUtils.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ IntValue getConstantValue(Instruction instr) {
2828
}
2929

3030
predicate valueFlowStep(Instruction i, Operand op, int delta) {
31-
i.getAnOperand().(CopySourceOperand) = op and delta = 0
31+
i.(CopyInstruction).getSourceValueOperand() = op and delta = 0
3232
or
3333
exists(Operand x |
3434
i.(AddInstruction).getAnOperand() = op and

cpp/ql/src/semmle/code/cpp/rangeanalysis/SignAnalysis.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ cached module SignAnalysisCached {
398398
result = castSign(operandSign(ci.getAnOperand()), fromSigned, toSigned, getCastKind(ci))
399399
)
400400
or
401-
result = operandSign(i.getAnOperand().(CopySourceOperand))
401+
result = operandSign(i.(CopyInstruction).getSourceValueOperand())
402402
or
403403
result = operandSign(i.(BitComplementInstruction).getAnOperand()).bitnot()
404404
or

cpp/ql/test/library-tests/rangeanalysis/rangeanalysis/RangeAnalysis.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ query predicate instructionBounds(Instruction i, Bound b, int delta, boolean upp
99
(
1010
i.getAUse() instanceof ArgumentOperand
1111
or
12-
i.getAUse() instanceof ReturnValueOperand
12+
exists(ReturnValueInstruction retInstr |
13+
retInstr.getReturnValueOperand() = i.getAUse()
14+
)
1315
) and
1416
(
1517
upper = true and

0 commit comments

Comments
 (0)