[PATCH] D54628: Extend format with AllowShortEnumsOnASingleLine option
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 09:23:14 PST 2019
MyDeveloperDay added a comment.
In D54628#1744108 <https://reviews.llvm.org/D54628#1744108>, @koalo wrote:
> Yes it does not. Therefore, I have followed the same pattern as the the other AllowShort* options.
I'm not completely sure, but I don't think its quite the same, the AllowShort* options are working on merging simple blocks with tryMergeSimpleBlock(), either small or empty blocks
I think what you are really adding here is "AlwaysBreakAfterEnum" but is there a use case for having
`typedef enum Color { Red, Blue, Green };` on one line but
`typedef enum Color { Red, Blue, Green, Orange, Purple, Magenta, Cyan, Yellow };` on multiple
i.e. what do we define as "Short" here?
With the following config
---
Language: Cpp
BaseOnStyle: LLVM
BreakBeforeBraces: Custom
BraceWrapping:
AfterEnum: true
You get (which is the same as GNU and Allman style)
enum
{
Red,
Blue,
Green
} Color;
enum Color
{
Red,
Blue,
Green,
Orange,
Purple,
Magenta,
Cyan,
Yellow
};
false, as you said will put them on one line..
If you want the brace cuddled with the enum, like below, then we need something else, either your option or perhaps changing the AfterEnum to be a enum of `Alway=true,Never=false,Attach` or something like that
enum {
Red,
Blue,
Green
} Color;
It is the "Short" word that seems a little confusing unless we are going to define "Short" as being a certain number of enumerations etc.. and that feels a bit clunky.
For the `Attach` option, I think we have to tell this above clause to break only for `isAllman(Left)` and not `isAllman(Right)` so the newline comes after the `{` not before.
Could I suggest you rebase,first, then it would be easier to try some stuff out.
But I certainly think your request is really to add the `BS_Attach` capability to enums without having the entire enum on the same line
Again sorry you had to wait so long, I am trying to work my way through the backlog (but it's going to take some time unless I can get some others to help me especially in getting things reviewed we decide to fix ;-) )
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54628/new/
https://reviews.llvm.org/D54628
More information about the cfe-commits
mailing list