mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Constraint] Sort constraint printing by favored, unmarked, and disabled in that order for printing only.
This commit is contained in:
@@ -343,8 +343,21 @@ void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm, bool skipLocat
|
|||||||
Out << "]]";
|
Out << "]]";
|
||||||
}
|
}
|
||||||
Out << ":\n";
|
Out << ":\n";
|
||||||
|
|
||||||
|
// Sort constraints by favored, unmarked, disabled
|
||||||
|
// for printing only.
|
||||||
|
std::vector<Constraint *> sortedConstraints(getNestedConstraints().begin(),
|
||||||
|
getNestedConstraints().end());
|
||||||
|
llvm::sort(sortedConstraints,
|
||||||
|
[](const Constraint *lhs, const Constraint *rhs) {
|
||||||
|
if (lhs->isFavored() != rhs->isFavored())
|
||||||
|
return lhs->isFavored();
|
||||||
|
if (lhs->isDisabled() != rhs->isDisabled())
|
||||||
|
return rhs->isDisabled();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
interleave(getNestedConstraints(),
|
interleave(sortedConstraints,
|
||||||
[&](Constraint *constraint) {
|
[&](Constraint *constraint) {
|
||||||
if (constraint->isDisabled())
|
if (constraint->isDisabled())
|
||||||
Out << "> [disabled] ";
|
Out << "> [disabled] ";
|
||||||
|
|||||||
Reference in New Issue
Block a user