diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-01-26 22:58:07 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-01-26 22:58:07 +0000 |
commit | f6317dd7da4a3de06a45cba3ed9d47e6877b4cca (patch) | |
tree | 4472cac7a3e230a8ce7b3ea9a8bee1dcb4b8d973 /lib/CodeGen/CGObjCMac.cpp | |
parent | 5ac8aff3d7431dc7e4d64d960574a10c9f7e0078 (diff) |
Build method-description-list for category meta-data
as well (for nonfragile-abi).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63062 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index b70ef5e7c3..f1460bd019 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -3171,6 +3171,7 @@ llvm::GlobalVariable * CGObjCNonFragileABIMac::BuildClassRoTInitializer( CLASS_RO_GV->setSection(".section __DATA,__data,regular,no_dead_strip"); UsedGlobals.push_back(CLASS_RO_GV); return CLASS_RO_GV; + } /// BuildClassMetaData - This routine defines that to-level meta-data @@ -3381,7 +3382,8 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) { void CGObjCNonFragileABIMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { const ObjCInterfaceDecl *Interface = OCD->getClassInterface(); - std::string ExtCatName("\01l_OBJC_$_CATEGORY_" + Interface->getNameAsString()+ + const char *Prefix = "\01l_OBJC_$_CATEGORY_"; + std::string ExtCatName(Prefix + Interface->getNameAsString()+ "_$_" + OCD->getNameAsString()); std::string ExtClassName("\01_OBJC_CLASS_$_" + Interface->getNameAsString()); @@ -3399,8 +3401,34 @@ void CGObjCNonFragileABIMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) &CGM.getModule()); UsedGlobals.push_back(ClassGV); Values[1] = ClassGV; - Values[2] = llvm::Constant::getNullValue(ObjCTypes.MethodListnfABIPtrTy); - Values[3] = llvm::Constant::getNullValue(ObjCTypes.MethodListnfABIPtrTy); + std::vector<llvm::Constant*> Methods; + std::string MethodListName(Prefix); + MethodListName += "INSTANCE_METHODS_" + Interface->getNameAsString() + + "_$_" + OCD->getNameAsString(); + + for (ObjCCategoryImplDecl::instmeth_iterator i = OCD->instmeth_begin(), + e = OCD->instmeth_end(); i != e; ++i) { + // Instance methods should always be defined. + Methods.push_back(GetMethodConstant(*i)); + } + + Values[2] = EmitMethodList(MethodListName, + ".section __DATA,__data,regular,no_dead_strip", + Methods); + + MethodListName = Prefix; + MethodListName += "CLASS_METHODS_" + Interface->getNameAsString() + "_$_" + + OCD->getNameAsString(); + Methods.clear(); + for (ObjCCategoryImplDecl::classmeth_iterator i = OCD->classmeth_begin(), + e = OCD->classmeth_end(); i != e; ++i) { + // Class methods should always be defined. + Methods.push_back(GetMethodConstant(*i)); + } + + Values[3] = EmitMethodList(MethodListName, + ".section __DATA,__data,regular,no_dead_strip", + Methods); Values[4] = llvm::Constant::getNullValue(ObjCTypes.ProtocolListnfABIPtrTy); Values[5] = llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy); |