@@ -24,11 +24,11 @@ predicate isConstantExpression(Expr e) {
2424
2525bindingset [ right, leftType]
2626pragma [ inline_late]
27- predicate isValidShiftConstantRange ( Expr right , MisraCpp23BuiltInTypes :: NumericType leftType ) {
27+ predicate isValidShiftConstantRange ( Expr right , Type leftType ) {
2828 exists ( int value |
2929 value = right .getValue ( ) .toInt ( ) and
3030 value >= 0 and
31- value < leftType .getBuiltInSize ( ) * 8
31+ value < leftType .getSize ( ) * 8
3232 )
3333}
3434
9999 )
100100 or
101101 // Shift operators - right operand must be unsigned or constant in valid range
102- exists (
103- BinaryShiftOpOrAssignOp shift , Expr right , Type rightType ,
104- MisraCpp23BuiltInTypes:: NumericType leftType
105- |
102+ exists ( BinaryShiftOpOrAssignOp shift , Expr right , Type rightType , Type leftType |
106103 right = shift .getRightOperand ( ) and
107104 x = right and
108105 rightType = right .getExplicitlyConverted ( ) .getType ( ) and
@@ -113,7 +110,7 @@ where
113110 not isValidShiftConstantRange ( right , leftType ) and
114111 message =
115112 "Shift operator '" + shift .getOperator ( ) + "' shifts by " + right .getValue ( ) .toInt ( ) +
116- " which is not within the valid range 0.." + ( ( leftType .getBuiltInSize ( ) * 8 ) - 1 ) + "."
113+ " which is not within the valid range 0.." + ( ( leftType .getSize ( ) * 8 ) - 1 ) + "."
117114 else (
118115 not MisraCpp23BuiltInTypes:: isUnsignedType ( rightType ) and
119116 message =
0 commit comments