diff options
| author | Daniel Jasper <djasper@google.com> | 2013-12-23 11:25:40 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-12-23 11:25:40 +0000 |
| commit | 9a26e77311e195c7ae3e829b19484af6645b4cd1 (patch) | |
| tree | 993dc7d355b7836ed720e6cb11903065a06f1717 | |
| parent | ff7bde158253d0af9a9ba525a653dbc074466dee (diff) | |
| download | bcm5719-llvm-9a26e77311e195c7ae3e829b19484af6645b4cd1.tar.gz bcm5719-llvm-9a26e77311e195c7ae3e829b19484af6645b4cd1.zip | |
clang-format: Fix invalid write discovered by ASAN.
Introduced in r197900.
llvm-svn: 197906
| -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 7b3f5cb67fe..d4bf6ecfa91 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -421,7 +421,8 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State, // }]; // Thus, we set LastSpace of the next higher ParenLevel, to which we move // when we consume all of the "}"'s FakeRParens at the "{". - State.Stack[State.Stack.size() - 2].LastSpace = ContinuationIndent; + if (State.Stack.size() > 1) + State.Stack[State.Stack.size() - 2].LastSpace = ContinuationIndent; } else if (Current.Type == TT_CtorInitializerColon) { State.Column = State.FirstIndent + Style.ConstructorInitializerIndentWidth; } else if (Current.Type == TT_CtorInitializerComma) { |

