On Jan 16, 2008 5:45 PM, Keith Bauer <[EMAIL PROTECTED]> wrote:
> > Parse/ParseStmt.cpp:/// [OBC]   objc-synchronized-statement  [TODO]
>
> Heh, whoops, missed that :/
>
> > > Assertion failed: (E && "ActOnExprStmt(): missing expression"),
> > > function ActOnExprStmt, file SemaStmt.cpp, line 27.
>
> The assertion is real and unrelated, however:

Fix attached.

Here's a testcase:
void foo() [EMAIL PROTECTED];}
void foo() {@;}

And we might want to fix Parser::ExprResult to be a bit more obvious,
since the mistake of returning 0 rather than true on error is rather
widespread.

(It doesn't affect correctness, but I decided to get rid of the
SkipUntil call; it doesn't clearly improve the diagnostics in
general.)

-Eli
Index: Parse/ParseObjc.cpp
===================================================================
--- Parse/ParseObjc.cpp (revision 46112)
+++ Parse/ParseObjc.cpp (working copy)
@@ -1239,20 +1239,21 @@
     break;
   }
   
-  switch (Tok.getIdentifierInfo()->getObjCKeywordID()) {
-  case tok::objc_encode:
-    return ParsePostfixExpressionSuffix(ParseObjCEncodeExpression(AtLoc));
-  case tok::objc_protocol:
-    return ParsePostfixExpressionSuffix(ParseObjCProtocolExpression(AtLoc));
-  case tok::objc_selector:
-    return ParsePostfixExpressionSuffix(ParseObjCSelectorExpression(AtLoc));
-  default:
-    Diag(AtLoc, diag::err_unexpected_at);
-    SkipUntil(tok::semi);
-    break;
+  if (Tok.getIdentifierInfo()) {
+    switch (Tok.getIdentifierInfo()->getObjCKeywordID()) {
+    case tok::objc_encode:
+      return ParsePostfixExpressionSuffix(ParseObjCEncodeExpression(AtLoc));
+    case tok::objc_protocol:
+      return ParsePostfixExpressionSuffix(ParseObjCProtocolExpression(AtLoc));
+    case tok::objc_selector:
+      return ParsePostfixExpressionSuffix(ParseObjCSelectorExpression(AtLoc));
+    default:
+      break;
+    }
   }
-  
-  return 0;
+
+  Diag(AtLoc, diag::err_unexpected_at);
+  return true;
 }
 
 ///   objc-message-expr: 
_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Reply via email to