@@ -579,16 +579,17 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
579
579
580
580
unsigned i = StartAt;
581
581
for (unsigned e = Changes.size (); i != e; ++i) {
582
- if (Changes[i].indentAndNestingLevel () < IndentAndNestingLevel)
582
+ auto &CurrentChange = Changes[i];
583
+ if (CurrentChange.indentAndNestingLevel () < IndentAndNestingLevel)
583
584
break ;
584
585
585
- if (Changes[i] .NewlinesBefore != 0 ) {
586
+ if (CurrentChange .NewlinesBefore != 0 ) {
586
587
CommasBeforeMatch = 0 ;
587
588
EndOfSequence = i;
588
589
589
590
// Whether to break the alignment sequence because of an empty line.
590
591
bool EmptyLineBreak =
591
- (Changes[i] .NewlinesBefore > 1 ) && !ACS.AcrossEmptyLines ;
592
+ (CurrentChange .NewlinesBefore > 1 ) && !ACS.AcrossEmptyLines ;
592
593
593
594
// Whether to break the alignment sequence because of a line without a
594
595
// match.
@@ -600,27 +601,27 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
600
601
601
602
// A new line starts, re-initialize line status tracking bools.
602
603
// 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) ||
604
605
Changes[i - 1 ].Tok ->isNot (tok::string_literal)) {
605
606
FoundMatchOnLine = false ;
606
607
}
607
608
LineIsComment = true ;
608
609
}
609
610
610
- if (Changes[i] .Tok ->isNot (tok::comment))
611
+ if (CurrentChange .Tok ->isNot (tok::comment))
611
612
LineIsComment = false ;
612
613
613
- if (Changes[i] .Tok ->is (tok::comma)) {
614
+ if (CurrentChange .Tok ->is (tok::comma)) {
614
615
++CommasBeforeMatch;
615
- } else if (Changes[i] .indentAndNestingLevel () > IndentAndNestingLevel) {
616
+ } else if (CurrentChange .indentAndNestingLevel () > IndentAndNestingLevel) {
616
617
// Call AlignTokens recursively, skipping over this scope block.
617
618
unsigned StoppedAt =
618
619
AlignTokens (Style , Matches, Changes, i, ACS, RightJustify);
619
620
i = StoppedAt - 1 ;
620
621
continue ;
621
622
}
622
623
623
- if (!Matches (Changes[i] ))
624
+ if (!Matches (CurrentChange ))
624
625
continue ;
625
626
626
627
// 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,
634
635
if (StartOfSequence == 0 )
635
636
StartOfSequence = i;
636
637
637
- unsigned ChangeWidthLeft = Changes[i] .StartOfTokenColumn ;
638
+ unsigned ChangeWidthLeft = CurrentChange .StartOfTokenColumn ;
638
639
unsigned ChangeWidthAnchor = 0 ;
639
640
unsigned ChangeWidthRight = 0 ;
640
641
if (RightJustify)
641
642
if (ACS.PadOperators )
642
- ChangeWidthAnchor = Changes[i] .TokenLength ;
643
+ ChangeWidthAnchor = CurrentChange .TokenLength ;
643
644
else
644
- ChangeWidthLeft += Changes[i] .TokenLength ;
645
+ ChangeWidthLeft += CurrentChange .TokenLength ;
645
646
else
646
- ChangeWidthRight = Changes[i] .TokenLength ;
647
+ ChangeWidthRight = CurrentChange .TokenLength ;
647
648
for (unsigned j = i + 1 ; j != e && Changes[j].NewlinesBefore == 0 ; ++j) {
648
649
ChangeWidthRight += Changes[j].Spaces ;
649
650
// Changes are generally 1:1 with the tokens, but a change could also be
0 commit comments