[clang] [clang-format] Add options to control wrapped lambda brace indent. (PR #143249)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 7 05:11:41 PDT 2025
================
@@ -1334,12 +1334,15 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
Style.IndentWidth;
}
- if (Style.BraceWrapping.BeforeLambdaBody &&
- Style.BraceWrapping.IndentBraces && Current.is(TT_LambdaLBrace)) {
+ if (Style.BraceWrapping.BeforeLambdaBody && Current.is(TT_LambdaLBrace)) {
+ const auto Nested = Current.NestingLevel != 0;
const auto From = Style.LambdaBodyIndentation == FormatStyle::LBI_Signature
? CurrentState.Indent
: State.FirstIndent;
- return From + Style.IndentWidth;
+ const auto Indent =
+ (Style.BraceWrapping.IndentBracesLambdaNested && Nested) ||
+ (Style.BraceWrapping.IndentBracesLambdaUnnested && !Nested);
+ return From + (Indent * Style.IndentWidth);
----------------
HazardyKnusperkeks wrote:
Before it didn't return if `IndentBraces` was `false`. Should we keep that behavior?
https://github.com/llvm/llvm-project/pull/143249
More information about the cfe-commits
mailing list