]> granicus.if.org Git - clang/commitdiff
[Sema] Simplify a couple if statements. Explicitly check up front that only one of...
authorCraig Topper <craig.topper@gmail.com>
Sat, 12 Dec 2015 06:30:48 +0000 (06:30 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 12 Dec 2015 06:30:48 +0000 (06:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255427 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp

index 9bbc304e2e27108ea9682c3c47e6391acd041bcc..1d1ce4436909fefb6ae5bcbbb4396663f9a5cc40 100644 (file)
@@ -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(),