diff options
| author | Craig Topper <craig.topper@gmail.com> | 2015-12-12 06:30:48 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2015-12-12 06:30:48 +0000 |
| commit | f942fde819c29f217a7e4bdc33fad57a185dd2db (patch) | |
| tree | e20bf9796dee330b8fb8a352eb4655380c3a369b /clang/lib | |
| parent | 550654aaf1057267d5c58dd1268df69d9896bf86 (diff) | |
| download | bcm5719-llvm-f942fde819c29f217a7e4bdc33fad57a185dd2db.tar.gz bcm5719-llvm-f942fde819c29f217a7e4bdc33fad57a185dd2db.zip | |
[Sema] Simplify a couple if statements. Explicitly check up front that only one of the expressions is a comparision op. Then if we find that either is a bitwise op, we know it must be the other one. NFC
llvm-svn: 255427
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 9bbc304e2e2..1d1ce443690 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -10474,17 +10474,17 @@ static void DiagnoseBitwisePrecedence(Sema &Self, BinaryOperatorKind Opc, BinaryOperator *LHSBO = dyn_cast<BinaryOperator>(LHSExpr); BinaryOperator *RHSBO = dyn_cast<BinaryOperator>(RHSExpr); - // Check that one of the sides is a comparison operator. + // Check that one of the sides is a comparison operator and the other isn't. bool isLeftComp = LHSBO && LHSBO->isComparisonOp(); bool isRightComp = RHSBO && RHSBO->isComparisonOp(); - if (!isLeftComp && !isRightComp) + if (isLeftComp == isRightComp) return; // Bitwise operations are sometimes used as eager logical ops. // Don't diagnose this. bool isLeftBitwise = LHSBO && LHSBO->isBitwiseOp(); bool isRightBitwise = RHSBO && RHSBO->isBitwiseOp(); - if ((isLeftComp || isLeftBitwise) && (isRightComp || isRightBitwise)) + if (isLeftBitwise || isRightBitwise) return; SourceRange DiagRange = isLeftComp ? SourceRange(LHSExpr->getLocStart(), |

