diff options
author | Kaelyn Takata <rikka@google.com> | 2014-07-14 22:48:10 +0000 |
---|---|---|
committer | Kaelyn Takata <rikka@google.com> | 2014-07-14 22:48:10 +0000 |
commit | 22101f968914b1cc5b7f245e303c29473a9e5480 (patch) | |
tree | 8f9c281ab6d43ddf2710dd9317e61f28a9d5cbf9 /clang/lib/Parse/ParseExpr.cpp | |
parent | 6a10223d4ab88027e69fec443f3a9fc6510a7412 (diff) | |
download | bcm5719-llvm-22101f968914b1cc5b7f245e303c29473a9e5480.tar.gz bcm5719-llvm-22101f968914b1cc5b7f245e303c29473a9e5480.zip |
Continue parsing an expression list even after an error is encountered.
Otherwise, multiple errors such as having unknown identifiers for two
arguments won't be diagnosed properly (e.g. only the first one would
have a diagnostic message if typo correction fails even though both
would be diagnosed if typo correction suggests a replacement).
llvm-svn: 213003
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 0c231d63ea7..4a1742c2c08 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -2309,6 +2309,7 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr*> &Exprs, Expr *Data, ArrayRef<Expr *> Args), Expr *Data) { + bool SawError = false; while (1) { if (Tok.is(tok::code_completion)) { if (Completer) @@ -2328,13 +2329,15 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr*> &Exprs, if (Tok.is(tok::ellipsis)) Expr = Actions.ActOnPackExpansion(Expr.get(), ConsumeToken()); - if (Expr.isInvalid()) - return true; - - Exprs.push_back(Expr.get()); + if (Expr.isInvalid()) { + SkipUntil(tok::comma, tok::r_paren, StopBeforeMatch); + SawError = true; + } else { + Exprs.push_back(Expr.get()); + } if (Tok.isNot(tok::comma)) - return false; + return SawError; // Move to the next argument, remember where the comma was. CommaLocs.push_back(ConsumeToken()); } |