[cfe-commits] r101024 - in /cfe/trunk: lib/Parse/ParseExpr.cpp test/SemaObjC/super.m

Chris Lattner sabre at nondot.org
Sun Apr 11 23:27:57 PDT 2010


Author: lattner
Date: Mon Apr 12 01:27:57 2010
New Revision: 101024

URL: http://llvm.org/viewvc/llvm-project?rev=101024&view=rev
Log:
fix a rejects-valid bug that I introduced, pointed out 
by David Chisnall

Modified:
    cfe/trunk/lib/Parse/ParseExpr.cpp
    cfe/trunk/test/SemaObjC/super.m

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=101024&r1=101023&r2=101024&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Mon Apr 12 01:27:57 2010
@@ -1436,15 +1436,15 @@
 
       CastTy = Ty.get();
 
-      if (stopIfCastExpr) {
-        // Note that this doesn't parse the subsequent cast-expression, it just
-        // returns the parsed type to the callee.
+      // Note that this doesn't parse the subsequent cast-expression, it just
+      // returns the parsed type to the callee.
+      if (stopIfCastExpr)
         return OwningExprResult(Actions);
-      }
       
       // Reject the cast of super idiom in ObjC.
       if (Tok.is(tok::identifier) && getLang().ObjC1 &&
-          Tok.getIdentifierInfo() == Ident_super) {
+          Tok.getIdentifierInfo() == Ident_super && 
+          CurScope->isInObjcMethodScope()) {
         Diag(Tok.getLocation(), diag::err_illegal_super_cast)
           << SourceRange(OpenLoc, RParenLoc);
         return ExprError();

Modified: cfe/trunk/test/SemaObjC/super.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/super.m?rev=101024&r1=101023&r2=101024&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/super.m (original)
+++ cfe/trunk/test/SemaObjC/super.m Mon Apr 12 01:27:57 2010
@@ -58,3 +58,10 @@
   struct SomeStruct super = { 0 };
   return super.X;
 }
+
+int test3() {
+  id super = 0;
+  [(B*)super instanceMethod];
+  int *s1 = (int*)super;
+  return 0;
+}





More information about the cfe-commits mailing list