[cfe-commits] r121626 - /cfe/trunk/lib/Sema/SemaOverload.cpp
Chandler Carruth
chandlerc at gmail.com
Sun Dec 12 00:39:38 PST 2010
Author: chandlerc
Date: Sun Dec 12 02:39:38 2010
New Revision: 121626
URL: http://llvm.org/viewvc/llvm-project?rev=121626&view=rev
Log:
Move and copy function calls around to remove the indirection through gotos
from the switch statement.
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=121626&r1=121625&r2=121626&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sun Dec 12 02:39:38 2010
@@ -5543,7 +5543,7 @@
if (NumArgs == 1)
OpBuilder.addUnaryStarPointerOverloads();
else
- goto BinaryStar;
+ OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);
break;
case OO_Plus: // '+' is either unary or binary
@@ -5551,15 +5551,18 @@
OpBuilder.addUnaryPlusPointerOverloads();
OpBuilder.addUnaryPlusOrMinusArithmeticOverloads();
} else {
- goto BinaryPlus;
+ OpBuilder.addBinaryPlusOrMinusPointerOverloads(Op);
+ OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);
}
break;
case OO_Minus: // '-' is either unary or binary
- if (NumArgs == 1)
+ if (NumArgs == 1) {
OpBuilder.addUnaryPlusOrMinusArithmeticOverloads();
- else
- goto BinaryMinus;
+ } else {
+ OpBuilder.addBinaryPlusOrMinusPointerOverloads(Op);
+ OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);
+ }
break;
case OO_Amp: // '&' is either unary or binary
@@ -5609,15 +5612,7 @@
OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/true);
break;
- BinaryPlus:
- BinaryMinus:
- OpBuilder.addBinaryPlusOrMinusPointerOverloads(Op);
- OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);;
- break;
-
case OO_Slash:
- BinaryStar:
- Conditional:
OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);
break;
@@ -5672,7 +5667,8 @@
case OO_Conditional:
OpBuilder.addConditionalOperatorOverloads();
- goto Conditional;
+ OpBuilder.addGenericBinaryArithmeticOverloads(/*isComparison=*/false);
+ break;
}
}
More information about the cfe-commits
mailing list