[PATCH] D93938: [clang-format] Fixed AfterEnum handling

Ally Tiritoglu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 3 00:55:37 PST 2021


atirit added a comment.

OK, I'm getting a few more failed unit tests and I'm really not sure what correct formatting behaviour is anymore, so I'll just ask.

Assuming the following settings:

  BreakBeforeBraces: Custom
  BraceWrapping: {
    AfterEnum: true
  }
  AllowShortEnumsOnASingleLine: true

Which of these is correct? (`FormatTest,AllmanBraceBreaking`)
A (expected in test):

  enum X
  {
    Y = 0
  }

B:

  enum X { Y = 0 }

Which of these is correct? (new test)
A:

  enum
  {
     A,
     B
  } Enum1, Enum2

B:

  enum
  {
     A,
     B
  } Enum1,
     Enum2

C:

  enum { A, B } Enum1, Enum2

`true/true` results in option B of the "new test" section. The strange behaviour with `Enum1` and `Enum2` occurs when `AllowShortEnumsOnASingleLine` isn't allowed to shrink a line for whatever reason, be it a comma on the last case, a comment, or too long an `enum`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93938/new/

https://reviews.llvm.org/D93938



More information about the cfe-commits mailing list