[cfe-commits] r66683 - /cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp

Steve Naroff snaroff at apple.com
Wed Mar 11 11:46:11 PDT 2009


Author: snaroff
Date: Wed Mar 11 13:46:11 2009
New Revision: 66683

URL: http://llvm.org/viewvc/llvm-project?rev=66683&view=rev
Log:
Follow-up fix for <rdar://problem/6179686> clang ObjC rewriter: 'self' should be a Class in a class method?

Now that 'self' in a class method is typed as 'Class', we need to cast to 'id' when sending a message to super.

Modified:
    cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp

Modified: cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp?rev=66683&r1=66682&r2=66683&view=diff

==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp Wed Mar 11 13:46:11 2009
@@ -2265,10 +2265,14 @@
       llvm::SmallVector<Expr*, 4> InitExprs;
       
       // set the receiver to self, the first argument to all methods.
-      InitExprs.push_back(new DeclRefExpr(
-            CurMethodDef->getSelfDecl(), 
-            Context->getObjCIdType(),
-            SourceLocation())); 
+      InitExprs.push_back(
+        new CStyleCastExpr(Context->getObjCIdType(), 
+                     new DeclRefExpr(CurMethodDef->getSelfDecl(), 
+                                     Context->getObjCIdType(),
+                                     SourceLocation()),
+                     Context->getObjCIdType(),
+                     SourceLocation(), SourceLocation())); // set the 'receiver'.
+
       llvm::SmallVector<Expr*, 8> ClsExprs;
       QualType argType = Context->getPointerType(Context->CharTy);
       ClsExprs.push_back(new StringLiteral(SuperDecl->getIdentifier()->getName(), 





More information about the cfe-commits mailing list