diff options
author | Steve Naroff <snaroff@apple.com> | 2008-10-04 18:52:47 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-10-04 18:52:47 +0000 |
commit | 5e52b1763f2c13b197d5c1ee178077f58b206f37 (patch) | |
tree | 09193442ae571eef0343d21813ff80929b43b88e | |
parent | 3b0fd64cf3935e3b087492a27a3df139e3e36ecb (diff) |
Add indirection required for byref BlockDeclRefExpr's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57063 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/RewriteBlocks.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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<BlockDeclRefExpr>(S)) { + if (BDRE->isByRef()) + RewriteBlockDeclRefExpr(BDRE); + } // Return this stmt unmodified. return S; } |