From 4e7a1f7682d94811bd41fca8aefccc38f686db23 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Sat, 21 Feb 2009 20:00:35 +0000 Subject: Add CodeGen support for the helper for BlockDeclRefExprs. The easier stuff is mostly done. Move BlockHasCopyDispose up. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65242 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index c1436b5ff4..9175d16063 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -19,14 +19,25 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "llvm/Support/CFG.h" +#include "llvm/Target/TargetData.h" using namespace clang; using namespace CodeGen; CodeGenFunction::CodeGenFunction(CodeGenModule &cgm) : CGM(cgm), Target(CGM.getContext().Target), DebugInfo(0), SwitchInsn(0), - CaseRangeBlock(0) { - LLVMIntTy = ConvertType(getContext().IntTy); - LLVMPointerWidth = Target.getPointerWidth(0); + CaseRangeBlock(0) { + LLVMIntTy = ConvertType(getContext().IntTy); + LLVMPointerWidth = Target.getPointerWidth(0); + + // FIXME: We need to rearrange the code for copy/dispose so we have this + // sooner, so we can calculate offsets correctly. + BlockHasCopyDispose = false; + if (!BlockHasCopyDispose) + BlockOffset = CGM.getTargetData() + .getTypeStoreSizeInBits(CGM.getGenericBlockLiteralType()) / 8; + else + BlockOffset = CGM.getTargetData() + .getTypeStoreSizeInBits(CGM.getGenericExtendedBlockLiteralType()) / 8; } ASTContext &CodeGenFunction::getContext() const { -- cgit v1.2.3-70-g09d2