Revert "clang-format: [Java] Allow trailing semicolons after enums."
authorDaniel Jasper <djasper@google.com>
Mon, 3 Nov 2014 15:42:11 +0000 (15:42 +0000)
committerDaniel Jasper <djasper@google.com>
Mon, 3 Nov 2014 15:42:11 +0000 (15:42 +0000)
This reverts commit b5bdb2ef59ab922bcb4d6e843fffaee1f7f68a8c.

This doesn't really seem necessary on second though and causes problems
with C++ enum formatting.

llvm-svn: 221158

clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTestJava.cpp

index 9631d9f..0c8d486 100644 (file)
@@ -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;
index f2bead3..591d1f3 100644 (file)
@@ -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"