]> granicus.if.org Git - clang/commitdiff
Simplify the flow through the switch by explicitly listing the added overloads
authorChandler Carruth <chandlerc@gmail.com>
Sun, 12 Dec 2010 08:32:28 +0000 (08:32 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 12 Dec 2010 08:32:28 +0000 (08:32 +0000)
for a few cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121625 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp

index 278f232c2c0e790725ded2395f37f66dc01ab9c1..abe1a33fd293e5c235f36bbcfdad1f60d1f248ff 100644 (file)
@@ -5533,7 +5533,6 @@ Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
                                            CandidateTypes, CandidateSet);
 
   // Dispatch over the operation to add in only those overloads which apply.
-  bool isComparison = false;
   switch (Op) {
   case OO_None:
   case NUM_OVERLOADED_OPERATORS:
@@ -5600,31 +5599,26 @@ Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
   case OO_EqualEqual:
   case OO_ExclaimEqual:
     OpBuilder.addEqualEqualOrNotEqualMemberPointerOverloads();
-
-    // Fall through
-
+    // Fall through.
   case OO_Less:
   case OO_Greater:
   case OO_LessEqual:
   case OO_GreaterEqual:
     OpBuilder.addRelationalPointerOrEnumeralOverloads(
       UserDefinedBinaryOperators);
-
-    // Fall through.
-    isComparison = true;
+    OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/true);
+    break;
 
   BinaryPlus:
   BinaryMinus:
-    if (!isComparison) {
-      // We didn't fall through, so we must have OO_Plus or OO_Minus.
-      OpBuilder.addBinaryPlusOrMinusPointerOverloads(Op);
-    }
-    // Fall through
+    OpBuilder.addBinaryPlusOrMinusPointerOverloads(Op);
+    OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);;
+    break;
 
   case OO_Slash:
   BinaryStar:
   Conditional:
-    OpBuilder.addGenericBinaryArithmeticOverloads(isComparison);
+    OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);
     break;
 
   case OO_Percent: