From: Mike Stump Date: Wed, 4 Mar 2009 18:57:26 +0000 (+0000) Subject: Move some of the CodeGenFunction blocks code up and out. No X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3947de5edda7e0c32060c568cc5f7b2aae6f70b4;p=clang Move some of the CodeGenFunction blocks code up and out. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66048 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index d877b171b9..bd30c55800 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -664,7 +664,7 @@ uint64_t CodeGenFunction::getBlockOffset(const BlockDeclRefExpr *BDRE) { return BlockOffset-Size; } -llvm::Value *CodeGenFunction::BuildCopyHelper(int flag) { +llvm::Value *BlockFunction::BuildCopyHelper(int flag) { const llvm::PointerType *PtrToInt8Ty = llvm::PointerType::getUnqual(llvm::Type::Int8Ty); // FIXME: implement @@ -674,7 +674,7 @@ llvm::Value *CodeGenFunction::BuildCopyHelper(int flag) { return V; } -llvm::Value *CodeGenFunction::BuildDestroyHelper(int flag) { +llvm::Value *BlockFunction::BuildDestroyHelper(int flag) { const llvm::PointerType *PtrToInt8Ty = llvm::PointerType::getUnqual(llvm::Type::Int8Ty); // FIXME: implement diff --git a/lib/CodeGen/CGBlocks.h b/lib/CodeGen/CGBlocks.h index f58831423e..6c3ca748b9 100644 --- a/lib/CodeGen/CGBlocks.h +++ b/lib/CodeGen/CGBlocks.h @@ -117,6 +117,14 @@ public: BLOCK_BYREF_CALLER = 128 /* called from __block (byref) copy/dispose support routines */ }; + + CGBuilderTy &Builder; + + BlockFunction(CGBuilderTy &B) : Builder(B) { } + + llvm::Value *BuildCopyHelper(int flag); + llvm::Value *BuildDestroyHelper(int flag); + }; } // end namespace CodeGen diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index d6e3394b8d..0e9bf1a5bb 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -24,8 +24,8 @@ using namespace clang; using namespace CodeGen; CodeGenFunction::CodeGenFunction(CodeGenModule &cgm) - : CGM(cgm), Target(CGM.getContext().Target), DebugInfo(0), SwitchInsn(0), - CaseRangeBlock(0), InvokeDest(0) { + : BlockFunction(Builder), CGM(cgm), Target(CGM.getContext().Target), + DebugInfo(0), SwitchInsn(0), CaseRangeBlock(0), InvokeDest(0) { LLVMIntTy = ConvertType(getContext().IntTy); LLVMPointerWidth = Target.getPointerWidth(0); diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index caf50d35b2..6455f119c0 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -265,9 +265,6 @@ public: // Block Bits //===--------------------------------------------------------------------===// - llvm::Value *BuildCopyHelper(int flag); - llvm::Value *BuildDestroyHelper(int flag); - llvm::Value *BuildBlockLiteralTmp(const BlockExpr *); llvm::Constant *BuildDescriptorBlockDecl(uint64_t Size);