gedare wrote:

> > > I prefer that we limit this to breaking after the left parenthesis of a 
> > > control statement, with true/false or Always, Never, Multiline, 
> > > BlockIndent, etc.
> > 
> > 
> > if I understand you correctly, you would like a new style option added for 
> > setting break option for all control statements in the same way?
> 
> Yes.

I guess this approach is in fact not desirable. Fixing these bugs is wedged by 
the behavior of `AlwaysBreak` and `BlockIndent` because they break after the 
opening parens of `if` statements, but not on other control statements 
(`for/while`, `switch`). I suspect this limitation was not clearly stated ahead 
of time, but makes it quite hard to provide backward compatibility without 
complexity. My first solution with sub-options for `AlwaysBreak` and 
`BlockIndent` handles the backward compatibility in a simpler way than the 
current solution. I do not know how to proceed. There are competing statements 
about what could be done. I can't see a simple fix that can provide backward 
compatibility and also satisfy the three referenced Issues.

Proceeding in the current direction the only good solution that I see is to 
create multiple `BreakAfter` variants or sub-options to cover `BreakAfterIf` 
`BreakAfterLoop` `BreakAfterSwitch`. Whether each option should handle both 
breaking behavior and alignment behavior is also an unknown to me. I felt it 
was preferable to let `AlignAfteropenBracket` handle the alignment. This 
direction allows us to eventually deprecate `AlwaysBreak` and `BlockIndent` (by 
introducing a `BreakBeforeClosingBracket` option, for example). This is more or 
less in line with https://github.com/llvm/llvm-project/issues/80049


https://github.com/llvm/llvm-project/pull/108332
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to