Skip to content

Commit b06f749

Browse files
committed
[ConstraintSystem] Fix build failures and formatting.
1 parent c84bd00 commit b06f749

File tree

1 file changed

+26
-27
lines changed

1 file changed

+26
-27
lines changed

lib/Sema/CSSolver.cpp

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,11 +2026,11 @@ static void existingOperatorBindingsForDisjunction(ConstraintSystem &CS, ArrayRe
20262026
if (!decl->isOperator())
20272027
return;
20282028

2029-
for (auto *resolved = CS.getResolvedOverloadSets(); resolved;
2030-
resolved = resolved->Previous) {
2031-
if (!resolved->Choice.isDecl())
2029+
for (auto overload : CS.getResolvedOverloads()) {
2030+
auto resolved = overload.second;
2031+
if (!resolved.choice.isDecl())
20322032
continue;
2033-
auto representativeDecl = resolved->Choice.getDecl();
2033+
auto representativeDecl = resolved.choice.getDecl();
20342034

20352035
if (!representativeDecl->isOperator())
20362036
continue;
@@ -2174,29 +2174,28 @@ Constraint *ConstraintSystem::selectDisjunction() {
21742174

21752175
// Pick the disjunction with the smallest number of favored, then active choices.
21762176
auto cs = this;
2177-
auto minDisjunction =
2178-
std::min_element(disjunctions.begin(), disjunctions.end(),
2179-
[&](Constraint *first, Constraint *second) -> bool {
2180-
unsigned firstFavored = first->countFavoredNestedConstraints();
2181-
unsigned secondFavored = second->countFavoredNestedConstraints();
2182-
2183-
if (firstFavored == secondFavored) {
2184-
// Look for additional choices to favor
2185-
SmallVector<Constraint *, 4> firstExisting;
2186-
SmallVector<Constraint *, 4> secondExisting;
2187-
2188-
existingOperatorBindingsForDisjunction(*cs, first->getNestedConstraints(), firstExisting);
2189-
firstFavored = firstExisting.size() ?: first->countActiveNestedConstraints();
2190-
existingOperatorBindingsForDisjunction(*cs, second->getNestedConstraints(), secondExisting);
2191-
secondFavored = secondExisting.size() ?: second->countActiveNestedConstraints();
2192-
2193-
return firstFavored < secondFavored;
2194-
} else {
2195-
firstFavored = firstFavored ?: first->countActiveNestedConstraints();
2196-
secondFavored = secondFavored ?: second->countActiveNestedConstraints();
2197-
return firstFavored < secondFavored;
2198-
}
2199-
});
2177+
auto minDisjunction = std::min_element(disjunctions.begin(), disjunctions.end(),
2178+
[&](Constraint *first, Constraint *second) -> bool {
2179+
unsigned firstFavored = first->countFavoredNestedConstraints();
2180+
unsigned secondFavored = second->countFavoredNestedConstraints();
2181+
2182+
if (firstFavored == secondFavored) {
2183+
// Look for additional choices to favor
2184+
SmallVector<Constraint *, 4> firstExisting;
2185+
SmallVector<Constraint *, 4> secondExisting;
2186+
2187+
existingOperatorBindingsForDisjunction(*cs, first->getNestedConstraints(), firstExisting);
2188+
firstFavored = firstExisting.size() ? firstExisting.size() : first->countActiveNestedConstraints();
2189+
existingOperatorBindingsForDisjunction(*cs, second->getNestedConstraints(), secondExisting);
2190+
secondFavored = secondExisting.size() ? secondExisting.size() : second->countActiveNestedConstraints();
2191+
2192+
return firstFavored < secondFavored;
2193+
} else {
2194+
firstFavored = firstFavored ? firstFavored : first->countActiveNestedConstraints();
2195+
secondFavored = secondFavored ? secondFavored : second->countActiveNestedConstraints();
2196+
return firstFavored < secondFavored;
2197+
}
2198+
});
22002199

22012200
if (minDisjunction != disjunctions.end())
22022201
return *minDisjunction;

0 commit comments

Comments
 (0)