aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-12 19:20:14 +0000
committerChris Lattner <sabre@nondot.org>2008-12-12 19:20:14 +0000
commitfdb548e8224446e2b974fd974d86a60688402a85 (patch)
tree6c9f5b864ce61be72a01cf561dbedcb3444d9ec4
parent3e6e67f631568af99a38f327c9d1a3da6cb1b9da (diff)
fix a buggy fall through that caused a crash-on-invalid. rdar://6248081
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60961 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseExpr.cpp10
-rw-r--r--test/Parser/recovery.c8
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index b18d505364..0d324ecf71 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -644,16 +644,16 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
SourceLocation AtLoc = ConsumeToken();
return Owned(ParseObjCAtExpression(AtLoc));
}
- case tok::l_square:
- // These can be followed by postfix-expr pieces.
- if (getLang().ObjC1)
- return ParsePostfixExpressionSuffix(Owned(ParseObjCMessageExpression()));
- // FALL THROUGH.
case tok::caret:
if (getLang().Blocks)
return ParsePostfixExpressionSuffix(Owned(ParseBlockLiteralExpression()));
Diag(Tok, diag::err_expected_expression);
return ExprError();
+ case tok::l_square:
+ // These can be followed by postfix-expr pieces.
+ if (getLang().ObjC1)
+ return ParsePostfixExpressionSuffix(Owned(ParseObjCMessageExpression()));
+ // FALL THROUGH.
default:
UnhandledToken:
Diag(Tok, diag::err_expected_expression);
diff --git a/test/Parser/recovery.c b/test/Parser/recovery.c
index ca92260372..f77b570638 100644
--- a/test/Parser/recovery.c
+++ b/test/Parser/recovery.c
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -verify -pedantic %s
+// RUN: clang -fsyntax-only -verify -pedantic -fblocks %s
// PR2241
float test2241[] = {
@@ -59,3 +59,9 @@ struct S { void *X, *Y; };
struct S A = {
&BADIDENT, 0 /* expected-error {{use of undeclared identifier}} */
};
+
+// rdar://6248081
+int test6248081() {
+ [10] // expected-error {{expected expression}}
+}
+