[cfe-commits] r92027 - /cfe/trunk/lib/Frontend/RewriteObjC.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Dec 23 11:22:34 PST 2009
Author: fjahanian
Date: Wed Dec 23 13:22:33 2009
New Revision: 92027
URL: http://llvm.org/viewvc/llvm-project?rev=92027&view=rev
Log:
More rewriting of __block variables.
Modified:
cfe/trunk/lib/Frontend/RewriteObjC.cpp
Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=92027&r1=92026&r2=92027&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Wed Dec 23 13:22:33 2009
@@ -4166,11 +4166,25 @@
// FIXME: Add more elaborate code generation required by the ABI.
// That is, must generate BYREFVAR->__forwarding->BYREFVAR for each
// BDRE where BYREFVAR is name of the variable.
- Expr *DerefExpr = new (Context) UnaryOperator(BDRE, UnaryOperator::Deref,
- Context->getPointerType(BDRE->getType()),
- SourceLocation());
+ FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(),
+ &Context->Idents.get("__forwarding"),
+ Context->VoidPtrTy, 0,
+ /*BitWidth=*/0, /*Mutable=*/true);
+ MemberExpr *ME = new (Context) MemberExpr(BDRE, true, FD, SourceLocation(),
+ FD->getType());
+ const char *Name = BDRE->getDecl()->getNameAsCString();
+ FD = FieldDecl::Create(*Context, 0, SourceLocation(),
+ &Context->Idents.get(Name),
+ Context->VoidPtrTy, 0,
+ /*BitWidth=*/0, /*Mutable=*/true);
+ ME = new (Context) MemberExpr(ME, true, FD, SourceLocation(),
+ BDRE->getType());
+
+
+
// Need parens to enforce precedence.
- ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), DerefExpr);
+ ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
+ ME);
ReplaceStmt(BDRE, PE);
return PE;
}
More information about the cfe-commits
mailing list