aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-03-20 15:58:10 +0000
committerDaniel Jasper <djasper@google.com>2013-03-20 15:58:10 +0000
commit92f9faf3cf1065f987f227e0c2fdf06fcccf1ae8 (patch)
treed7059d55aa1c85d0fff9b7e24d8f3c55931af233 /lib/Format/Format.cpp
parent6fe554eb4e7075cbfda927c4747d7346a27637f1 (diff)
Remove assertion that can be triggered on bad input.
clang-format can't do anything useful, so it should leave the remainder of the line unchanged, but it should not assert/segfault. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177530 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index b1005b5de6..b4cbfec8c4 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -601,9 +601,8 @@ private:
unsigned addTokenToState(bool Newline, bool DryRun, LineState &State) {
const AnnotatedToken &Current = *State.NextToken;
const AnnotatedToken &Previous = *State.NextToken->Parent;
- assert(State.Stack.size());
- if (Current.Type == TT_ImplicitStringLiteral) {
+ if (State.Stack.size() == 0 || Current.Type == TT_ImplicitStringLiteral) {
State.Column += State.NextToken->FormatTok.WhiteSpaceLength +
State.NextToken->FormatTok.TokenLength;
if (State.NextToken->Children.empty())