diff options
author | Daniel Jasper <djasper@google.com> | 2013-08-28 10:03:58 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-08-28 10:03:58 +0000 |
commit | 2739af3b9cce00b7bda893162ccb2e7951f7c2e7 (patch) | |
tree | 421b10b9954217cb11e8004d616a1658fa7dd74b /clang/lib/Format/Format.cpp | |
parent | 2d999ebb84280a50c2547293cfa44d323d66de1f (diff) | |
download | bcm5719-llvm-2739af3b9cce00b7bda893162ccb2e7951f7c2e7.tar.gz bcm5719-llvm-2739af3b9cce00b7bda893162ccb2e7951f7c2e7.zip |
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");
llvm-svn: 189466
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 1cd55d72973..3982ba6a771 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -152,7 +152,7 @@ namespace clang { namespace format { void setDefaultPenalties(FormatStyle &Style) { - Style.PenaltyBreakComment = 45; + Style.PenaltyBreakComment = 60; Style.PenaltyBreakFirstLessLess = 120; Style.PenaltyBreakString = 1000; Style.PenaltyExcessCharacter = 1000000; |