From: Steve Naroff Date: Thu, 11 Dec 2008 20:51:38 +0000 (+0000) Subject: Fixup generated code for imported block decl refs. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47a242208867fa433d05a78bf346bbb37721a507;p=clang Fixup generated code for imported block decl refs. Found while investigating clang ObjC rewriter: use Block_release instead of Block_destroy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60898 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index dd04a12d35..dd3f200635 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -3516,9 +3516,9 @@ std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, S += "*src) {"; for (llvm::SmallPtrSet::iterator I = ImportedBlockDecls.begin(), E = ImportedBlockDecls.end(); I != E; ++I) { - S += "_Block_copy_assign(&dst->"; + S += "_Block_copy_assign((void*)&dst->"; S += (*I)->getNameAsString(); - S += ", src->"; + S += ", (void*)src->"; S += (*I)->getNameAsString(); S += ");}"; } @@ -3529,7 +3529,7 @@ std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, S += "*src) {"; for (llvm::SmallPtrSet::iterator I = ImportedBlockDecls.begin(), E = ImportedBlockDecls.end(); I != E; ++I) { - S += "_Block_destroy(src->"; + S += "_Block_destroy((void*)src->"; S += (*I)->getNameAsString(); S += ");"; } @@ -3993,7 +3993,7 @@ void RewriteObjC::CollectBlockDeclRefInfo(BlockExpr *Exp) { } // Find any imported blocks...they will need special attention. for (unsigned i = 0; i < BlockDeclRefs.size(); i++) - if (isBlockPointerType(BlockDeclRefs[i]->getType())) { + if (BlockDeclRefs[i]->getType()->isBlockPointerType()) { GetBlockCallExprs(BlockDeclRefs[i]); ImportedBlockDecls.insert(BlockDeclRefs[i]->getDecl()); }