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

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 19 04:21:45 PDT 2022


MyDeveloperDay added a comment.

Its probably worth looking at how to fix this more in the context of the original bug, Its something I don't like is where we pile in all these expressions, without any comments about what cases we are handling here..
I'd rather handle each one at a time.. as I don't see how TT_BinaryOperator and TT_CtorInitializerColon are likely to be related.

  else if ((Previous.isOneOf(TT_BinaryOperator, TT_ConditionalExpr,
                                 TT_CtorInitializerColon)) &&
               ((Previous.getPrecedence() != prec::Assignment &&
                 (Previous.isNot(tok::lessless) || Previous.OperatorIndex != 0 ||
                  Previous.NextOperator)) ||
                Current.StartsBinaryExpression)) {
      // Indent relative to the RHS of the expression unless this is a simple
      // assignment without binary expression on the RHS. Also indent relative to
      // unary operators and the colons of constructor initializers.
      if (Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None ||
  +       Style.BreakBeforeBinaryOperators == FormatStyle::BOS_NonAssignment)
        CurrentState.LastSpace = State.Column;


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

https://reviews.llvm.org/D136154



More information about the cfe-commits mailing list