From: Steve Naroff Date: Sat, 4 Oct 2008 18:52:47 +0000 (+0000) Subject: Add indirection required for byref BlockDeclRefExpr's. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e52b1763f2c13b197d5c1ee178077f58b206f37;p=clang Add indirection required for byref BlockDeclRefExpr's. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57063 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/RewriteBlocks.cpp b/Driver/RewriteBlocks.cpp index 57d3a84560..b887734a2e 100644 --- a/Driver/RewriteBlocks.cpp +++ b/Driver/RewriteBlocks.cpp @@ -97,6 +97,7 @@ public: void RewriteBlockCall(CallExpr *Exp); void RewriteBlockPointerDecl(NamedDecl *VD); + void RewriteBlockDeclRefExpr(BlockDeclRefExpr *VD); void RewriteBlockPointerFunctionArgs(FunctionDecl *FD); std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, @@ -730,6 +731,11 @@ void RewriteBlocks::RewriteBlockCall(CallExpr *Exp) { BlockCall.c_str(), BlockCall.size()); } +void RewriteBlocks::RewriteBlockDeclRefExpr(BlockDeclRefExpr *BDRE) { + // FIXME: Add more elaborate code generation required by the ABI. + InsertText(BDRE->getLocStart(), "*", 1); +} + void RewriteBlocks::RewriteBlockPointerFunctionArgs(FunctionDecl *FD) { SourceLocation DeclLoc = FD->getLocation(); unsigned parenCount = 0, nArgs = 0; @@ -1010,6 +1016,11 @@ Stmt *RewriteBlocks::RewriteFunctionBody(Stmt *S) { RewriteBlockPointerDecl(TD); } } + // Handle specific things. + if (BlockDeclRefExpr *BDRE = dyn_cast(S)) { + if (BDRE->isByRef()) + RewriteBlockDeclRefExpr(BDRE); + } // Return this stmt unmodified. return S; }