diff options
author | Alexander Kornienko <alexfh@google.com> | 2012-12-04 15:40:36 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2012-12-04 15:40:36 +0000 |
commit | 393b008bcebb0a678a5a0a93ad69e28a30a62e84 (patch) | |
tree | 6ce2461bc3d02c5dc346ab2b70a20abdb4cd7fd3 /lib/Format/UnwrappedLineParser.cpp | |
parent | 02c1b863440b067f3d674bde237146ef54c17875 (diff) |
Clang-format error recovery part 1
Reviewers: klimek
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D163
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.cpp')
-rw-r--r-- | lib/Format/UnwrappedLineParser.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 7c04ce09dd..888f1c9eeb 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -72,7 +72,10 @@ void UnwrappedLineParser::parseBlock() { parseLevel(); if (!IsNamespace) --Line.Level; - assert(FormatTok.Tok.is(tok::r_brace) && "expected '}'"); + // FIXME: Add error handling. + if (!FormatTok.Tok.is(tok::r_brace)) + return; + nextToken(); if (FormatTok.Tok.is(tok::semi)) nextToken(); @@ -218,7 +221,12 @@ void UnwrappedLineParser::parseDoWhile() { --Line.Level; } - assert(FormatTok.Tok.is(tok::kw_while) && "'while' expected"); + // FIXME: Add error handling. + if (!FormatTok.Tok.is(tok::kw_while)) { + addUnwrappedLine(); + return; + } + nextToken(); parseStatement(); } |