]> granicus.if.org Git - clang/commit
clang-format: Improve token breaking behavior.
authorDaniel Jasper <djasper@google.com>
Wed, 28 Aug 2013 10:03:58 +0000 (10:03 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 28 Aug 2013 10:03:58 +0000 (10:03 +0000)
commitf54617858a0df936746b7f521a8ffb032289d02f
tree6002ad7b7cc713ddbcdf239fa4bb972b2f3a03da
parent3b6b5dad09d314cb8055ed7500a03c3cf3daad0f
clang-format: Improve token breaking behavior.

Two changes:
* Don't add an extra penalty on breaking the same token multiple times.
  Generally, we should prefer not to break, but once we break, the
  normal line breaking penalties apply.
* Slightly increase the penalty for breaking comments. In general, the
  author has put some thought into how to break the comment and we
  should not overwrite this unnecessarily.

With a 40-column column limit, formatting
  aaaaaa("aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa");

Leads to:
Before:
  aaaaaa(
      "aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa "
      "aaaaaaaaaaaaaaaa");

After:
  aaaaaa("aaaaaaaaaaaaaaaa "
         "aaaaaaaaaaaaaaaa "
         "aaaaaaaaaaaaaaaa");

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189466 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/ContinuationIndenter.cpp
lib/Format/Format.cpp
unittests/Format/FormatTest.cpp