mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
C#: Rename shift expression classes.
This commit is contained in:
@@ -105,7 +105,7 @@ private predicate evenlyDivisibleExpr(Expr e, int factor) {
|
||||
exists(ConstantIntegerExpr c, int k | k = c.getIntValue() |
|
||||
e.(MulExpr).getAnOperand() = c and factor = k.abs() and factor >= 2
|
||||
or
|
||||
e.(LShiftExpr).getRhs() = c and factor = 2.pow(k) and k > 0
|
||||
e.(LeftShiftExpr).getRhs() = c and factor = 2.pow(k) and k > 0
|
||||
or
|
||||
e.(BitwiseAndExpr).getAnOperand() = c and factor = max(int f | andmaskFactor(k, f))
|
||||
)
|
||||
|
||||
@@ -30,7 +30,10 @@ module Private {
|
||||
|
||||
class MulExpr = RU::ExprNode::MulExpr;
|
||||
|
||||
class LShiftExpr = RU::ExprNode::LShiftExpr;
|
||||
class LeftShiftExpr = RU::ExprNode::LeftShiftExpr;
|
||||
|
||||
/** DEPRECATED: Alias for LeftShiftExpr. */
|
||||
deprecated class LShiftExpr = LeftShiftExpr;
|
||||
|
||||
predicate guardDirectlyControlsSsaRead = RU::guardControlsSsaRead/3;
|
||||
|
||||
|
||||
@@ -391,19 +391,25 @@ module ExprNode {
|
||||
}
|
||||
|
||||
/** A left-shift operation. */
|
||||
class LShiftExpr extends BinaryOperation {
|
||||
override CS::LShiftExpr e;
|
||||
class LeftShiftExpr extends BinaryOperation {
|
||||
override CS::LeftShiftExpr e;
|
||||
|
||||
override TLShiftOp getOp() { any() }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for LeftShiftExpr. */
|
||||
deprecated class LShiftExpr = LeftShiftExpr;
|
||||
|
||||
/** A right-shift operation. */
|
||||
class RShiftExpr extends BinaryOperation {
|
||||
override CS::RShiftExpr e;
|
||||
class RightShiftExpr extends BinaryOperation {
|
||||
override CS::RightShiftExpr e;
|
||||
|
||||
override TRShiftOp getOp() { any() }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for RightShiftExpr. */
|
||||
deprecated class RShiftExpr = RightShiftExpr;
|
||||
|
||||
/** A conditional expression. */
|
||||
class ConditionalExpr extends ExprNode {
|
||||
override CS::ConditionalExpr e;
|
||||
|
||||
@@ -211,8 +211,8 @@ private module Impl {
|
||||
not e.getExpr() instanceof BitwiseAndExpr and
|
||||
not e.getExpr() instanceof BitwiseOrExpr and
|
||||
not e.getExpr() instanceof BitwiseXorExpr and
|
||||
not e.getExpr() instanceof LShiftExpr and
|
||||
not e.getExpr() instanceof RShiftExpr and
|
||||
not e.getExpr() instanceof LeftShiftExpr and
|
||||
not e.getExpr() instanceof RightShiftExpr and
|
||||
not e.getExpr() instanceof ConditionalExpr and
|
||||
not e.getExpr() instanceof RefExpr and
|
||||
not e.getExpr() instanceof LocalVariableDeclAndInitExpr and
|
||||
|
||||
@@ -31,7 +31,7 @@ class ComplementExpr extends UnaryBitwiseOperation, @bit_not_expr {
|
||||
* A binary bitwise operation. Either a bitwise-and operation
|
||||
* (`BitwiseAndExpr`), a bitwise-or operation (`BitwiseOrExpr`),
|
||||
* a bitwise exclusive-or operation (`BitwiseXorExpr`), a left-shift
|
||||
* operation (`LShiftExpr`), or a right-shift operation (`RShiftExpr`).
|
||||
* operation (`LeftShiftExpr`), or a right-shift operation (`RightShiftExpr`).
|
||||
*/
|
||||
class BinaryBitwiseOperation extends BitwiseOperation, BinaryOperation, @bin_bit_op_expr {
|
||||
override string getOperator() { none() }
|
||||
@@ -40,21 +40,27 @@ class BinaryBitwiseOperation extends BitwiseOperation, BinaryOperation, @bin_bit
|
||||
/**
|
||||
* A left-shift operation, for example `x << y`.
|
||||
*/
|
||||
class LShiftExpr extends BinaryBitwiseOperation, @lshift_expr {
|
||||
class LeftShiftExpr extends BinaryBitwiseOperation, @lshift_expr {
|
||||
override string getOperator() { result = "<<" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "LShiftExpr" }
|
||||
override string getAPrimaryQlClass() { result = "LeftShiftExpr" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for LeftShiftExpr. */
|
||||
deprecated class LShiftExpr = LeftShiftExpr;
|
||||
|
||||
/**
|
||||
* A right-shift operation, for example `x >> y`.
|
||||
*/
|
||||
class RShiftExpr extends BinaryBitwiseOperation, @rshift_expr {
|
||||
class RightShiftExpr extends BinaryBitwiseOperation, @rshift_expr {
|
||||
override string getOperator() { result = ">>" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "RShiftExpr" }
|
||||
override string getAPrimaryQlClass() { result = "RightShiftExpr" }
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for RightShiftExpr. */
|
||||
deprecated class RShiftExpr = RightShiftExpr;
|
||||
|
||||
/**
|
||||
* A bitwise-and operation, for example `x & y`.
|
||||
*/
|
||||
|
||||
@@ -1091,9 +1091,9 @@ class TranslatedCast extends TranslatedNonConstantExpr {
|
||||
}
|
||||
|
||||
private Opcode binaryBitwiseOpcode(BinaryBitwiseOperation expr) {
|
||||
expr instanceof LShiftExpr and result instanceof Opcode::ShiftLeft
|
||||
expr instanceof LeftShiftExpr and result instanceof Opcode::ShiftLeft
|
||||
or
|
||||
expr instanceof RShiftExpr and result instanceof Opcode::ShiftRight
|
||||
expr instanceof RightShiftExpr and result instanceof Opcode::ShiftRight
|
||||
or
|
||||
expr instanceof BitwiseAndExpr and result instanceof Opcode::BitAnd
|
||||
or
|
||||
|
||||
@@ -25,7 +25,7 @@ indexers.cs:
|
||||
# 18| -1: [TypeMention] Int32[]
|
||||
# 18| 1: [TypeMention] int
|
||||
# 18| 0: [AddExpr] ... + ...
|
||||
# 18| 0: [RShiftExpr] ... >> ...
|
||||
# 18| 0: [RightShiftExpr] ... >> ...
|
||||
# 18| 0: [SubExpr] ... - ...
|
||||
# 18| 0: [ParameterAccess] access to parameter length
|
||||
# 18| 1: [IntLiteral] 1
|
||||
@@ -68,10 +68,10 @@ indexers.cs:
|
||||
# 32| 0: [BitwiseAndExpr] ... & ...
|
||||
# 32| 0: [ArrayAccess] access to array element
|
||||
# 32| -1: [FieldAccess] access to field bits
|
||||
# 32| 0: [RShiftExpr] ... >> ...
|
||||
# 32| 0: [RightShiftExpr] ... >> ...
|
||||
# 32| 0: [ParameterAccess] access to parameter index
|
||||
# 32| 1: [IntLiteral] 5
|
||||
# 32| 1: [LShiftExpr] ... << ...
|
||||
# 32| 1: [LeftShiftExpr] ... << ...
|
||||
# 32| 0: [IntLiteral] 1
|
||||
# 32| 1: [ParameterAccess] access to parameter index
|
||||
# 32| 1: [IntLiteral] 0
|
||||
@@ -99,10 +99,10 @@ indexers.cs:
|
||||
# 42| 0: [AssignOrExpr] ... |= ...
|
||||
# 42| 0: [ArrayAccess] access to array element
|
||||
# 42| -1: [FieldAccess] access to field bits
|
||||
# 42| 0: [RShiftExpr] ... >> ...
|
||||
# 42| 0: [RightShiftExpr] ... >> ...
|
||||
# 42| 0: [ParameterAccess] access to parameter index
|
||||
# 42| 1: [IntLiteral] 5
|
||||
# 42| 1: [LShiftExpr] ... << ...
|
||||
# 42| 1: [LeftShiftExpr] ... << ...
|
||||
# 42| 0: [IntLiteral] 1
|
||||
# 42| 1: [ParameterAccess] access to parameter index
|
||||
# 45| 2: [BlockStmt] {...}
|
||||
@@ -110,11 +110,11 @@ indexers.cs:
|
||||
# 46| 0: [AssignAndExpr] ... &= ...
|
||||
# 46| 0: [ArrayAccess] access to array element
|
||||
# 46| -1: [FieldAccess] access to field bits
|
||||
# 46| 0: [RShiftExpr] ... >> ...
|
||||
# 46| 0: [RightShiftExpr] ... >> ...
|
||||
# 46| 0: [ParameterAccess] access to parameter index
|
||||
# 46| 1: [IntLiteral] 5
|
||||
# 46| 1: [ComplementExpr] ~...
|
||||
# 46| 0: [LShiftExpr] ... << ...
|
||||
# 46| 0: [LeftShiftExpr] ... << ...
|
||||
# 46| 0: [IntLiteral] 1
|
||||
# 46| 1: [ParameterAccess] access to parameter index
|
||||
# 53| 2: [Class] CountPrimes
|
||||
|
||||
Reference in New Issue
Block a user