[PATCH] D156259: Fix a bug that erroneously placed function arguments on a new line despite all arguments being able to fit on the same line.

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 25 13:53:17 PDT 2023


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:263
   State.StartOfStringLiteral = 0;
+  State.NoLineBreak = false;
   State.StartOfLineLevel = 0;
----------------
Was this uninitialized?


================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:657
 
+  bool DisallowLineBreaksOnThisLine = ([&Style = this->Style, &Current] {
+    // Deal with lambda arguments in C++. The aim here is to ensure that we
----------------
Can drop outer parens.


================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:664-666
+    if ((Style.Language == FormatStyle::LK_Cpp ||
+         Style.Language == FormatStyle::LK_ObjC) &&
+        !Current.is(tok::comment) && PrevNonComment &&
----------------
Could move this out of the lambda.


================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:669
+        PrevNonComment->BlockParameterCount > 0 &&
+        !Current.isOneOf(tok::l_paren, TT_LambdaLSquare)) {
+      if (PrevNonComment->BlockParameterCount > 1)
----------------
This can be merged with `!Current.is(tok::comment)`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156259/new/

https://reviews.llvm.org/D156259



More information about the cfe-commits mailing list