diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 4 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 5029bd689bc..766e1d8d922 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1035,9 +1035,7 @@ void UnwrappedLineParser::parseEnum() { 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)) { diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 2307b03f51f..6d953eb3018 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -1573,6 +1573,13 @@ TEST_F(FormatTest, FormatsEnumClass) { 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" |

