[PATCH] D54628: Extend format with AllowShortEnumsOnASingleLine option
Mitchell via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 14 08:34:36 PST 2019
mitchell-stellar added inline comments.
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3109
return Right.HasUnescapedNewline;
+ if (isAllmanBrace(Left) && !Style.AllowShortEnumsOnASingleLine &&
+ (Line.startsWith(tok::kw_enum) ||
----------------
MyDeveloperDay wrote:
> would you be happy to consider this being something like this instead?
>
> `if (isAllmanBrace(Left) && Style.BraceWrapping.AfterEnum == FormatStyle::BWAE_Attach &...`
>
>
> There is now precedent for the BraceWrapping styles to be an enum (see work by @mitchell-stellar who did something similar for `AfterControlStylement`)
I would not recommend making this option an enum. `Style.BraceWrapping.AfterControlStatement` is a special case since there was a potential readability issue for multi-line control statement conditions. Enums do not suffer from this. I think the option is in line with the other `AllowShort*OnASingleLine` options.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54628/new/
https://reviews.llvm.org/D54628
More information about the cfe-commits
mailing list