aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index b6efcffdfc..9de722e19d 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -315,8 +315,10 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
if (isByRef) {
llvm::Value *Loc;
bool needsCopyDispose = BlockRequiresCopying(Ty);
- // FIXME: I think we need to indirect through the forwarding pointer first
- Loc = Builder.CreateStructGEP(DeclPtr, needsCopyDispose*2+4, "x");
+ Loc = Builder.CreateStructGEP(DeclPtr, 1, "forwarding");
+ Loc = Builder.CreateLoad(Loc, false);
+ Loc = Builder.CreateBitCast(Loc, DeclPtr->getType());
+ Loc = Builder.CreateStructGEP(Loc, needsCopyDispose*2+4, "x");
DI->EmitDeclareOfAutoVariable(&D, Loc, Builder);
} else
DI->EmitDeclareOfAutoVariable(&D, DeclPtr, Builder);