osandov added a comment.
The style guide I'm following (the Linux kernel style) wants `AfterEnum:
false`. A cursory search suggests that people treat this trailing comma
behavior as a feature
(https://stackoverflow.com/questions/23072223/clang-format-style-options-for-enums).
However, I think this is separate from my issue. Consider the following
example which doesn't have a trailing comma and doesn't fit on one line:
$ cat enum.cpp
enum { EOF, VOID, CHAR, SHORT, INT, LONG, SIGNED, UNSIGNED, BOOL, FLOAT,
DOUBLE, COMPLEX, CONST, RESTRICT, VOLATILE, ATOMIC, STRUCT, UNION, ENUM,
LPAREN, RPAREN, LBRACKET, RBRACKET, ASTERISK, DOT, NUMBER, IDENTIFIER };
The current code formats this very strangely:
$ clang-format -style="{BasedOnStyle: llvm, IndentWidth: 8}" enum.cpp
enum { EOF,
VOID,
CHAR,
SHORT,
INT,
LONG,
SIGNED,
UNSIGNED,
BOOL,
FLOAT,
DOUBLE,
COMPLEX,
CONST,
RESTRICT,
VOLATILE,
ATOMIC,
STRUCT,
UNION,
ENUM,
LPAREN,
RPAREN,
LBRACKET,
RBRACKET,
ASTERISK,
DOT,
NUMBER,
IDENTIFIER };
With this change, I get what I expect:
$ ./bin/clang-format -style="{BasedOnStyle: llvm, IndentWidth: 8}" enum.cpp
enum {
EOF,
VOID,
CHAR,
SHORT,
INT,
LONG,
SIGNED,
UNSIGNED,
BOOL,
FLOAT,
DOUBLE,
COMPLEX,
CONST,
RESTRICT,
VOLATILE,
ATOMIC,
STRUCT,
UNION,
ENUM,
LPAREN,
RPAREN,
LBRACKET,
RBRACKET,
ASTERISK,
DOT,
NUMBER,
IDENTIFIER
};
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77682/new/
https://reviews.llvm.org/D77682
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits