diff options
author | Mike Stump <mrs@apple.com> | 2009-02-21 20:00:35 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-02-21 20:00:35 +0000 |
commit | 4e7a1f7682d94811bd41fca8aefccc38f686db23 (patch) | |
tree | 781baa224e97254f4e097ab80c0175aca139a7a2 /lib/CodeGen/CodeGenFunction.cpp | |
parent | 8dfb0c57ddb700b163afa89e3ab160f1de26753d (diff) |
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
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
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 { |