[cfe-commits] r121625 - /cfe/trunk/lib/Sema/SemaOverload.cpp

Chandler Carruth chandlerc at gmail.com
Sun Dec 12 00:32:28 PST 2010


Author: chandlerc
Date: Sun Dec 12 02:32:28 2010
New Revision: 121625

URL: http://llvm.org/viewvc/llvm-project?rev=121625&view=rev
Log:
Simplify the flow through the switch by explicitly listing the added overloads
for a few cases.

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=121625&r1=121624&r2=121625&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sun Dec 12 02:32:28 2010
@@ -5533,7 +5533,6 @@
                                            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 @@
   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:





More information about the cfe-commits mailing list