summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2012-12-04 15:40:36 +0000
committerAlexander Kornienko <alexfh@google.com>2012-12-04 15:40:36 +0000
commit0ea8e107fc70de3012a349807643649aea8046e4 (patch)
treefbd54e24beb52d1a21845320d411657060ac91c3 /clang/lib/Format/UnwrappedLineParser.cpp
parentdfaed1bfde99a106bbc96dedf86cf0e7be6d2e99 (diff)
downloadbcm5719-llvm-0ea8e107fc70de3012a349807643649aea8046e4.tar.gz
bcm5719-llvm-0ea8e107fc70de3012a349807643649aea8046e4.zip
Clang-format error recovery part 1
Reviewers: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D163 llvm-svn: 169278
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 7c04ce09dda..888f1c9eeb9 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/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();
}
OpenPOWER on IntegriCloud