[cfe-commits] r60961 - in /cfe/trunk: lib/Parse/ParseExpr.cpp test/Parser/recovery.c

Chris Lattner sabre at nondot.org
Fri Dec 12 11:20:14 PST 2008


Author: lattner
Date: Fri Dec 12 13:20:14 2008
New Revision: 60961

URL: http://llvm.org/viewvc/llvm-project?rev=60961&view=rev
Log:
fix a buggy fall through that caused a crash-on-invalid.  rdar://6248081

Modified:
    cfe/trunk/lib/Parse/ParseExpr.cpp
    cfe/trunk/test/Parser/recovery.c

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=60961&r1=60960&r2=60961&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Fri Dec 12 13:20:14 2008
@@ -644,16 +644,16 @@
     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);

Modified: cfe/trunk/test/Parser/recovery.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/recovery.c?rev=60961&r1=60960&r2=60961&view=diff

==============================================================================
--- cfe/trunk/test/Parser/recovery.c (original)
+++ cfe/trunk/test/Parser/recovery.c Fri Dec 12 13:20:14 2008
@@ -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 A = {
 &BADIDENT, 0     /* expected-error {{use of undeclared identifier}} */
 };
+
+// rdar://6248081
+int test6248081() { 
+  [10]  // expected-error {{expected expression}}
+}
+





More information about the cfe-commits mailing list