diff options
Diffstat (limited to 'lib/Format/WhitespaceManager.cpp')
-rw-r--r-- | lib/Format/WhitespaceManager.cpp | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/lib/Format/WhitespaceManager.cpp b/lib/Format/WhitespaceManager.cpp index 44aa46f1f6..9f1ea7022f 100644 --- a/lib/Format/WhitespaceManager.cpp +++ b/lib/Format/WhitespaceManager.cpp @@ -432,19 +432,20 @@ void WhitespaceManager::alignConsecutiveAssignments() { if (!Style.AlignConsecutiveAssignments) return; - AlignTokens(Style, - [&](const Change &C) { - // Do not align on equal signs that are first on a line. - if (C.NewlinesBefore > 0) - return false; - - // Do not align on equal signs that are last on a line. - if (&C != &Changes.back() && (&C + 1)->NewlinesBefore > 0) - return false; - - return C.Tok->is(tok::equal); - }, - Changes, /*StartAt=*/0); + AlignTokens( + Style, + [&](const Change &C) { + // Do not align on equal signs that are first on a line. + if (C.NewlinesBefore > 0) + return false; + + // Do not align on equal signs that are last on a line. + if (&C != &Changes.back() && (&C + 1)->NewlinesBefore > 0) + return false; + + return C.Tok->is(tok::equal); + }, + Changes, /*StartAt=*/0); } void WhitespaceManager::alignConsecutiveDeclarations() { @@ -457,15 +458,16 @@ void WhitespaceManager::alignConsecutiveDeclarations() { // const char* const* v1; // float const* v2; // SomeVeryLongType const& v3; - AlignTokens(Style, - [](Change const &C) { - // tok::kw_operator is necessary for aligning operator overload - // definitions. - return C.Tok->is(TT_StartOfName) || - C.Tok->is(TT_FunctionDeclarationName) || - C.Tok->is(tok::kw_operator); - }, - Changes, /*StartAt=*/0); + AlignTokens( + Style, + [](Change const &C) { + // tok::kw_operator is necessary for aligning operator overload + // definitions. + return C.Tok->is(TT_StartOfName) || + C.Tok->is(TT_FunctionDeclarationName) || + C.Tok->is(tok::kw_operator); + }, + Changes, /*StartAt=*/0); } void WhitespaceManager::alignTrailingComments() { @@ -541,11 +543,10 @@ void WhitespaceManager::alignTrailingComments() { MinColumn = std::max(MinColumn, ChangeMinColumn); MaxColumn = std::min(MaxColumn, ChangeMaxColumn); } - BreakBeforeNext = - (i == 0) || (Changes[i].NewlinesBefore > 1) || - // Never start a sequence with a comment at the beginning of - // the line. - (Changes[i].NewlinesBefore == 1 && StartOfSequence == i); + BreakBeforeNext = (i == 0) || (Changes[i].NewlinesBefore > 1) || + // Never start a sequence with a comment at the beginning + // of the line. + (Changes[i].NewlinesBefore == 1 && StartOfSequence == i); Newlines = 0; } alignTrailingComments(StartOfSequence, Changes.size(), MinColumn); |