aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-12-12 08:32:28 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-12-12 08:32:28 +0000
commitdaf55d39306dccd13db46586c071262d9ace5533 (patch)
tree4f92e57c48778c165a7634759c061b5057a8b155 /lib/Sema/SemaOverload.cpp
parent6df868e8d69347d6141baa41b95a96d22c8eaefd (diff)
Simplify the flow through the switch by explicitly listing the added overloads
for a few cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121625 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 278f232c2c..abe1a33fd2 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -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: