Skip to content

Commit 77b5fb5

Browse files
committed
Address comments
1 parent 1db4303 commit 77b5fb5

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

clang/lib/Format/WhitespaceManager.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -399,15 +399,6 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
399399
}
400400
}
401401
}
402-
403-
// The scope to be aligned may not occupy entire lines. The rest of the line
404-
// needs some book-keeping.
405-
for (unsigned i = End; i < Changes.size() && Changes[i].NewlinesBefore == 0;
406-
++i) {
407-
Changes[i].StartOfTokenColumn += Shift;
408-
if (i + 1 != Changes.size())
409-
Changes[i + 1].PreviousEndOfTokenColumn += Shift;
410-
}
411402
}
412403

413404
// Walk through a subset of the changes, starting at StartAt, and find
@@ -659,8 +650,16 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
659650
MatchedIndices.push_back(I);
660651
}
661652

653+
// Pass to the function entire lines, so it can update the state of all tokens
654+
// that move.
662655
EndOfSequence = I;
656+
while (EndOfSequence < Changes.size() &&
657+
Changes[EndOfSequence].NewlinesBefore == 0) {
658+
++EndOfSequence;
659+
}
663660
AlignCurrentSequence();
661+
// The return value should still be where the scope ends. The rest of the line
662+
// may contain stuff to be aligned within a larger scope.
664663
return I;
665664
}
666665

0 commit comments

Comments
 (0)