@@ -4096,16 +4096,9 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
40964096 for (auto *Current = First->Next ; Current; Current = Current->Next ) {
40974097 const FormatToken *Prev = Current->Previous ;
40984098 if (Current->is (TT_LineComment)) {
4099- if (Prev->is (BK_BracedInit) && Prev->opensScope ()) {
4100- Current->SpacesRequiredBefore =
4101- (Style.Cpp11BracedListStyle && !Style.SpacesInParensOptions .Other )
4102- ? 0
4103- : 1 ;
4104- } else if (Prev->is (TT_VerilogMultiLineListLParen)) {
4105- Current->SpacesRequiredBefore = 0 ;
4106- } else {
4107- Current->SpacesRequiredBefore = Style.SpacesBeforeTrailingComments ;
4108- }
4099+ Current->SpacesRequiredBefore = Prev->is (TT_VerilogMultiLineListLParen)
4100+ ? 0
4101+ : Style.SpacesBeforeTrailingComments ;
41094102
41104103 // If we find a trailing comment, iterate backwards to determine whether
41114104 // it seems to relate to a specific parameter. If so, break before that
@@ -4449,8 +4442,10 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
44494442 (Left.ParameterCount <= 1 || Style.AllowAllArgumentsOnNextLine )) {
44504443 return 0 ;
44514444 }
4452- if (Left.is (tok::l_brace) && !Style.Cpp11BracedListStyle )
4445+ if (Left.is (tok::l_brace) &&
4446+ Style.Cpp11BracedListStyle == FormatStyle::CBLSS_Block) {
44534447 return 19 ;
4448+ }
44544449 return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter
44554450 : 19 ;
44564451 }
@@ -4616,7 +4611,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
46164611 // Format empty list as `<>`.
46174612 if (Left.is (tok::less) && Right.is (tok::greater))
46184613 return false ;
4619- return ! Style.Cpp11BracedListStyle ;
4614+ return Style.Cpp11BracedListStyle == FormatStyle::CBLSS_Block ;
46204615 }
46214616 // Don't attempt to format operator<(), as it is handled later.
46224617 if (Right.isNot (TT_OverloadedOperatorLParen))
@@ -4784,7 +4779,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
47844779 const auto SpaceRequiredForArrayInitializerLSquare =
47854780 [](const FormatToken &LSquareTok, const FormatStyle &Style) {
47864781 return Style.SpacesInContainerLiterals ||
4787- (Style.isProto () && !Style.Cpp11BracedListStyle &&
4782+ (Style.isProto () &&
4783+ Style.Cpp11BracedListStyle == FormatStyle::CBLSS_Block &&
47884784 LSquareTok.endsSequence (tok::l_square, tok::colon,
47894785 TT_SelectorName));
47904786 };
@@ -4817,7 +4813,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
48174813 if ((Left.is (tok::l_brace) && Left.isNot (BK_Block)) ||
48184814 (Right.is (tok::r_brace) && Right.MatchingParen &&
48194815 Right.MatchingParen ->isNot (BK_Block))) {
4820- return !Style.Cpp11BracedListStyle || Style.SpacesInParensOptions .Other ;
4816+ return Style.Cpp11BracedListStyle == FormatStyle::CBLSS_Block ||
4817+ Style.SpacesInParensOptions .Other ;
48214818 }
48224819 if (Left.is (TT_BlockComment)) {
48234820 // No whitespace in x(/*foo=*/1), except for JavaScript.
@@ -4999,7 +4996,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
49994996 Left.Children .empty ()) {
50004997 if (Left.is (BK_Block))
50014998 return Style.SpaceInEmptyBraces != FormatStyle::SIEB_Never;
5002- if (Style.Cpp11BracedListStyle ) {
4999+ if (Style.Cpp11BracedListStyle != FormatStyle::CBLSS_Block ) {
50035000 return Style.SpacesInParens == FormatStyle::SIPO_Custom &&
50045001 Style.SpacesInParensOptions .InEmptyParentheses ;
50055002 }
@@ -5081,7 +5078,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
50815078 if (Left.MatchingParen &&
50825079 Left.MatchingParen ->is (TT_ProtoExtensionLSquare) &&
50835080 Right.isOneOf (tok::l_brace, tok::less)) {
5084- return ! Style.Cpp11BracedListStyle ;
5081+ return Style.Cpp11BracedListStyle == FormatStyle::CBLSS_Block ;
50855082 }
50865083 // A percent is probably part of a formatting specification, such as %lld.
50875084 if (Left.is (tok::percent))
@@ -5521,7 +5518,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
55215518 if (Left.is (tok::greater) && Right.is (tok::greater)) {
55225519 if (Style.isTextProto () ||
55235520 (Style.Language == FormatStyle::LK_Proto && Left.is (TT_DictLiteral))) {
5524- return ! Style.Cpp11BracedListStyle ;
5521+ return Style.Cpp11BracedListStyle == FormatStyle::CBLSS_Block ;
55255522 }
55265523 return Right.is (TT_TemplateCloser) && Left.is (TT_TemplateCloser) &&
55275524 ((Style.Standard < FormatStyle::LS_Cpp11) ||
@@ -6382,7 +6379,7 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
63826379 return false ;
63836380 }
63846381 if (Left.is (tok::equal) && Right.is (tok::l_brace) &&
6385- ! Style.Cpp11BracedListStyle ) {
6382+ Style.Cpp11BracedListStyle == FormatStyle::CBLSS_Block ) {
63866383 return false ;
63876384 }
63886385 if (Left.is (TT_AttributeLParen) ||
0 commit comments