/// defined. The return value has type ProtocolPtrTy.
llvm::Constant *GetProtocolRef(const ObjCProtocolDecl *PD);
- /// GetPointerAlign - get alignment of a pointer.
- uint32_t GetPointerAlign(void) {
- return CGM.getContext().getTypeAlign(CGM.getContext().VoidPtrTy) >> 3;
- }
-
public:
CGObjCCommonMac(CodeGen::CodeGenModule &cgm) : CGM(cgm)
{ }
std::string("\01l_OBJC_METACLASS_RO_$_")+ClassName :
std::string("\01l_OBJC_CLASS_RO_$_")+ClassName,
&CGM.getModule());
- CLASS_RO_GV->setAlignment(GetPointerAlign());
+ CLASS_RO_GV->setAlignment(
+ CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.ClassRonfABITy));
CLASS_RO_GV->setSection("__DATA, __objc_const");
UsedGlobals.push_back(CLASS_RO_GV);
return CLASS_RO_GV;
ClassName,
&CGM.getModule());
GV->setSection("__DATA, __objc_data");
- GV->setAlignment(GetPointerAlign());
+ GV->setAlignment(
+ CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.ClassnfABITy));
if (HiddenVisibility)
GV->setVisibility(llvm::GlobalValue::HiddenVisibility);
UsedGlobals.push_back(GV);
Init,
ExtCatName,
&CGM.getModule());
- GCATV->setAlignment(GetPointerAlign());
+ GCATV->setAlignment(
+ CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.CategorynfABITy));
GCATV->setSection("__DATA, __objc_const");
UsedGlobals.push_back(GCATV);
DefinedCategories.push_back(GCATV);
Init,
Name,
&CGM.getModule());
- GV->setAlignment(GetPointerAlign());
+ GV->setAlignment(
+ CGM.getTargetData().getPrefTypeAlignment(Init->getType()));
GV->setSection(Section);
UsedGlobals.push_back(GV);
return llvm::ConstantExpr::getBitCast(GV,
CGM.getModule().getGlobalVariable(ExternalName);
if (IvarOffsetGV) {
// ivar offset symbol already built due to user code referencing it.
+ IvarOffsetGV->setAlignment(
+ CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.Int8PtrTy));
IvarOffsetGV->setInitializer(Init);
UsedGlobals.push_back(IvarOffsetGV);
return IvarOffsetGV;
Init,
ExternalName,
&CGM.getModule());
+ IvarOffsetGV->setAlignment(
+ CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.Int8PtrTy));
// @private and @package have hidden visibility.
bool globalVisibility = (Ivar->getAccessControl() == ObjCIvarDecl::Public ||
Ivar->getAccessControl() == ObjCIvarDecl::Protected);
Init,
Prefix + OID->getNameAsString(),
&CGM.getModule());
- GV->setAlignment(GetPointerAlign());
+ GV->setAlignment(
+ CGM.getTargetData().getPrefTypeAlignment(Init->getType()));
GV->setSection("__DATA, __objc_const");
UsedGlobals.push_back(GV);
Init,
std::string("\01l_OBJC_PROTOCOL_$_")+ProtocolName,
&CGM.getModule());
- Entry->setAlignment(GetPointerAlign());
+ Entry->setAlignment(
+ CGM.getTargetData().getPrefTypeAlignment(ObjCTypes.ProtocolnfABITy));
Entry->setSection("__DATA,__datacoal_nt,coalesced");
}
Entry->setVisibility(llvm::GlobalValue::HiddenVisibility);
std::string("\01l_OBJC_LABEL_PROTOCOL_$_")
+ProtocolName,
&CGM.getModule());
- PTGV->setAlignment(GetPointerAlign());
+ PTGV->setAlignment(
+ CGM.getTargetData().getPrefTypeAlignment(ptype));
PTGV->setSection("__DATA, __objc_protolist");
PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
UsedGlobals.push_back(PTGV);
Name,
&CGM.getModule());
GV->setSection("__DATA, __objc_const");
- GV->setAlignment(GetPointerAlign());
+ GV->setAlignment(
+ CGM.getTargetData().getPrefTypeAlignment(Init->getType()));
UsedGlobals.push_back(GV);
return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.ProtocolListnfABIPtrTy);
}