[PATCH] D148131: Avoid unnecessarily aggressive line-breaking when using "LambdaBodyIndentation: OuterScope" with argument bin-packing.
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 25 12:00:16 PDT 2023
HazardyKnusperkeks added inline comments.
================
Comment at: clang/docs/ReleaseNotes.rst:169
all arguments being able to fit on the same line.
+- Avoid unnecessarily aggressive line-breaking when using
+ ``LambdaBodyIndentation: OuterScope`` with argument bin-packing.
----------------
Owens comment holds, no bug fix in release notes.
================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:1077
+ if (!NestedBlockSpecialCase) {
+ auto ParentLevelIt = State.Stack.rbegin() + 1;
+ if (Style.LambdaBodyIndentation == FormatStyle::LBI_OuterScope &&
----------------
I don't know if LLVM has any policy in this regard, but I prefer this.
================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:1100
+ auto MaybeIncrement = [&](const auto &It) {
+ return It != State.Stack.rend() ? (It + 1) : It;
+ };
----------------
see above
================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:1107
+ }
+ if (ParentLevelIt != State.Stack.rend())
+ for (auto It = ParentLevelIt; It != State.Stack.rend(); ++It)
----------------
Drop the if, the loop does the checking.
================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:1108-1109
+ if (ParentLevelIt != State.Stack.rend())
+ for (auto It = ParentLevelIt; It != State.Stack.rend(); ++It)
+ It->BreakBeforeParameter = true;
+ }
----------------
Would be consistent with the code base.
================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:1123
+ // because we have been forced to break before a lambda body.
+ !(Style.BraceWrapping.BeforeLambdaBody && Current.is(TT_LambdaLBrace))) {
CurrentState.BreakBeforeParameter = true;
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148131/new/
https://reviews.llvm.org/D148131
More information about the cfe-commits
mailing list