[clang] [polly] [clang-format] Add AllowShortType and ExceptShortType options for AlwaysBreakAfterReturnType. (PR #78011)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 04:04:50 PST 2024


rmarker wrote:

> > Let's leave `None` alone and add `ExceptShortType`
> 
> I meant to add `ExceptShortType` instead of `AllowShortType`. Sorry I didn't realize that adding `AllowShortType` and making it to mean "not `None`" might work, in which case we don't need to add `ExceptShortType`.

No problem.

Now that we've got both options, should we keep them?
Currently, `None` sometimes forbids breaking after short return types and sometimes allows it and just bases things off the penalty configuration. I feel like there will be some people who use `None` who would want the behaviour to be consistent one way and the other group wanting it consistent the opposite. With both, they can decide for themselves. Especially since the implementation for both is pretty simple and self-contained.

Though, if we only go with one, my vote would be for allowing breaking after short return types.
That is what we were using `None` for at work. I only discovered the issue, and the short return type concept at all, when investigating why it wasn't breaking in a few odd places we couldn't understand.

https://github.com/llvm/llvm-project/pull/78011


More information about the cfe-commits mailing list