summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-07-15 09:00:34 +0000
committerDaniel Jasper <djasper@google.com>2014-07-15 09:00:34 +0000
commitfcfac10c8a74ac086fe017b39a114ccfa19ea4fd (patch)
treef21abf5af4741e277b79d768882017755602386a /clang/lib/Format/ContinuationIndenter.cpp
parentbce3cf8074353ffb801ddeded05baf527fa6c127 (diff)
downloadbcm5719-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.cpp3
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;
OpenPOWER on IntegriCloud