]> granicus.if.org Git - clang/commitdiff
Add indirection required for byref BlockDeclRefExpr's.
authorSteve Naroff <snaroff@apple.com>
Sat, 4 Oct 2008 18:52:47 +0000 (18:52 +0000)
committerSteve Naroff <snaroff@apple.com>
Sat, 4 Oct 2008 18:52:47 +0000 (18:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57063 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/RewriteBlocks.cpp

index 57d3a84560c23a987f2f4a4e2573fd4a4942b1a9..b887734a2ecc5522d38d6f4678af63f8a02808be 100644 (file)
@@ -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;
 }