Fix a block rewriter bug where copy/dispose entries in
block descriptor for outer block was missing even though
the block was importing objects into its inner blocks.
//rdar://84995992
llvm-svn: 115644
diff --git a/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp
index c085e6d..abd46df 100644
--- a/clang/lib/Rewrite/RewriteObjC.cpp
+++ b/clang/lib/Rewrite/RewriteObjC.cpp
@@ -4381,6 +4381,12 @@
BlockByRefDeclsPtrSet.insert(VD);
BlockByRefDecls.push_back(VD);
}
+ // imported objects in the inner blocks not used in the outer
+ // blocks must be copied/disposed in the outer block as well.
+ if (Exp->isByRef() ||
+ VD->getType()->isObjCObjectPointerType() ||
+ VD->getType()->isBlockPointerType())
+ ImportedBlockDecls.insert(VD);
}
std::string ImplTag = "__" + FunName.str() + "_block_impl_" + utostr(i);