diff options
Diffstat (limited to 'clang/lib/Format/UnwrappedLineFormatter.cpp')
| -rw-r--r-- | clang/lib/Format/UnwrappedLineFormatter.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index c938ff3965f9..2a7bfd1a7dc5 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -251,10 +251,13 @@ private: : Limit - TheLine->Last->TotalLength; if (TheLine->Last->is(TT_FunctionLBrace) && - TheLine->First == TheLine->Last && - !Style.BraceWrapping.SplitEmptyFunction && - NextLine.First->is(tok::r_brace)) { - return tryMergeSimpleBlock(I, E, Limit); + TheLine->First == TheLine->Last) { + const bool EmptyFunctionBody = NextLine.First->is(tok::r_brace); + if ((EmptyFunctionBody && !Style.BraceWrapping.SplitEmptyFunction) || + (!EmptyFunctionBody && + Style.AllowShortBlocksOnASingleLine == FormatStyle::SBS_Always)) { + return tryMergeSimpleBlock(I, E, Limit); + } } const auto *PreviousLine = I != AnnotatedLines.begin() ? I[-1] : nullptr; |
