Skip to content

Commit 62bb4ef

Browse files
Fix out-of-bounds when providing fixits for the @available attribute.
1 parent 0f98ecc commit 62bb4ef

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,11 +2508,11 @@ static void fixItAvailableAttrRename(InFlightDiagnostic &diag,
25082508
auto I = argumentLabelIDs.begin();
25092509

25102510
auto updateLabelsForArg = [&](Expr *expr) -> bool {
2511+
if (I == argumentLabelIDs.end())
2512+
return true;
2513+
25112514
if (isa<DefaultArgumentExpr>(expr)) {
25122515
// Defaulted: remove param label of it.
2513-
if (I == argumentLabelIDs.end())
2514-
return true;
2515-
25162516
I = argumentLabelIDs.erase(I);
25172517
return false;
25182518
}
@@ -2539,9 +2539,6 @@ static void fixItAvailableAttrRename(InFlightDiagnostic &diag,
25392539
}
25402540

25412541
// Normal: Just advance.
2542-
if (I == argumentLabelIDs.end())
2543-
return true;
2544-
25452542
++I;
25462543
return false;
25472544
};

0 commit comments

Comments
 (0)