From 5bc60d0c324a1b3984cd4a32acb587c8f873ab5f Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Tue, 16 Dec 2008 15:50:30 +0000 Subject: [PATCH] Fix clang ObjC rewriter: _Block_release has wrong parameter type in preamble git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61088 91177308-0d34-0410-b5e6-96231b3b80d8 --- Driver/RewriteObjC.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index aaaa0c6689..8828c1c2d3 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -537,13 +537,11 @@ void RewriteObjC::Initialize(ASTContext &context) { Preamble += " int Size;\n"; Preamble += " void *FuncPtr;\n"; Preamble += "};\n"; - Preamble += "// Runtime copy/destroy helper functions\n"; - Preamble += "__OBJC_RW_STATICIMPORT void _Block_copy_assign(void *, void *);\n"; - Preamble += "__OBJC_RW_STATICIMPORT void _Block_byref_assign_copy(void *, void *);\n"; - Preamble += "__OBJC_RW_STATICIMPORT void _Block_release(void *);\n"; - Preamble += "__OBJC_RW_STATICIMPORT void _Block_byref_release(void *);\n"; - Preamble += "__OBJC_RW_STATICIMPORT void *_NSConcreteGlobalBlock;\n"; - Preamble += "__OBJC_RW_STATICIMPORT void *_NSConcreteStackBlock;\n"; + Preamble += "// Runtime copy/destroy helper functions (from Block_private.h)\n"; + Preamble += "__OBJC_RW_STATICIMPORT void _Block_object_assign(void *, const void *, const int);\n"; + Preamble += "__OBJC_RW_STATICIMPORT void _Block_object_dispose(const void *, const int);\n"; + Preamble += "__OBJC_RW_STATICIMPORT void *_NSConcreteGlobalBlock[32];\n"; + Preamble += "__OBJC_RW_STATICIMPORT void *_NSConcreteStackBlock[32];\n"; Preamble += "#endif\n"; if (LangOpts.Microsoft) { Preamble += "#undef __OBJC_RW_DLLIMPORT\n"; @@ -3516,11 +3514,11 @@ 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((void*)&dst->"; + S += "_Block_object_assign((void*)&dst->"; S += (*I)->getNameAsString(); S += ", (void*)src->"; S += (*I)->getNameAsString(); - S += ");}"; + S += ", 3/*BLOCK_FIELD_IS_OBJECT*/);}"; } S += "\nstatic void __"; S += funcName; @@ -3529,9 +3527,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_release((void*)src->"; + S += "_Block_object_dispose((void*)src->"; S += (*I)->getNameAsString(); - S += ");"; + S += ", 3/*BLOCK_FIELD_IS_OBJECT*/);"; } S += "}\n"; return S; -- 2.50.1