Skip to content

Commit

Permalink
clang-format: [Java] Allow trailing semicolons after enums.
Browse files Browse the repository at this point in the history
Before:
  enum SomeThing { ABC, CDE }
  ;

After:
  enum SomeThing { ABC, CDE };

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221125 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
djasper-gh committed Nov 3, 2014
1 parent 6ee86df commit c6ec4ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Format/UnwrappedLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1354,11 +1354,10 @@ void UnwrappedLineParser::parseEnum() {
if (FormatTok->Tok.is(tok::l_brace)) {
FormatTok->BlockKind = BK_Block;
bool HasError = !parseBracedList(/*ContinueOnSemicolons=*/true);
if (HasError) {
if (FormatTok->is(tok::semi))
nextToken();
if (FormatTok->is(tok::semi))
nextToken();
if (HasError)
addUnwrappedLine();
}
}
// We fall through to parsing a structural element afterwards, so that in
// enum A {} n, m;
Expand Down
1 change: 1 addition & 0 deletions unittests/Format/FormatTestJava.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ TEST_F(FormatTestJava, ClassDeclarations) {

TEST_F(FormatTestJava, EnumDeclarations) {
verifyFormat("enum SomeThing { ABC, CDE }");
verifyFormat("enum SomeThing { ABC, CDE };");
verifyFormat("enum SomeThing {\n"
" ABC,\n"
" CDE,\n"
Expand Down

0 comments on commit c6ec4ee

Please sign in to comment.