summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-12-23 19:22:33 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-12-23 19:22:33 +0000
commit7df3980609422db19ecd7930c2a27713391355b4 (patch)
treefdfd37c049ec8f542395d581c14c2738fd2f53b1 /clang/lib/Frontend
parent2281998095e21ab8589a8d6075b38ac3e1755e24 (diff)
downloadbcm5719-llvm-7df3980609422db19ecd7930c2a27713391355b4.tar.gz
bcm5719-llvm-7df3980609422db19ecd7930c2a27713391355b4.zip
More rewriting of __block variables.
llvm-svn: 92027
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/RewriteObjC.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/clang/lib/Frontend/RewriteObjC.cpp b/clang/lib/Frontend/RewriteObjC.cpp
index 656d61b133d..2a3dd7ab03b 100644
--- a/clang/lib/Frontend/RewriteObjC.cpp
+++ b/clang/lib/Frontend/RewriteObjC.cpp
@@ -4166,11 +4166,25 @@ Stmt *RewriteObjC::RewriteBlockDeclRefExpr(BlockDeclRefExpr *BDRE) {
// 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;
}
OpenPOWER on IntegriCloud