@@ -579,16 +579,17 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
579579
580580 unsigned i = StartAt;
581581 for (unsigned e = Changes.size (); i != e; ++i) {
582- if (Changes[i].indentAndNestingLevel () < IndentAndNestingLevel)
582+ auto &CurrentChange = Changes[i];
583+ if (CurrentChange.indentAndNestingLevel () < IndentAndNestingLevel)
583584 break ;
584585
585- if (Changes[i] .NewlinesBefore != 0 ) {
586+ if (CurrentChange .NewlinesBefore != 0 ) {
586587 CommasBeforeMatch = 0 ;
587588 EndOfSequence = i;
588589
589590 // Whether to break the alignment sequence because of an empty line.
590591 bool EmptyLineBreak =
591- (Changes[i] .NewlinesBefore > 1 ) && !ACS.AcrossEmptyLines ;
592+ (CurrentChange .NewlinesBefore > 1 ) && !ACS.AcrossEmptyLines ;
592593
593594 // Whether to break the alignment sequence because of a line without a
594595 // match.
@@ -600,27 +601,27 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
600601
601602 // A new line starts, re-initialize line status tracking bools.
602603 // Keep the match state if a string literal is continued on this line.
603- if (i == 0 || Changes[i] .Tok ->isNot (tok::string_literal) ||
604+ if (i == 0 || CurrentChange .Tok ->isNot (tok::string_literal) ||
604605 Changes[i - 1 ].Tok ->isNot (tok::string_literal)) {
605606 FoundMatchOnLine = false ;
606607 }
607608 LineIsComment = true ;
608609 }
609610
610- if (Changes[i] .Tok ->isNot (tok::comment))
611+ if (CurrentChange .Tok ->isNot (tok::comment))
611612 LineIsComment = false ;
612613
613- if (Changes[i] .Tok ->is (tok::comma)) {
614+ if (CurrentChange .Tok ->is (tok::comma)) {
614615 ++CommasBeforeMatch;
615- } else if (Changes[i] .indentAndNestingLevel () > IndentAndNestingLevel) {
616+ } else if (CurrentChange .indentAndNestingLevel () > IndentAndNestingLevel) {
616617 // Call AlignTokens recursively, skipping over this scope block.
617618 unsigned StoppedAt =
618619 AlignTokens (Style, Matches, Changes, i, ACS, RightJustify);
619620 i = StoppedAt - 1 ;
620621 continue ;
621622 }
622623
623- if (!Matches (Changes[i] ))
624+ if (!Matches (CurrentChange ))
624625 continue ;
625626
626627 // If there is more than one matching token per line, or if the number of
@@ -634,16 +635,16 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
634635 if (StartOfSequence == 0 )
635636 StartOfSequence = i;
636637
637- unsigned ChangeWidthLeft = Changes[i] .StartOfTokenColumn ;
638+ unsigned ChangeWidthLeft = CurrentChange .StartOfTokenColumn ;
638639 unsigned ChangeWidthAnchor = 0 ;
639640 unsigned ChangeWidthRight = 0 ;
640641 if (RightJustify)
641642 if (ACS.PadOperators )
642- ChangeWidthAnchor = Changes[i] .TokenLength ;
643+ ChangeWidthAnchor = CurrentChange .TokenLength ;
643644 else
644- ChangeWidthLeft += Changes[i] .TokenLength ;
645+ ChangeWidthLeft += CurrentChange .TokenLength ;
645646 else
646- ChangeWidthRight = Changes[i] .TokenLength ;
647+ ChangeWidthRight = CurrentChange .TokenLength ;
647648 for (unsigned j = i + 1 ; j != e && Changes[j].NewlinesBefore == 0 ; ++j) {
648649 ChangeWidthRight += Changes[j].Spaces ;
649650 // Changes are generally 1:1 with the tokens, but a change could also be
0 commit comments