diff options
| author | Daniel Jasper <djasper@google.com> | 2013-09-06 21:32:35 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-09-06 21:32:35 +0000 |
| commit | 786a550b9fcc5fc2f0d7b0895ea0029877e9585c (patch) | |
| tree | 833efe5d466dbde0954c1aa04217a374e6a99dd1 | |
| parent | b4b99987137211773051c6f2524eaad75797bb1d (diff) | |
| download | bcm5719-llvm-786a550b9fcc5fc2f0d7b0895ea0029877e9585c.tar.gz bcm5719-llvm-786a550b9fcc5fc2f0d7b0895ea0029877e9585c.zip | |
clang-format: Format typed enums with nested names.
The explicit type specified for an enum can actually have a nested name
specifier.
This fixes llvm.org/PR17125.
llvm-svn: 190208
| -rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 3 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 521df8f0285..f70de5f6d88 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1036,7 +1036,8 @@ void UnwrappedLineParser::parseEnum() { if (FormatTok->Tok.is(tok::kw_class) || FormatTok->Tok.is(tok::kw_struct)) nextToken(); - while (FormatTok->Tok.getIdentifierInfo() || FormatTok->Tok.is(tok::colon)) { + while (FormatTok->Tok.getIdentifierInfo() || + FormatTok->isOneOf(tok::colon, tok::coloncolon)) { 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 ae35cccc434..79dbad79c67 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -1591,6 +1591,10 @@ TEST_F(FormatTest, FormatsEnumTypes) { " A,\n" " B\n" "};"); + verifyFormat("enum X : std::uint32_t {\n" + " A,\n" + " B\n" + "};"); } TEST_F(FormatTest, FormatsBitfields) { |

