diff options
author | Daniel Jasper <djasper@google.com> | 2014-11-19 22:38:18 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-11-19 22:38:18 +0000 |
commit | ccb68b487e06c3744f8e4b25267d4a23ce90fd62 (patch) | |
tree | 6faccd52c68e8b0fd5fb4b4bb6cf45e6aff8dffc /clang/lib/Format | |
parent | 85216ef0c3abd674cb8a7e5665ae106a9cb63ebf (diff) | |
download | bcm5719-llvm-ccb68b487e06c3744f8e4b25267d4a23ce90fd62.tar.gz bcm5719-llvm-ccb68b487e06c3744f8e4b25267d4a23ce90fd62.zip |
clang-format: [Java] Accept generic types in enum declaration
Before:
enum Foo implements Bar<X, Y> {
ABC {
...
}
, CDE {
...
};
}
After:
enum Foo implements Bar<X, Y> {
ABC {
...
},
CDE {
...
};
}
Patch by Harry Terkelsen.
llvm-svn: 222394
Diffstat (limited to 'clang/lib/Format')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index d94e6c414e4..af1e94cfe84 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1331,23 +1331,24 @@ void UnwrappedLineParser::parseAccessSpecifier() { void UnwrappedLineParser::parseEnum() { // Won't be 'enum' for NS_ENUMs. if (FormatTok->Tok.is(tok::kw_enum)) - nextToken(); + nextToken(); // Eat up enum class ... if (FormatTok->Tok.is(tok::kw_class) || FormatTok->Tok.is(tok::kw_struct)) nextToken(); while (FormatTok->Tok.getIdentifierInfo() || - FormatTok->isOneOf(tok::colon, tok::coloncolon)) { + FormatTok->isOneOf(tok::colon, tok::coloncolon, tok::less, + tok::greater, tok::comma, tok::question)) { nextToken(); // We can have macros or attributes in between 'enum' and the enum name. - if (FormatTok->Tok.is(tok::l_paren)) + if (FormatTok->is(tok::l_paren)) parseParens(); - if (FormatTok->Tok.is(tok::identifier)) + if (FormatTok->is(tok::identifier)) nextToken(); } // Just a declaration or something is wrong. - if (!FormatTok->is(tok::l_brace)) + if (FormatTok->isNot(tok::l_brace)) return; FormatTok->BlockKind = BK_Block; |