]> granicus.if.org Git - clang/commitdiff
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221158 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 9631d9f71d5e907a2ef8ddf35a2dba940b9a7b68..0c8d486f0eb0b9358b66770e41e54edb43120a0d 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 f2bead3597f18894901b12f92f1e07baecc8a05c..591d1f3a32dd71c1389ea7a22a4479ef7a067530 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"