Typz added inline comments.
================ Comment at: lib/Format/ContinuationIndenter.cpp:196 + FormatStyle::BCIS_AfterColonAndComma) && + (State.Column + State.Line->Last->TotalLength - Previous.TotalLength > + getColumnLimit(State) || ---------------- djasper wrote: > Why can you drop the "+2" here? > > Also, I'd like to structure this so we have to duplicate less of the logic. > But I am not really sure it's possible. the +2 here was needed to keep identifiers aligned when breaking after colon but before the command (e.g. the 4th combination, not defined anymore): Foo() : field(1) , field(2) ================ Comment at: lib/Format/ContinuationIndenter.cpp:196 + FormatStyle::BCIS_AfterColonAndComma) && + (State.Column + State.Line->Last->TotalLength - Previous.TotalLength > + getColumnLimit(State) || ---------------- Typz wrote: > djasper wrote: > > Why can you drop the "+2" here? > > > > Also, I'd like to structure this so we have to duplicate less of the logic. > > But I am not really sure it's possible. > the +2 here was needed to keep identifiers aligned when breaking after colon > but before the command (e.g. the 4th combination, not defined anymore): > > Foo() : > field(1) > , field(2) I can avoid some duplication like this,m but i am not convinced it helps : const FormatToken &ColonToken = Style.BreakConstructorInitializers != FormatStyle::BCIS_AfterColon ? Current : Previous; if (ColonToken.is(TT_CtorInitializerColon) && (State.Column + State.Line->Last->TotalLength - ColonToken.TotalLength + (Style.BreakConstructorInitializers != FormatStyle::BCIS_AfterColon ? 2 : 0) > getColumnLimit(State) || State.Stack.back().BreakBeforeParameter) && (Style.AllowShortFunctionsOnASingleLine != FormatStyle::SFS_All || Style.BreakConstructorInitializers != FormatStyle::BCIS_BeforeColon || Style.ColumnLimit != 0)) return true; what do you think? https://reviews.llvm.org/D32479 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits