[PATCH] D139834: [clang-format] AllowShortCompoundRequirementOnASingleLine
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 13 12:55:16 PST 2022
HazardyKnusperkeks added inline comments.
================
Comment at: clang/lib/Format/Format.cpp:1265
LLVMStyle.AllowShortCaseLabelsOnASingleLine = false;
+ LLVMStyle.AllowShortCompoundRequirementOnASingleLine = true;
LLVMStyle.AllowShortEnumsOnASingleLine = true;
----------------
MyDeveloperDay wrote:
> Backl1ght wrote:
> > MyDeveloperDay wrote:
> > > why would the default be true, is that what happens today?
> > yes
> just to clarify so I'm sure (without me having to try it myself), if you hadn't introduce this option it would be the equivalent of true.
>
> The only reason I say is we get complained at when we change the default from not doing something to doing something. Even if that means before we left it alone.
>
> So mostly we normally find the options go through an evolution from bool->enum->struct, sometimes it can be better to introduce an enum so we can have "Leave" as the default
>
> in such circumstances you let the old behaviour be the default, that way we know. That previously unformatted compound statements won't be touch in any way.
>
> ```
> else if (Style.AllowShortCompoundRequirementOnASingleLine != Leave && .......)
> {
> ```
>
> Users then have to "positively" buy into your style change one way or another. Rather than us imposing a default even if that default seems perfectly reasonable.
The `true` as default is correct.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139834/new/
https://reviews.llvm.org/D139834
More information about the cfe-commits
mailing list