Skip to content

Commit 0d8a161

Browse files
committed
[NFC][ConstraintSystem] Update the documentation for
existingOperatorBindingsForDisjunction.
1 parent 423d6bd commit 0d8a161

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/Sema/CSSolver.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,8 +2013,13 @@ static Constraint *tryOptimizeGenericDisjunction(
20132013
llvm_unreachable("covered switch");
20142014
}
20152015

2016-
// Performance hack: favor operator overloads with decl or type we're already
2017-
// binding elsewhere in this expression.
2016+
/// Populates the \c found vector with the indices of the given constraints
2017+
/// that have a matching type to an existing operator binding elsewhere in
2018+
/// the expression.
2019+
///
2020+
/// Operator bindings that have a matching type to an existing binding
2021+
/// are attempted first by the solver because it's very common to chain
2022+
/// operators of the same type together.
20182023
static void existingOperatorBindingsForDisjunction(ConstraintSystem &CS,
20192024
ArrayRef<Constraint *> constraints,
20202025
SmallVectorImpl<unsigned> &found) {
@@ -2056,7 +2061,6 @@ static void existingOperatorBindingsForDisjunction(ConstraintSystem &CS,
20562061
void ConstraintSystem::partitionDisjunction(
20572062
ArrayRef<Constraint *> Choices, SmallVectorImpl<unsigned> &Ordering,
20582063
SmallVectorImpl<unsigned> &PartitionBeginning) {
2059-
20602064
// Apply a special-case rule for favoring one generic function over
20612065
// another.
20622066
if (auto favored = tryOptimizeGenericDisjunction(DC, Choices)) {

0 commit comments

Comments
 (0)