[llvm-bugs] [Bug 49639] New: attach-braces after enum doesn't, unless allowshortenums is true
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Mar 19 02:56:12 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=49639
Bug ID: 49639
Summary: attach-braces after enum doesn't, unless
allowshortenums is true
Product: clang
Version: 11.0
Hardware: PC
OS: FreeBSD
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: adridg at FreeBSD.org
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
Reported by Luna on Twitter; she's stymied by the registration (e.g. real-name
requirements) for the bug tracker. I can reproduce the problem.
This is an issue *similar* to #46927 and possibly #37302; there are a couple
more attach-braces issues open as well. This is the input file:
```
enum EnumWithComma { A, B,
C,
};
enum EnumWithoutComma { A_, B_,
C_ };
struct Struct {
int a;
bool b;
} ;
```
When clang-format 11 (and 12, too) is used with **attached** braces and
*AllowShortEnumsOnASingleLine*, it attaches braces but enums with trailing
commas are somehow not "short".
```
$ clang-format11 --style="{Language: Cpp, BreakBeforeBraces: Attach,
AllowShortEnumsOnASingleLine: true}" example.cpp
enum EnumWithComma {
A,
B,
C,
};
enum EnumWithoutComma { A_, B_, C_ };
struct Struct {
int a;
bool b;
};
```
When clang-format 11 (and 12, too) is used with **attached** braces but short
enums are not allowed on one line, it doesn't attach at all:
```
$ clang-format11 --style="{Language: Cpp, BreakBeforeBraces: Attach,
AllowShortEnumsOnASingleLine: false}" example.cpp
enum EnumWithComma
{
A,
B,
C,
};
enum EnumWithoutComma
{
A_,
B_,
C_
};
struct Struct {
int a;
bool b;
};
```
PS. Probably #37302 and #21200 can be closed, as they refer to ancient versions
of clang-format and suitable configurations for brace-attachment and short
enums (except for this bug) are available now.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210319/35fb9b00/attachment-0001.html>
More information about the llvm-bugs
mailing list