[clang] [clang-format] Correctly compute SplitPenalty of TrailingReturnArrow (PR #105613)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 22 22:03:26 PDT 2024


================
@@ -4050,7 +4050,7 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
                              ChildSize + Current->SpacesRequiredBefore;
     }
 
-    if (Current->is(TT_CtorInitializerColon))
+    if (Current->isOneOf(TT_CtorInitializerColon, TT_LambdaLSquare))
----------------
owenca wrote:

This is needed so that lambda definitions are not treated as `InFunctionDecl`, which now is used on line 4214 to filter out function trailing return arrows. We already got tests (line 22818 and 25446 in FormatTest.cpp) that would fail without it.

https://github.com/llvm/llvm-project/pull/105613


More information about the cfe-commits mailing list