aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 7d2041cd3c..a76e0d48a4 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -569,6 +569,15 @@ private:
State.Stack.push_back(
ParenState(NewIndent, State.Stack.back().LastSpace, AvoidBinPacking,
State.Stack.back().NoLineBreak));
+
+ if (Current.NoMoreTokensOnLevel && Current.FakeLParens.empty()) {
+ // This parenthesis was the last token possibly making use of Indent and
+ // LastSpace of the next higher ParenLevel. Thus, erase them to acieve
+ // better memoization results.
+ State.Stack[State.Stack.size() - 2].Indent = 0;
+ State.Stack[State.Stack.size() - 2].LastSpace = 0;
+ }
+
++State.ParenLevel;
}