diff options
| author | Krasimir Georgiev <krasimir@google.com> | 2017-08-24 08:55:07 +0000 |
|---|---|---|
| committer | Krasimir Georgiev <krasimir@google.com> | 2017-08-24 08:55:07 +0000 |
| commit | c602af9a5e82e8ea9070f38d361ed35cc799650d (patch) | |
| tree | e943fc36668163b1a20af4aa52ca65d961ea234a | |
| parent | cfa3810aa0137984a730fb3bc65d0307ed7f1640 (diff) | |
| download | bcm5719-llvm-c602af9a5e82e8ea9070f38d361ed35cc799650d.tar.gz bcm5719-llvm-c602af9a5e82e8ea9070f38d361ed35cc799650d.zip | |
Revert "[clang-format] Break non-trailing block comments"
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.
llvm-svn: 311641
| -rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTestComments.cpp | 16 |
2 files changed, 1 insertions, 17 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 206be294c9e..d8ae82c1843 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -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. diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp index 79dc003ae85..600132ec4b8 100644 --- a/clang/unittests/Format/FormatTestComments.cpp +++ b/clang/unittests/Format/FormatTestComments.cpp @@ -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 |

