[clang-format] Continue after non-scope-closers in getLengthToMatchingParen
Summary:
This fixes a regression introduced by `r331857` where we stop the search for
the End token as soon as we hit a non-scope-closer, which prematurely stops before
semicolons for example, which should otherwise be considered as part of the unbreakable tail.
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D46824
llvm-svn: 332225
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 82e5f6e..1d04ad0 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -90,8 +90,10 @@
return MatchingStackIndex >= 0 ? &Stack[MatchingStackIndex] : nullptr;
};
for (; End->Next; End = End->Next) {
- if (End->Next->CanBreakBefore || !End->Next->closesScope())
+ if (End->Next->CanBreakBefore)
break;
+ if (!End->Next->closesScope())
+ continue;
if (End->Next->MatchingParen->isOneOf(tok::l_brace,
TT_ArrayInitializerLSquare,
tok::less)) {