From ca7102c7379388536e32ae12f95008ade2c6185b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 24 Mar 2009 17:21:43 +0000 Subject: [PATCH] improve error recovery for when type parsing fails. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67626 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParseExpr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index b140046fe4..c0b28775ce 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -1002,7 +1002,11 @@ Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() { case tok::kw___builtin_offsetof: { SourceLocation TypeLoc = Tok.getLocation(); TypeResult Ty = ParseTypeName(); - + if (Ty.isInvalid()) { + SkipUntil(tok::r_paren); + return ExprError(); + } + if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren)) return ExprError(); -- 2.40.0