[PATCH] D139834: [clang-format] AllowShortCompoundRequirementOnASingleLine
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 13 09:30:02 PST 2022
MyDeveloperDay added inline comments.
================
Comment at: clang/lib/Format/Format.cpp:1265
LLVMStyle.AllowShortCaseLabelsOnASingleLine = false;
+ LLVMStyle.AllowShortCompoundRequirementOnASingleLine = true;
LLVMStyle.AllowShortEnumsOnASingleLine = true;
----------------
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.
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