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

Chandler Carruth chandlerc at gmail.com
Sun Dec 12 00:51:33 PST 2010


Author: chandlerc
Date: Sun Dec 12 02:51:33 2010
New Revision: 121629

URL: http://llvm.org/viewvc/llvm-project?rev=121629&view=rev
Log:
Reorder the cases in the switch to be more logically grouped (to my mind). If
others have another ordering they would prefer, I'm all ears, but this one made
it much easier for me to find the group of operators I'm interested in.

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=121629&r1=121628&r2=121629&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sun Dec 12 02:51:33 2010
@@ -5539,11 +5539,19 @@
     assert(false && "Expected an overloaded operator");
     break;
 
-  case OO_Star: // '*' is either unary or binary
-    if (NumArgs == 1)
-      OpBuilder.addUnaryStarPointerOverloads();
-    else
-      OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);
+  case OO_New:
+  case OO_Delete:
+  case OO_Array_New:
+  case OO_Array_Delete:
+  case OO_Call:
+    assert(false && "Special operators don't use AddBuiltinOperatorCandidates");
+    break;
+
+  case OO_Comma:
+  case OO_Arrow:
+    // C++ [over.match.oper]p3:
+    //   -- For the operator ',', the unary operator '&', or the
+    //      operator '->', the built-in candidates set is empty.
     break;
 
   case OO_Plus: // '+' is either unary or binary
@@ -5560,14 +5568,15 @@
     }
     break;
 
-  case OO_Amp: // '&' is either unary or binary
+  case OO_Star: // '*' is either unary or binary
     if (NumArgs == 1)
-      // C++ [over.match.oper]p3:
-      //   -- For the operator ',', the unary operator '&', or the
-      //      operator '->', the built-in candidates set is empty.
-      break;
+      OpBuilder.addUnaryStarPointerOverloads();
+    else
+      OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);
+    break;
 
-    OpBuilder.addBinaryBitwiseArithmeticOverloads(Op);
+  case OO_Slash:
+    OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);
     break;
 
   case OO_PlusPlus:
@@ -5576,25 +5585,6 @@
     OpBuilder.addPlusPlusMinusMinusPointerOverloads();
     break;
 
-  case OO_Tilde:
-    OpBuilder.addUnaryTildePromotedIntegralOverloads();
-    break;
-
-  case OO_New:
-  case OO_Delete:
-  case OO_Array_New:
-  case OO_Array_Delete:
-  case OO_Call:
-    assert(false && "Special operators don't use AddBuiltinOperatorCandidates");
-    break;
-
-  case OO_Comma:
-  case OO_Arrow:
-    // C++ [over.match.oper]p3:
-    //   -- For the operator ',', the unary operator '&', or the
-    //      operator '->', the built-in candidates set is empty.
-    break;
-
   case OO_EqualEqual:
   case OO_ExclaimEqual:
     OpBuilder.addEqualEqualOrNotEqualMemberPointerOverloads();
@@ -5609,10 +5599,6 @@
     OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/true);
     break;
 
-  case OO_Slash:
-    OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);
-    break;
-
   case OO_Percent:
   case OO_Caret:
   case OO_Pipe:
@@ -5621,6 +5607,20 @@
     OpBuilder.addBinaryBitwiseArithmeticOverloads(Op);
     break;
 
+  case OO_Amp: // '&' is either unary or binary
+    if (NumArgs == 1)
+      // C++ [over.match.oper]p3:
+      //   -- For the operator ',', the unary operator '&', or the
+      //      operator '->', the built-in candidates set is empty.
+      break;
+
+    OpBuilder.addBinaryBitwiseArithmeticOverloads(Op);
+    break;
+
+  case OO_Tilde:
+    OpBuilder.addUnaryTildePromotedIntegralOverloads();
+    break;
+
   case OO_Equal:
     OpBuilder.addAssignmentMemberPointerOrEnumeralOverloads();
     // Fall through.





More information about the cfe-commits mailing list