Before:
enum X : int { A, B, C };
After:
enum X : int {
A,
B,
C
};
llvm-svn: 190054
if (FormatTok->Tok.is(tok::kw_class) ||
FormatTok->Tok.is(tok::kw_struct))
nextToken();
- if (FormatTok->Tok.is(tok::identifier) ||
- FormatTok->Tok.is(tok::kw___attribute) ||
- FormatTok->Tok.is(tok::kw___declspec)) {
+ while (FormatTok->Tok.getIdentifierInfo() || FormatTok->Tok.is(tok::colon)) {
nextToken();
// We can have macros or attributes in between 'enum' and the enum name.
if (FormatTok->Tok.is(tok::l_paren)) {
verifyFormat("enum class X f() {\n a();\n return 42;\n}");
}
+TEST_F(FormatTest, FormatsEnumTypes) {
+ verifyFormat("enum X : int {\n"
+ " A,\n"
+ " B\n"
+ "};");
+}
+
TEST_F(FormatTest, FormatsBitfields) {
verifyFormat("struct Bitfields {\n"
" unsigned sClass : 8;\n"