aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-04-25 13:31:51 +0000
committerDaniel Jasper <djasper@google.com>2013-04-25 13:31:51 +0000
commitfca24bc45192c254ca92ef1d7cef71a290392f31 (patch)
tree25698f3f76d524e2ae4aa614c54ede9f03cea37c /lib/Format/TokenAnnotator.cpp
parentf49d9c9b858973eb10717f4b3936a4a4384bd355 (diff)
Improve clang-format's memoization behavior.
Deeply nested expressions basically break clang-format's memoization. This patch slightly improves the situations and makes expressions like aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa(aaaaa( aaaaa(aaaaa()))))))))))))))))))))))))))))))))))))))); work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180264 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/TokenAnnotator.cpp')
-rw-r--r--lib/Format/TokenAnnotator.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 276921795a..3e67182f87 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -155,6 +155,8 @@ private:
}
if (CurrentToken->is(tok::r_paren)) {
+ if (CurrentToken->Parent->closesScope())
+ CurrentToken->Parent->MatchingParen->NoMoreTokensOnLevel = true;
Left->MatchingParen = CurrentToken;
CurrentToken->MatchingParen = Left;