summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-12-19 16:06:40 +0000
committerDaniel Jasper <djasper@google.com>2013-12-19 16:06:40 +0000
commit004177ee299a87448ddb8cef5ed99b966d3f42c2 (patch)
tree180487efb9af820dd722b79cc6bde73cee2e39c6 /clang
parent357d013e5431b5ea8610f6389db6e00a0ff7dba5 (diff)
downloadbcm5719-llvm-004177ee299a87448ddb8cef5ed99b966d3f42c2.tar.gz
bcm5719-llvm-004177ee299a87448ddb8cef5ed99b966d3f42c2.zip
clang-format: Slightly adapt decision of when to break before <<.
Before: Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaa); After: Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaa); llvm-svn: 197690
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp2
-rw-r--r--clang/unittests/Format/FormatTest.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index c840c4557f5..366d26d479a 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -338,7 +338,7 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
// short. Also always add the penalty if the LHS is split over mutliple lines
// to avoid unncessary line breaks that just work around this penalty.
if (Current.is(tok::lessless) && State.Stack.back().FirstLessLess == 0 &&
- (State.Column <= Style.ColumnLimit / 2 ||
+ (State.Column <= Style.ColumnLimit / 3 ||
State.Stack.back().BreakBeforeParameter))
Penalty += Style.PenaltyBreakFirstLessLess;
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 7d58ec2ed96..db105ee3233 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -3800,6 +3800,8 @@ TEST_F(FormatTest, AlignsPipes) {
getLLVMStyleWithColumns(70));
// But sometimes, breaking before the first "<<" is desirable.
+ verifyFormat("Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa)\n"
+ " << aaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaa);");
verifyFormat("Diag(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb)\n"
" << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
" << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;");
OpenPOWER on IntegriCloud