]> granicus.if.org Git - clang/commitdiff
objc rewriter - my last patch was not quite right.
authorFariborz Jahanian <fjahanian@apple.com>
Sat, 30 Jul 2011 01:21:41 +0000 (01:21 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Sat, 30 Jul 2011 01:21:41 +0000 (01:21 +0000)
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

index 3e57e12db7e3617e8fa9a0e9a18f37b95fe37bb6..a27fac7258f7ad7909db8b6a9583809f9d7f73e4 100644 (file)
@@ -4253,14 +4253,17 @@ std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
   S += "*src) {";
   for (llvm::SmallPtrSet<ValueDecl*,8>::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<ValueDecl*,8>::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;