diff options
author | Daniel Jasper <djasper@google.com> | 2013-08-12 12:58:05 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-08-12 12:58:05 +0000 |
commit | 467ddb161c3120141d89fcb81a0f2f9500c47177 (patch) | |
tree | 775fae56de70d822f91ae5d9f3ed6bb1ff910530 /clang/lib/Format/Format.cpp | |
parent | 19ae1175ae8d2597d16ea5ce7bb9f0993cd6765c (diff) | |
download | bcm5719-llvm-467ddb161c3120141d89fcb81a0f2f9500c47177.tar.gz bcm5719-llvm-467ddb161c3120141d89fcb81a0f2f9500c47177.zip |
clang-format: Improve stream-formatting.
Before:
CHECK(controller->WriteProto(FLAGS_row_key, FLAGS_proto)) << "\""
<< FLAGS_proto
<< "\"";
After:
SemaRef.Diag(Loc, diag::note_for_range_begin_end)
<< BEF << IsTemplate << Description << E->getType();
llvm-svn: 188175
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 322e8670068..6fe4d45d1d0 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -595,6 +595,12 @@ private: unsigned ContinuationIndent = std::max(State.Stack.back().LastSpace, State.Stack.back().Indent) + 4; if (Newline) { + // Breaking before the first "<<" is generally not desirable if the LHS is + // short. + if (Current.is(tok::lessless) && State.Stack.back().FirstLessLess == 0 && + State.Column <= Style.ColumnLimit / 2) + ExtraPenalty += Style.PenaltyBreakFirstLessLess; + State.Stack.back().ContainsLineBreak = true; if (Current.is(tok::r_brace)) { if (Current.BlockKind == BK_BracedInit) @@ -705,10 +711,6 @@ private: State.Stack.back().BreakBeforeParameter = true; } - // Breaking before the first "<<" is generally not desirable. - if (Current.is(tok::lessless) && State.Stack.back().FirstLessLess == 0) - ExtraPenalty += Style.PenaltyBreakFirstLessLess; - } else { if (Current.is(tok::equal) && (RootToken->is(tok::kw_for) || State.ParenLevel == 0) && |