[cfe-commits] r57063 - /cfe/trunk/Driver/RewriteBlocks.cpp

Steve Naroff snaroff at apple.com
Sat Oct 4 11:52:48 PDT 2008


Author: snaroff
Date: Sat Oct  4 13:52:47 2008
New Revision: 57063

URL: http://llvm.org/viewvc/llvm-project?rev=57063&view=rev
Log:
Add indirection required for byref BlockDeclRefExpr's.

Modified:
    cfe/trunk/Driver/RewriteBlocks.cpp

Modified: cfe/trunk/Driver/RewriteBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteBlocks.cpp?rev=57063&r1=57062&r2=57063&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteBlocks.cpp (original)
+++ cfe/trunk/Driver/RewriteBlocks.cpp Sat Oct  4 13:52:47 2008
@@ -97,6 +97,7 @@
   
   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 @@
               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 @@
         RewriteBlockPointerDecl(TD);
     }
   }
+  // Handle specific things.
+  if (BlockDeclRefExpr *BDRE = dyn_cast<BlockDeclRefExpr>(S)) {
+    if (BDRE->isByRef())
+      RewriteBlockDeclRefExpr(BDRE);
+  }
   // Return this stmt unmodified.
   return S;
 }





More information about the cfe-commits mailing list