From c29a6cac52d77bdf3169a02da78667d3672b34f1 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 3 Nov 2014 15:42:11 +0000 Subject: [PATCH] Revert "clang-format: [Java] Allow trailing semicolons after enums." This reverts commit b5bdb2ef59ab922bcb4d6e843fffaee1f7f68a8c. This doesn't really seem necessary on second though and causes problems with C++ enum formatting. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221158 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/UnwrappedLineParser.cpp | 7 ++++--- unittests/Format/FormatTestJava.cpp | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 9631d9f71d..0c8d486f0e 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -1354,10 +1354,11 @@ void UnwrappedLineParser::parseEnum() { if (FormatTok->Tok.is(tok::l_brace)) { FormatTok->BlockKind = BK_Block; bool HasError = !parseBracedList(/*ContinueOnSemicolons=*/true); - if (FormatTok->is(tok::semi)) - nextToken(); - if (HasError) + if (HasError) { + if (FormatTok->is(tok::semi)) + nextToken(); addUnwrappedLine(); + } } // We fall through to parsing a structural element afterwards, so that in // enum A {} n, m; diff --git a/unittests/Format/FormatTestJava.cpp b/unittests/Format/FormatTestJava.cpp index f2bead3597..591d1f3a32 100644 --- a/unittests/Format/FormatTestJava.cpp +++ b/unittests/Format/FormatTestJava.cpp @@ -86,7 +86,6 @@ 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" -- 2.40.0