const llvm::StructType* Ty,
llvm::Constant *BlockVarLayout,
std::vector<HelperInfo> *NoteForHelper) {
- bool BlockHasCopyDispose = Info.BlockHasCopyDispose;
CharUnits Size = Info.BlockSize;
const llvm::Type *UnsignedLongTy
= CGM.getTypes().ConvertType(getContext().UnsignedLongTy);
Elts.push_back(C);
// optional copy/dispose helpers
- if (BlockHasCopyDispose) {
+ if (Info.BlockHasCopyDispose) {
// copy_func_helper_decl
Elts.push_back(BuildCopyHelper(Ty, NoteForHelper));
= CodeGenFunction(CGM).GenerateBlockFunction(CurGD, BE, Info, CurFuncDecl,
BlockVarLayout,
LocalDeclMap);
- BlockHasCopyDispose |= Info.BlockHasCopyDispose;
+ SynthesizeCopyDisposeHelpers |= Info.BlockHasCopyDispose;
Elts[3] = Fn;
// FIXME: Don't use BlockHasCopyDispose, it is set more often then
return;
// Don't run the expensive check, unless we have to.
- if (!BlockHasCopyDispose)
- if (E->isByRef()
- || BlockRequiresCopying(E))
- BlockHasCopyDispose = true;
+ if (!SynthesizeCopyDisposeHelpers)
+ if (E->isByRef() || BlockRequiresCopying(E))
+ SynthesizeCopyDisposeHelpers = true;
const ValueDecl *D = cast<ValueDecl>(E->getDecl());
const llvm::Type *PtrStructTy
= llvm::PointerType::get(BuildByRefType(VD), 0);
// The block literal will need a copy/destroy helper.
- BlockHasCopyDispose = true;
+ SynthesizeCopyDisposeHelpers = true;
const llvm::Type *Ty = PtrStructTy;
Ty = llvm::PointerType::get(Ty, 0);
else
BlockVarLayout = llvm::Constant::getNullValue(PtrToInt8Ty);
- QualType ParmTy = getContext().getBlockParmType(BlockHasCopyDispose,
- BlockLayout);
+ QualType ParmTy = getContext().getBlockParmType(
+ SynthesizeCopyDisposeHelpers,
+ BlockLayout);
// FIXME: This leaks
ImplicitParamDecl *SelfDecl =
Info.BlockSize = BlockOffset;
Info.BlockAlign = BlockAlign;
Info.BlockLayout = BlockLayout;
- Info.BlockHasCopyDispose = BlockHasCopyDispose;
+ Info.BlockHasCopyDispose = SynthesizeCopyDisposeHelpers;
return Fn;
}
}
llvm::Constant *BlockFunction::
-GenerateCopyHelperFunction(bool BlockHasCopyDispose, const llvm::StructType *T,
+GenerateCopyHelperFunction(const llvm::StructType *T,
std::vector<HelperInfo> *NoteForHelperp) {
QualType R = getContext().VoidTy;
}
llvm::Constant *BlockFunction::
-GenerateDestroyHelperFunction(bool BlockHasCopyDispose,
- const llvm::StructType* T,
+GenerateDestroyHelperFunction(const llvm::StructType* T,
std::vector<HelperInfo> *NoteForHelperp) {
QualType R = getContext().VoidTy;
llvm::Constant *BlockFunction::BuildCopyHelper(const llvm::StructType *T,
std::vector<HelperInfo> *NoteForHelper) {
- return CodeGenFunction(CGM).GenerateCopyHelperFunction(BlockHasCopyDispose,
- T, NoteForHelper);
+ return CodeGenFunction(CGM).GenerateCopyHelperFunction(T, NoteForHelper);
}
llvm::Constant *BlockFunction::BuildDestroyHelper(const llvm::StructType *T,
std::vector<HelperInfo> *NoteForHelperp) {
- return CodeGenFunction(CGM).GenerateDestroyHelperFunction(BlockHasCopyDispose,
- T, NoteForHelperp);
+ return CodeGenFunction(CGM).GenerateDestroyHelperFunction(T, NoteForHelperp);
}
llvm::Constant *BlockFunction::
PtrToInt8Ty = llvm::PointerType::getUnqual(
llvm::Type::getInt8Ty(VMContext));
- BlockHasCopyDispose = false;
+ SynthesizeCopyDisposeHelpers = false;
}
/// for a value with the given size and alignment requirements.
CharUnits getBlockOffset(CharUnits Size, CharUnits Align);
- /// BlockHasCopyDispose - True iff the block uses copy/dispose.
- bool BlockHasCopyDispose;
+ /// SynthesizeCopyDisposeHelpers - True iff the block uses copy/dispose.
+ bool SynthesizeCopyDisposeHelpers;
/// BlockLayout - The layout of the block's storage, represented as
/// a sequence of expressions which require such storage. The
ImplicitParamDecl *BlockStructDecl;
ImplicitParamDecl *getBlockStructDecl() { return BlockStructDecl; }
- llvm::Constant *GenerateCopyHelperFunction(bool, const llvm::StructType *,
+ llvm::Constant *GenerateCopyHelperFunction(const llvm::StructType *,
std::vector<HelperInfo> *);
- llvm::Constant *GenerateDestroyHelperFunction(bool, const llvm::StructType *,
+ llvm::Constant *GenerateDestroyHelperFunction(const llvm::StructType *,
std::vector<HelperInfo> *);
llvm::Constant *BuildCopyHelper(const llvm::StructType *,