diff options
author | Daniel Jasper <djasper@google.com> | 2017-01-13 23:18:16 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2017-01-13 23:18:16 +0000 |
commit | e61f9f9949a435d8396613b46c6ed7b65d61602b (patch) | |
tree | 2569760eefa77a3c43b5849ed3c961a6d50855bb /clang/lib/Format/ContinuationIndenter.cpp | |
parent | 2b579878278580aabded5ee4e6e3676dc7402cab (diff) | |
download | bcm5719-llvm-e61f9f9949a435d8396613b46c6ed7b65d61602b.tar.gz bcm5719-llvm-e61f9f9949a435d8396613b46c6ed7b65d61602b.zip |
clang-format: Fix bug in making line break decisions.
Here, the optimization to not line wrap when it would not lead to a
reduction in columns was overwriting and enforced break that we want to
do no matter what.
Before:
int i = someFunction(
aaaaaaa,
0).aaa(aaaaaaaaaaaaa) *
aaaaaaa +
aaaaaaa;
After:
int i = someFunction(aaaaaaa, 0)
.aaa(aaaaaaaaaaaaa) *
aaaaaaa +
aaaaaaa;
llvm-svn: 291974
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 6bb6fb30603..45522a82322 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -191,6 +191,11 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { Current.NestingLevel < State.StartOfLineLevel)) return true; + if (startsSegmentOfBuilderTypeCall(Current) && + (State.Stack.back().CallContinuation != 0 || + State.Stack.back().BreakBeforeParameter)) + return true; + if (State.Column <= NewLineColumn) return false; @@ -255,11 +260,6 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { !Previous.is(tok::kw_template) && State.Stack.back().BreakBeforeParameter) return true; - if (startsSegmentOfBuilderTypeCall(Current) && - (State.Stack.back().CallContinuation != 0 || - State.Stack.back().BreakBeforeParameter)) - return true; - // The following could be precomputed as they do not depend on the state. // However, as they should take effect only if the UnwrappedLine does not fit // into the ColumnLimit, they are checked here in the ContinuationIndenter. |