From a3f61ae2c824d3999d77efb46f2f996f86885d20 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Sat, 30 Jul 2011 01:21:41 +0000 Subject: [PATCH] objc rewriter - my last patch was not quite right. Fixed again. // rdar://9846759 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136550 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Rewrite/RewriteObjC.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp index 3e57e12db7..a27fac7258 100644 --- a/lib/Rewrite/RewriteObjC.cpp +++ b/lib/Rewrite/RewriteObjC.cpp @@ -4253,14 +4253,17 @@ std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, S += "*src) {"; for (llvm::SmallPtrSet::iterator I = ImportedBlockDecls.begin(), E = ImportedBlockDecls.end(); I != E; ++I) { + ValueDecl *VD = (*I); S += "_Block_object_assign((void*)&dst->"; S += (*I)->getNameAsString(); S += ", (void*)src->"; S += (*I)->getNameAsString(); if (BlockByRefDeclsPtrSet.count((*I))) S += ", " + utostr(BLOCK_FIELD_IS_BYREF) + "/*BLOCK_FIELD_IS_BYREF*/);"; - else + else if (VD->getType()->isBlockPointerType()) S += ", " + utostr(BLOCK_FIELD_IS_BLOCK) + "/*BLOCK_FIELD_IS_BLOCK*/);"; + else + S += ", " + utostr(BLOCK_FIELD_IS_OBJECT) + "/*BLOCK_FIELD_IS_OBJECT*/);"; } S += "}\n"; @@ -4271,12 +4274,15 @@ std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i, S += "*src) {"; for (llvm::SmallPtrSet::iterator I = ImportedBlockDecls.begin(), E = ImportedBlockDecls.end(); I != E; ++I) { + ValueDecl *VD = (*I); S += "_Block_object_dispose((void*)src->"; S += (*I)->getNameAsString(); if (BlockByRefDeclsPtrSet.count((*I))) S += ", " + utostr(BLOCK_FIELD_IS_BYREF) + "/*BLOCK_FIELD_IS_BYREF*/);"; - else + else if (VD->getType()->isBlockPointerType()) S += ", " + utostr(BLOCK_FIELD_IS_BLOCK) + "/*BLOCK_FIELD_IS_BLOCK*/);"; + else + S += ", " + utostr(BLOCK_FIELD_IS_OBJECT) + "/*BLOCK_FIELD_IS_OBJECT*/);"; } S += "}\n"; return S; -- 2.40.0