File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -1710,7 +1710,7 @@ static void generateEnumCaseBlocks(
1710
1710
1711
1711
auto enumDecl = sourceType.getEnumOrBoundGenericEnum ();
1712
1712
1713
- llvm::DenseMap <EnumElementDecl*, unsigned > caseToIndex;
1713
+ llvm::SmallDenseMap <EnumElementDecl *, unsigned , 16 > caseToIndex;
1714
1714
for (auto &row : rows) {
1715
1715
EnumElementDecl *formalElt;
1716
1716
Pattern *subPattern = nullptr ;
@@ -1774,12 +1774,10 @@ static void generateEnumCaseBlocks(
1774
1774
if (canAssumeExhaustive) {
1775
1775
// Check that Sema didn't let any cases slip through. (This can happen
1776
1776
// with @_downgrade_exhaustivity_check.)
1777
- for (auto elt : enumDecl->getAllElements ()) {
1778
- if (!caseToIndex.count (elt)) {
1779
- canAssumeExhaustive = false ;
1780
- break ;
1781
- }
1782
- }
1777
+ canAssumeExhaustive = llvm::all_of (enumDecl->getAllElements (),
1778
+ [&](const EnumElementDecl *elt) {
1779
+ return caseToIndex.count (elt);
1780
+ });
1783
1781
}
1784
1782
1785
1783
if (!canAssumeExhaustive)
You can’t perform that action at this time.
0 commit comments