Issue 176910
Summary [clang-format] BreakAfterReturnType issues
Labels clang-format
Assignees
Reporter Febbe
    The BreakAfterReturnType setting for clang-format contains `ExceptShortType`, but this setting is nearly useless or unexpected, since it's the same as `Automatic` just not for short types. But you can easily configure `PenaltyReturnTypeOnItsOwnLine` that it does this with `Automatic`, but there is no way to force line breaks except it's short like a `PenaltyReturnTypeNotOnItsOwnLine` setting.

My proposal is, to either 
 - remove the constraint, that `ExceptShortType` falls back to `Automatic` if not short (whatever short is ???) and instead gets an additional parameter to tell, which type is still short (e.g. 4 for `auto`). Rest is force split or add another parameter, to switch between the current solution and force split.
 - add another `PenaltyReturnTypeNotOnItsOwnLine` setting, adding inverse penalties for exact that usecase.
 - allow negative penalties

Last but not least, this setting only applies to usual return types,
There is no way to customize TrailingReturnTypes. So we actually need some sort of `BreakBeforeTrailingReturnTypes`, with similar semantics.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to