diff options
author | Daniel Jasper <djasper@google.com> | 2014-07-15 09:00:34 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-07-15 09:00:34 +0000 |
commit | fcfac10c8a74ac086fe017b39a114ccfa19ea4fd (patch) | |
tree | f21abf5af4741e277b79d768882017755602386a /clang/lib/Format/ContinuationIndenter.cpp | |
parent | bce3cf8074353ffb801ddeded05baf527fa6c127 (diff) | |
download | bcm5719-llvm-fcfac10c8a74ac086fe017b39a114ccfa19ea4fd.tar.gz bcm5719-llvm-fcfac10c8a74ac086fe017b39a114ccfa19ea4fd.zip |
clang-format: Improve heuristic around avoiding bad line breaks.
Now, this can be properly formatted:
static_cast<A< //
B> *>( //
);
Before, clang-format could end up, not formatting the code at all.
llvm-svn: 213055
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 2af16fcd0cf..014c30e346a 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -108,7 +108,8 @@ bool ContinuationIndenter::canBreak(const LineState &State) { // ... // As they hide "DoSomething" and are generally bad for readability. if (Previous.opensScope() && Previous.isNot(tok::l_brace) && - State.LowestLevelOnLine < State.StartOfLineLevel) + State.LowestLevelOnLine < State.StartOfLineLevel && + State.LowestLevelOnLine < Current.NestingLevel) return false; if (Current.isMemberAccess() && State.Stack.back().ContainsUnwrappedBuilder) return false; |