Skip to content

Commit dd5b561

Browse files
committed
C++: Use getValue(e) instead of e.getValue()
1 parent a72d05c commit dd5b561

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private class UnsignedBitwiseAndExpr extends BitwiseAndExpr {
126126
UnsignedBitwiseAndExpr() {
127127
(
128128
getLeftOperand().getFullyConverted().getType().getUnderlyingType().(IntegralType).isUnsigned() or
129-
getLeftOperand().getFullyConverted().getValue().toInt() >= 0
129+
getValue(getLeftOperand().getFullyConverted()).toInt() >= 0
130130
) and
131131
(
132132
getRightOperand()
@@ -135,7 +135,7 @@ private class UnsignedBitwiseAndExpr extends BitwiseAndExpr {
135135
.getUnderlyingType()
136136
.(IntegralType)
137137
.isUnsigned() or
138-
getRightOperand().getFullyConverted().getValue().toInt() >= 0
138+
getValue(getRightOperand().getFullyConverted()).toInt() >= 0
139139
)
140140
}
141141
}
@@ -164,8 +164,8 @@ private class MulByConstantExpr extends MulExpr {
164164
MulByConstantExpr() {
165165
exists(Expr constantExpr |
166166
this.hasOperands(constantExpr, operand) and
167-
constant = constantExpr.getFullyConverted().getValue().toFloat() and
168-
not exists(operand.getFullyConverted().getValue().toFloat())
167+
constant = getValue(constantExpr.getFullyConverted()).toFloat() and
168+
not exists(getValue(operand.getFullyConverted()).toFloat())
169169
)
170170
}
171171

@@ -220,7 +220,7 @@ private predicate multipliesByNegative(Expr expr, Expr operand, float negative)
220220
private class AssignMulByConstantExpr extends AssignMulExpr {
221221
float constant;
222222

223-
AssignMulByConstantExpr() { constant = this.getRValue().getFullyConverted().getValue().toFloat() }
223+
AssignMulByConstantExpr() { constant = getValue(this.getRValue().getFullyConverted()).toFloat() }
224224

225225
float getConstant() { result = constant }
226226
}
@@ -294,7 +294,7 @@ private predicate analyzableExpr(Expr e) {
294294
e instanceof UnsignedBitwiseAndExpr
295295
or
296296
// `>>` by a constant
297-
exists(e.(RShiftExpr).getRightOperand().getValue())
297+
exists(getValue(e.(RShiftExpr).getRightOperand()))
298298
)
299299
}
300300

@@ -415,7 +415,7 @@ private predicate exprDependsOnDef(Expr e, RangeSsaDefinition srcDef, StackVaria
415415
// `>>` by a constant
416416
exists(RShiftExpr rs |
417417
rs = e and
418-
exists(rs.getRightOperand().getValue()) and
418+
exists(getValue(rs.getRightOperand())) and
419419
exprDependsOnDef(rs.getLeftOperand(), srcDef, srcVar)
420420
)
421421
or
@@ -851,7 +851,7 @@ private float getLowerBoundsImpl(Expr expr) {
851851
exists(RShiftExpr rsExpr, float left, int right |
852852
rsExpr = expr and
853853
left = getFullyConvertedLowerBounds(rsExpr.getLeftOperand()) and
854-
right = rsExpr.getRightOperand().getFullyConverted().getValue().toInt() and
854+
right = getValue(rsExpr.getRightOperand().getFullyConverted()).toInt() and
855855
result = safeFloor(left / 2.pow(right))
856856
)
857857
}
@@ -1037,7 +1037,7 @@ private float getUpperBoundsImpl(Expr expr) {
10371037
exists(RShiftExpr rsExpr, float left, int right |
10381038
rsExpr = expr and
10391039
left = getFullyConvertedUpperBounds(rsExpr.getLeftOperand()) and
1040-
right = rsExpr.getRightOperand().getFullyConverted().getValue().toInt() and
1040+
right = getValue(rsExpr.getRightOperand().getFullyConverted()).toInt() and
10411041
result = safeFloor(left / 2.pow(right))
10421042
)
10431043
}

0 commit comments

Comments
 (0)