@@ -1580,8 +1580,7 @@ class Solution {
15801580
15811581 // / Maps case label items to information tracked about them as they are
15821582 // / being solved.
1583- llvm::MapVector<const CaseLabelItem *, CaseLabelItemInfo>
1584- caseLabelItems;
1583+ llvm::DenseMap<const CaseLabelItem *, CaseLabelItemInfo> caseLabelItems;
15851584
15861585 // / Maps catch nodes to the set of potential throw sites that will be caught
15871586 // / at that location.
@@ -2281,8 +2280,7 @@ class ConstraintSystem {
22812280 llvm::DenseMap<ASTNode, std::pair<ContextualTypeInfo, Type>> contextualTypes;
22822281
22832282 // / Information about each case label item tracked by the constraint system.
2284- llvm::SmallMapVector<const CaseLabelItem *, CaseLabelItemInfo, 4 >
2285- caseLabelItems;
2283+ llvm::SmallDenseMap<const CaseLabelItem *, CaseLabelItemInfo, 4 > caseLabelItems;
22862284
22872285 // / Keep track of all of the potential throw sites.
22882286 // / FIXME: This data structure should be replaced with something that
@@ -2857,9 +2855,6 @@ class ConstraintSystem {
28572855 // / FIXME: Remove this.
28582856 unsigned numFixes;
28592857
2860- // / The length of \c caseLabelItems.
2861- unsigned numCaseLabelItems;
2862-
28632858 // / The length of \c potentialThrowSites.
28642859 unsigned numPotentialThrowSites;
28652860
@@ -3392,9 +3387,19 @@ class ConstraintSystem {
33923387 }
33933388
33943389 void setCaseLabelItemInfo (const CaseLabelItem *item, CaseLabelItemInfo info) {
3395- assert (item != nullptr );
3396- assert (caseLabelItems.count (item) == 0 );
3397- caseLabelItems[item] = info;
3390+ ASSERT (item);
3391+ bool inserted = caseLabelItems.insert ({item, info}).second ;
3392+ ASSERT (inserted);
3393+
3394+ if (solverState) {
3395+ recordChange (SolverTrail::Change::RecordedCaseLabelItemInfo (
3396+ const_cast <CaseLabelItem *>(item)));
3397+ }
3398+ }
3399+
3400+ void removeCaseLabelItemInfo (const CaseLabelItem *item) {
3401+ bool erased = caseLabelItems.erase (item);
3402+ ASSERT (erased);
33983403 }
33993404
34003405 // / Record a given ExprPattern as the parent of its sub-expression.
0 commit comments