]> granicus.if.org Git - clang/commitdiff
Revert "[clang-format] Break non-trailing block comments"
authorKrasimir Georgiev <krasimir@google.com>
Thu, 24 Aug 2017 08:55:07 +0000 (08:55 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Thu, 24 Aug 2017 08:55:07 +0000 (08:55 +0000)
This reverts commit r311457. It reveals some dormant bugs in comment
reflowing, like breaking a single line jsdoc type annotation before a
parameter into multiple lines.

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

lib/Format/ContinuationIndenter.cpp
unittests/Format/FormatTestComments.cpp

index 206be294c9ead51e7632a2c9a56b85adf042c45f..d8ae82c1843e8c86eadb64fb1d1b3883e1b8072a 100644 (file)
@@ -1282,7 +1282,7 @@ unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current,
       return 0;
     }
   } else if (Current.is(TT_BlockComment)) {
-    if (!Style.ReflowComments ||
+    if (!Current.isTrailingComment() || !Style.ReflowComments ||
         // If a comment token switches formatting, like
         // /* clang-format on */, we don't want to break it further,
         // but we may still want to adjust its indentation.
index 79dc003ae85518968c9f14cd98d661c90a9a133a..600132ec4b86c0b10d86e7ad7d0910a5763fe55d 100644 (file)
@@ -2787,22 +2787,6 @@ TEST_F(FormatTestComments, AlignsBlockCommentDecorations) {
                    "* long */",
                    getLLVMStyleWithColumns(20)));
 }
-
-TEST_F(FormatTestComments, NonTrailingBlockComments) {
-  verifyFormat("const /** comment comment */ A = B;",
-               getLLVMStyleWithColumns(40));
-
-  verifyFormat("const /** comment comment comment */ A =\n"
-               "    B;",
-               getLLVMStyleWithColumns(40));
-
-  EXPECT_EQ("const /** comment comment comment\n"
-            "         comment */\n"
-            "    A = B;",
-            format("const /** comment comment comment comment */\n"
-                   "    A = B;",
-                   getLLVMStyleWithColumns(40)));
-}
 } // end namespace
 } // end namespace format
 } // end namespace clang