[clang-format] Break non-trailing comments, try 2
authorKrasimir Georgiev <krasimir@google.com>
Mon, 16 Oct 2017 09:08:53 +0000 (09:08 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Mon, 16 Oct 2017 09:08:53 +0000 (09:08 +0000)
commit35599fdfa034fcc8506986ad3d83fc3bf581014c
tree1d71413e23349a26cc255bae37c49bb85d780b23
parentb583a7ead49d6a9ab8de2d2e8e17a8e8fe106ac1
[clang-format] Break non-trailing comments, try 2

Summary:
This patch enables `BreakableToken` to manage the formatting of non-trailing
block comments. It is a refinement of https://reviews.llvm.org/D37007.
We discovered that the optimizer outsmarts us on cases where breaking the comment
costs considerably less than breaking after the comment. This patch addresses
this by ensuring that a newline is inserted between a block comment and the next
token.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D37695

llvm-svn: 315893
clang/lib/Format/BreakableToken.cpp
clang/lib/Format/BreakableToken.h
clang/lib/Format/ContinuationIndenter.cpp
clang/lib/Format/ContinuationIndenter.h
clang/unittests/Format/FormatTestComments.cpp
clang/unittests/Format/FormatTestJS.cpp