llvm::cl::ZeroOrMore,
llvm::cl::init(false));
-llvm::Constant *CodeGenFunction::BuildDescriptorBlockDecl(uint64_t Size) {
+llvm::Constant *CodeGenFunction::
+BuildDescriptorBlockDecl(uint64_t Size, const llvm::Type* Ty) {
const llvm::Type *UnsignedLongTy
= CGM.getTypes().ConvertType(getContext().UnsignedLongTy);
llvm::Constant *C;
if (BlockHasCopyDispose) {
// copy_func_helper_decl
- Elts.push_back(BuildCopyHelper());
+ Elts.push_back(BuildCopyHelper(Ty));
// destroy_func_decl
- Elts.push_back(BuildDestroyHelper());
+ Elts.push_back(BuildDestroyHelper(Ty));
}
C = llvm::ConstantStruct::get(Elts);
C = llvm::ConstantInt::get(IntTy, 0);
Elts[2] = C;
- // __descriptor
- Elts[4] = BuildDescriptorBlockDecl(subBlockSize);
-
if (subBlockDeclRefDecls.size() == 0) {
+ // __descriptor
+ Elts[4] = BuildDescriptorBlockDecl(subBlockSize, 0);
+
// Optimize to being a global block.
Elts[0] = CGM.getNSConcreteGlobalBlock();
Elts[1] = llvm::ConstantInt::get(IntTy, flags|BLOCK_IS_GLOBAL);
// FIXME: Ensure that the offset created by the backend for
// the struct matches the previously computed offset in BlockDecls.
}
+
+ // __descriptor
+ Elts[4] = BuildDescriptorBlockDecl(subBlockSize, Ty);
}
QualType BPT = BE->getType();
return BlockOffset-Size;
}
-llvm::Constant *BlockFunction::GenerateCopyHelperFunction() {
+llvm::Constant *BlockFunction::GenerateCopyHelperFunction(const llvm::Type *Ty) {
QualType R = getContext().VoidTy;
FunctionArgList Args;
return llvm::ConstantExpr::getBitCast(Fn, PtrToInt8Ty);
}
-llvm::Constant *BlockFunction::GenerateDestroyHelperFunction() {
+llvm::Constant *BlockFunction::
+GenerateDestroyHelperFunction(const llvm::Type* Ty) {
QualType R = getContext().VoidTy;
FunctionArgList Args;
return llvm::ConstantExpr::getBitCast(Fn, PtrToInt8Ty);
}
-llvm::Constant *BlockFunction::BuildCopyHelper() {
- return CodeGenFunction(CGM).GenerateCopyHelperFunction();
+llvm::Constant *BlockFunction::BuildCopyHelper(const llvm::Type *Ty) {
+ return CodeGenFunction(CGM).GenerateCopyHelperFunction(Ty);
}
-llvm::Constant *BlockFunction::BuildDestroyHelper() {
- return CodeGenFunction(CGM).GenerateDestroyHelperFunction();
+llvm::Constant *BlockFunction::BuildDestroyHelper(const llvm::Type *Ty) {
+ return CodeGenFunction(CGM).GenerateDestroyHelperFunction(Ty);
}
llvm::Constant *BlockFunction::
ImplicitParamDecl *BlockStructDecl;
ImplicitParamDecl *getBlockStructDecl() { return BlockStructDecl; }
- llvm::Constant *GenerateCopyHelperFunction();
- llvm::Constant *GenerateDestroyHelperFunction();
+ llvm::Constant *GenerateCopyHelperFunction(const llvm::Type *);
+ llvm::Constant *GenerateDestroyHelperFunction(const llvm::Type *);
- llvm::Constant *BuildCopyHelper();
- llvm::Constant *BuildDestroyHelper();
+ llvm::Constant *BuildCopyHelper(const llvm::Type *);
+ llvm::Constant *BuildDestroyHelper(const llvm::Type *);
llvm::Constant *GeneratebyrefCopyHelperFunction(const llvm::Type *, int flag);
llvm::Constant *GeneratebyrefDestroyHelperFunction(const llvm::Type *T, int);