[PATCH] D136154: [clang-format] Fix the continuation indenter

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 27 00:21:57 PDT 2022


owenpan added inline comments.


================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:803-808
-  } else if ((Previous.isOneOf(TT_BinaryOperator, TT_ConditionalExpr,
-                               TT_CtorInitializerColon)) &&
+    } else if (Previous.is(TT_CtorInitializerColon)) {
+      CurrentState.LastSpace = State.Column;
+    } else if ((Previous.isOneOf(TT_BinaryOperator, TT_ConditionalExpr)) &&
              ((Previous.getPrecedence() != prec::Assignment &&
                (Previous.isNot(tok::lessless) || Previous.OperatorIndex != 0 ||
                 Previous.NextOperator)) ||
               Current.StartsBinaryExpression)) {
----------------
HazardyKnusperkeks wrote:
> Before it was followed with an `&&`, I don't know which one was for this case, and which one for the other, or for both. This is a bit hard, but maybe this is just to few checks?
IMO we should make an NFC patch to clean this up before attempting to fix the bug: e.g. `TT_ConditionalExpr` and `TT_CtorInitializerColon` don't have `prec::Assignment`, aren't `tok::lessless`, etc.


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

https://reviews.llvm.org/D136154



More information about the cfe-commits mailing list