File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 10
10
#include " FormatToken.h"
11
11
#include " NamespaceEndCommentsFixer.h"
12
12
#include " WhitespaceManager.h"
13
+ #include " clang/Basic/TokenKinds.h"
13
14
#include " llvm/Support/Debug.h"
14
15
#include < queue>
15
16
@@ -586,8 +587,8 @@ class LineJoiner {
586
587
const auto *Line = I[0 ];
587
588
const auto *NextLine = I[1 ];
588
589
589
- auto GetRelevantAfterOption = [&](const FormatToken *tok ) {
590
- switch (tok ->getType ()) {
590
+ auto GetRelevantAfterOption = [&](const FormatToken *Tok ) {
591
+ switch (Tok ->getType ()) {
591
592
case TT_StructLBrace:
592
593
return Style.BraceWrapping .AfterStruct ;
593
594
case TT_ClassLBrace:
@@ -620,8 +621,12 @@ class LineJoiner {
620
621
// Current line begins record, next line block.
621
622
if (NextLine->First ->isOneOf (TT_StructLBrace, TT_ClassLBrace,
622
623
TT_UnionLBrace)) {
623
- if (NextLine->First == NextLine->Last && I + 2 != E &&
624
- I[2 ]->First ->isNot (tok::r_brace) &&
624
+ if (I + 2 == E)
625
+ return 0 ;
626
+
627
+ const bool IsEmptyBlock = I[2 ]->First ->is (tok::r_brace);
628
+
629
+ if (!IsEmptyBlock &&
625
630
Style.AllowShortRecordOnASingleLine == FormatStyle::SRS_Always) {
626
631
return tryMergeSimpleBlock (I, E, Limit);
627
632
}
You can’t perform that action at this time.
0 commit comments