[cfe-commits] r91856 - /cfe/trunk/lib/Frontend/RewriteObjC.cpp
Fariborz Jahanian
fjahanian at apple.com
Mon Dec 21 15:31:43 PST 2009
Author: fjahanian
Date: Mon Dec 21 17:31:42 2009
New Revision: 91856
URL: http://llvm.org/viewvc/llvm-project?rev=91856&view=rev
Log:
Providing support for rewriting of block copy/dispose of
imported block variables. WIP.
Modified:
cfe/trunk/lib/Frontend/RewriteObjC.cpp
Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=91856&r1=91855&r2=91856&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Mon Dec 21 17:31:42 2009
@@ -565,8 +565,8 @@
Preamble += "extern \"C\" __declspec(dllexport) void *_NSConcreteGlobalBlock[32];\n";
Preamble += "extern \"C\" __declspec(dllexport) void *_NSConcreteStackBlock[32];\n";
Preamble += "#else\n";
- Preamble += "__OBJC_RW_DLLIMPORT void _Block_object_assign(void *, const void *, const int);\n";
- Preamble += "__OBJC_RW_DLLIMPORT void _Block_object_dispose(const void *, const int);\n";
+ Preamble += "__OBJC_RW_DLLIMPORT \"C\" void _Block_object_assign(void *, const void *, const int);\n";
+ Preamble += "__OBJC_RW_DLLIMPORT \"C\" void _Block_object_dispose(const void *, const int);\n";
Preamble += "__OBJC_RW_DLLIMPORT void *_NSConcreteGlobalBlock[32];\n";
Preamble += "__OBJC_RW_DLLIMPORT void *_NSConcreteStackBlock[32];\n";
Preamble += "#endif\n";
@@ -3924,7 +3924,12 @@
S += " {\n unsigned long reserved;\n";
S += " unsigned long Block_size;\n";
if (hasCopy) {
- S += " void *copy;\n void *dispose;\n";
+ S += " void (*copy)(struct ";
+ S += ImplTag; S += "*, struct ";
+ S += ImplTag; S += "*);\n";
+
+ S += " void (*dispose)(struct ";
+ S += ImplTag; S += "*);\n";
}
S += "} ";
@@ -4331,7 +4336,9 @@
}
// Find any imported blocks...they will need special attention.
for (unsigned i = 0; i < BlockDeclRefs.size(); i++)
- if (BlockDeclRefs[i]->getType()->isBlockPointerType()) {
+ if (BlockDeclRefs[i]->isByRef() ||
+ BlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
+ BlockDeclRefs[i]->getType()->isBlockPointerType()) {
GetBlockCallExprs(BlockDeclRefs[i]);
ImportedBlockDecls.insert(BlockDeclRefs[i]->getDecl());
}
More information about the cfe-commits
mailing list