Skip to content

Commit b8c9445

Browse files
committed
Improve handling of Nested to make it cleaner.
1 parent 212f914 commit b8c9445

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

clang/lib/Format/ContinuationIndenter.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,13 +1335,12 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
13351335
}
13361336

13371337
if (Style.BraceWrapping.BeforeLambdaBody && Current.is(TT_LambdaLBrace)) {
1338-
const auto Nested = Current.NestingLevel != 0;
1338+
const auto Nested = Current.NestingLevel > 0;
13391339
const auto From = Style.LambdaBodyIndentation == FormatStyle::LBI_Signature
13401340
? CurrentState.Indent
13411341
: State.FirstIndent;
1342-
const auto Indent =
1343-
(Style.BraceWrapping.IndentBracesLambdaNested && Nested) ||
1344-
(Style.BraceWrapping.IndentBracesLambdaUnnested && !Nested);
1342+
const auto Indent = Nested ? Style.BraceWrapping.IndentBracesLambdaNested
1343+
: Style.BraceWrapping.IndentBracesLambdaUnnested;
13451344
return From + (Indent * Style.IndentWidth);
13461345
}
13471346

@@ -2126,10 +2125,9 @@ void ContinuationIndenter::moveStateToNewBlock(LineState &State, bool NewLine) {
21262125
if (Style.LambdaBodyIndentation == FormatStyle::LBI_OuterScope &&
21272126
State.NextToken->is(TT_LambdaLBrace) &&
21282127
!State.Line->MightBeFunctionDecl) {
2129-
const auto Nested = State.NextToken->NestingLevel != 0;
2130-
const auto Indent =
2131-
(Style.BraceWrapping.IndentBracesLambdaNested && Nested) ||
2132-
(Style.BraceWrapping.IndentBracesLambdaUnnested && !Nested);
2128+
const auto Nested = State.NextToken->NestingLevel > 0;
2129+
const auto Indent = Nested ? Style.BraceWrapping.IndentBracesLambdaNested
2130+
: Style.BraceWrapping.IndentBracesLambdaUnnested;
21332131
State.Stack.back().NestedBlockIndent =
21342132
State.FirstIndent + (Indent * Style.IndentWidth);
21352133
}

0 commit comments

Comments
 (0)