@@ -500,7 +500,7 @@ class LineJoiner {
500
500
: 0 ;
501
501
}
502
502
503
- const bool TryMergeShortRecord = [&]() {
503
+ auto TryMergeShortRecord = [&]() {
504
504
switch (Style.AllowShortRecordOnASingleLine ) {
505
505
case FormatStyle::SRS_Never:
506
506
return false ;
@@ -510,7 +510,7 @@ class LineJoiner {
510
510
case FormatStyle::SRS_Always:
511
511
return true ;
512
512
}
513
- }() && !Style. BraceWrapping . SplitEmptyRecord ;
513
+ };
514
514
515
515
if (TheLine->Last ->is (tok::l_brace)) {
516
516
bool ShouldMerge = false ;
@@ -525,7 +525,9 @@ class LineJoiner {
525
525
// NOTE: We use AfterClass (whereas AfterStruct exists) for both
526
526
// classes and structs, but it seems that wrapping is still handled
527
527
// correctly elsewhere.
528
- ShouldMerge = !Style.BraceWrapping .AfterClass || TryMergeShortRecord;
528
+ ShouldMerge =
529
+ !Style.BraceWrapping .AfterClass ||
530
+ (TryMergeShortRecord () && !Style.BraceWrapping .SplitEmptyRecord );
529
531
}
530
532
} else if (TheLine->InPPDirective ||
531
533
!TheLine->First ->isOneOf (tok::kw_class, tok::kw_enum,
@@ -959,12 +961,12 @@ class LineJoiner {
959
961
Limit -= 2 ;
960
962
unsigned MergedLines = 0 ;
961
963
962
- bool TryMergeBlock =
964
+ const bool TryMergeBlock =
963
965
Style.AllowShortBlocksOnASingleLine != FormatStyle::SBS_Never;
964
- bool TryMergeRecord =
966
+ const bool TryMergeRecord =
965
967
Style.AllowShortRecordOnASingleLine == FormatStyle::SRS_Always;
966
- bool NextIsEmptyBlock = I[1 ]->First == I[1 ]->Last && I + 2 != E &&
967
- I[2 ]->First ->is (tok::r_brace);
968
+ const bool NextIsEmptyBlock = I[1 ]->First == I[1 ]->Last && I + 2 != E &&
969
+ I[2 ]->First ->is (tok::r_brace);
968
970
969
971
if (TryMergeBlock || TryMergeRecord || NextIsEmptyBlock) {
970
972
MergedLines = tryMergeSimpleBlock (I + 1 , E, Limit);
0 commit comments