diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp index c8ae41c..ea84053 100644 --- a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp @@ -1147,16 +1147,18 @@ void RedundantExpressionCheck::checkArithmeticExpr( } } -static bool exprEvaluatesToZero(BinaryOperatorKind Opcode, APSInt Value) { +static bool exprEvaluatesToZero(BinaryOperatorKind Opcode, + const APSInt &Value) { return (Opcode == BO_And || Opcode == BO_AndAssign) && Value == 0; } static bool exprEvaluatesToBitwiseNegatedZero(BinaryOperatorKind Opcode, - APSInt Value) { + const APSInt &Value) { return (Opcode == BO_Or || Opcode == BO_OrAssign) && ~Value == 0; } -static bool exprEvaluatesToSymbolic(BinaryOperatorKind Opcode, APSInt Value) { +static bool exprEvaluatesToSymbolic(BinaryOperatorKind Opcode, + const APSInt &Value) { return ((Opcode == BO_Or || Opcode == BO_OrAssign) && Value == 0) || ((Opcode == BO_And || Opcode == BO_AndAssign) && ~Value == 0); } |
