aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseExpr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-24 17:21:43 +0000
committerChris Lattner <sabre@nondot.org>2009-03-24 17:21:43 +0000
commitca7102c7379388536e32ae12f95008ade2c6185b (patch)
tree02383ec5005e5df0e4573a9c221d89e6fe58704f /lib/Parse/ParseExpr.cpp
parentf26d510f49ddcd1a35e4e9af8978c5b6cb7099c2 (diff)
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
Diffstat (limited to 'lib/Parse/ParseExpr.cpp')
-rw-r--r--lib/Parse/ParseExpr.cpp6
1 files changed, 5 insertions, 1 deletions
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();