@@ -158,7 +158,7 @@ static bool opensProtoMessageField(const FormatToken &LessTok,
158158 const FormatStyle &Style) {
159159 if (LessTok.isNot (tok::less))
160160 return false ;
161- return Style.Language == FormatStyle::LK_TextProto ||
161+ return Style.isTextProto () ||
162162 (Style.Language == FormatStyle::LK_Proto &&
163163 (LessTok.NestingLevel > 0 ||
164164 (LessTok.Previous && LessTok.Previous ->is (tok::equal))));
@@ -281,7 +281,7 @@ LineState ContinuationIndenter::getInitialState(unsigned FirstIndent,
281281 State.LowestLevelOnLine = 0 ;
282282 State.IgnoreStackForComparison = false ;
283283
284- if (Style.Language == FormatStyle::LK_TextProto ) {
284+ if (Style.isTextProto () ) {
285285 // We need this in order to deal with the bin packing of text fields at
286286 // global scope.
287287 auto &CurrentState = State.Stack .back ();
@@ -924,7 +924,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
924924 CurrentState.ContainsUnwrappedBuilder = true ;
925925 }
926926
927- if (Current.is (TT_LambdaArrow) && Style.Language == FormatStyle::LK_Java )
927+ if (Current.is (TT_LambdaArrow) && Style.isJava () )
928928 CurrentState.NoLineBreak = true ;
929929 if (Current.isMemberAccess () && Previous.is (tok::r_paren) &&
930930 (Previous.MatchingParen &&
@@ -1315,7 +1315,7 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
13151315 NextNonComment = &Current;
13161316
13171317 // Java specific bits.
1318- if (Style.Language == FormatStyle::LK_Java &&
1318+ if (Style.isJava () &&
13191319 Current.isOneOf (Keywords.kw_implements , Keywords.kw_extends )) {
13201320 return std::max (CurrentState.LastSpace ,
13211321 CurrentState.Indent + Style.ContinuationIndentWidth );
@@ -1334,6 +1334,14 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
13341334 Style.IndentWidth ;
13351335 }
13361336
1337+ if (Style.BraceWrapping .BeforeLambdaBody &&
1338+ Style.BraceWrapping .IndentBraces && Current.is (TT_LambdaLBrace)) {
1339+ const auto From = Style.LambdaBodyIndentation == FormatStyle::LBI_Signature
1340+ ? CurrentState.Indent
1341+ : State.FirstIndent ;
1342+ return From + Style.IndentWidth ;
1343+ }
1344+
13371345 if ((NextNonComment->is (tok::l_brace) && NextNonComment->is (BK_Block)) ||
13381346 (Style.isVerilog () && Keywords.isVerilogBegin (*NextNonComment))) {
13391347 if (Current.NestingLevel == 0 ||
@@ -1806,7 +1814,7 @@ void ContinuationIndenter::moveStatePastFakeLParens(LineState &State,
18061814 (Style.AlignOperands != FormatStyle::OAS_DontAlign ||
18071815 PrecedenceLevel < prec::Assignment) &&
18081816 (!Previous || Previous->isNot (tok::kw_return) ||
1809- (Style.Language != FormatStyle::LK_Java && PrecedenceLevel > 0 )) &&
1817+ (! Style.isJava () && PrecedenceLevel > 0 )) &&
18101818 (Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign ||
18111819 PrecedenceLevel > prec::Comma || Current.NestingLevel == 0 ) &&
18121820 (!Style.isTableGen () ||
@@ -2113,7 +2121,8 @@ void ContinuationIndenter::moveStateToNewBlock(LineState &State, bool NewLine) {
21132121 if (Style.LambdaBodyIndentation == FormatStyle::LBI_OuterScope &&
21142122 State.NextToken ->is (TT_LambdaLBrace) &&
21152123 !State.Line ->MightBeFunctionDecl ) {
2116- State.Stack .back ().NestedBlockIndent = State.FirstIndent ;
2124+ const auto Indent = Style.IndentWidth * Style.BraceWrapping .IndentBraces ;
2125+ State.Stack .back ().NestedBlockIndent = State.FirstIndent + Indent;
21172126 }
21182127 unsigned NestedBlockIndent = State.Stack .back ().NestedBlockIndent ;
21192128 // ObjC block sometimes follow special indentation rules.
@@ -2453,8 +2462,8 @@ ContinuationIndenter::createBreakableToken(const FormatToken &Current,
24532462 ? 0
24542463 : Current.UnbreakableTailLength ;
24552464
2456- if (Style.isVerilog () || Style.Language == FormatStyle::LK_Java ||
2457- Style.isJavaScript () || Style. isCSharp ()) {
2465+ if (Style.isVerilog () || Style.isJava () || Style. isJavaScript () ||
2466+ Style.isCSharp ()) {
24582467 BreakableStringLiteralUsingOperators::QuoteStyleType QuoteStyle;
24592468 if (Style.isJavaScript () && Text.starts_with (" '" ) &&
24602469 Text.ends_with (" '" )) {
0 commit comments