From: Fariborz Jahanian Date: Thu, 5 Mar 2009 19:17:31 +0000 (+0000) Subject: Adds a template for a function for objc2's gc's ivar layout X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d80d81b53c08db00078c14d30aba4fa259a20ae0;p=clang Adds a template for a function for objc2's gc's ivar layout bitmap. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66175 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 63185e585e..6b2f4b01e5 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -395,6 +395,11 @@ protected: /// name. The return value has type char *. llvm::Constant *GetClassName(IdentifierInfo *Ident); + /// GetIvarLayoutName - Returns a unique constant for the given + /// ivar layout bitmap. + llvm::Constant *GetIvarLayoutName(IdentifierInfo *Ident, + const ObjCCommonTypesHelper &ObjCTypes); + const RecordDecl *GetFirstIvarInRecord(const ObjCInterfaceDecl *OID, RecordDecl::field_iterator &FIV, RecordDecl::field_iterator &PIV); @@ -1467,7 +1472,7 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) { Values[ 8] = llvm::Constant::getNullValue(ObjCTypes.CachePtrTy); Values[ 9] = Protocols; // FIXME: Set ivar_layout - Values[10] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); + Values[10] = GetIvarLayoutName(0, ObjCTypes); Values[11] = EmitClassExtension(ID); llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ClassTy, Values); @@ -1598,7 +1603,7 @@ CGObjCMac::EmitClassExtension(const ObjCImplementationDecl *ID) { std::vector Values(3); Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size); // FIXME: Output weak_ivar_layout string. - Values[1] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); + Values[1] = GetIvarLayoutName(0, ObjCTypes); Values[2] = EmitPropertyList("\01L_OBJC_$_PROP_LIST_" + ID->getNameAsString(), ID, ID->getClassInterface(), ObjCTypes); @@ -2437,6 +2442,13 @@ llvm::Constant *CGObjCCommonMac::GetClassName(IdentifierInfo *Ident) { return getConstantGEP(Entry, 0, 0); } +/// GetIvarLayoutName - Returns a unique constant for the given +/// ivar layout bitmap. +llvm::Constant *CGObjCCommonMac::GetIvarLayoutName(IdentifierInfo *Ident, + const ObjCCommonTypesHelper &ObjCTypes) { + return llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); +} + llvm::Constant *CGObjCCommonMac::GetMethodVarName(Selector Sel) { llvm::GlobalVariable *&Entry = MethodVarNames[Sel]; @@ -3568,7 +3580,7 @@ llvm::GlobalVariable * CGObjCNonFragileABIMac::BuildClassRoTInitializer( Values[ 2] = llvm::ConstantInt::get(ObjCTypes.IntTy, InstanceSize); // FIXME. For 64bit targets add 0 here. // FIXME. ivarLayout is currently null! - Values[ 3] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); + Values[ 3] = GetIvarLayoutName(0, ObjCTypes); Values[ 4] = GetClassName(ID->getIdentifier()); // const struct _method_list_t * const baseMethods; std::vector Methods; @@ -3618,7 +3630,7 @@ llvm::GlobalVariable * CGObjCNonFragileABIMac::BuildClassRoTInitializer( else Values[ 7] = EmitIvarList(ID); // FIXME. weakIvarLayout is currently null. - Values[ 8] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); + Values[ 8] = GetIvarLayoutName(0, ObjCTypes); if (flags & CLS_META) Values[ 9] = llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy); else