Skip to content

Commit 244a41b

Browse files
committed
[NFC] Cleanup uncovered async diagnostic inserts
All of the work to insert can be done much more easily with just the subscript operator. The densemap subscript will automatically initialize an element at the key if it hasn't already been created. This way we don't need to insert the empty vector at the anchor before emplacing it, we can jump straight to grabbing the vector and doing the insertion.
1 parent 44a2bb3 commit 244a41b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/Sema/TypeCheckEffects.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,15 +2651,10 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
26512651
Expr *expr = E.dyn_cast<Expr*>();
26522652
Expr *anchor = walkToAnchor(expr, parentMap,
26532653
CurContext.isWithinInterpolatedString());
2654-
2655-
auto key = uncoveredAsync.find(anchor);
2656-
if (key == uncoveredAsync.end()) {
2657-
uncoveredAsync.insert({anchor, {}});
2654+
if (uncoveredAsync.find(anchor) == uncoveredAsync.end())
26582655
errorOrder.push_back(anchor);
2659-
}
2660-
uncoveredAsync[anchor].emplace_back(
2661-
*expr,
2662-
classification.getAsyncReason());
2656+
uncoveredAsync[anchor].emplace_back(*expr,
2657+
classification.getAsyncReason());
26632658
}
26642659
}
26652660

0 commit comments

Comments
 (0)