aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--lib/Format/UnwrappedLineParser.cpp12
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();
}