diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2008-08-26 23:03:11 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2008-08-26 23:03:11 +0000 |
| commit | 28e76caea100b81f69f1672ccc02aa1a680a6c14 (patch) | |
| tree | a3f5a41509de1558cae1e6535b93a22cd34c31b4 /clang/lib | |
| parent | abfdf928d81d968a04f5b40c48e38f796c14d1b3 (diff) | |
| download | bcm5719-llvm-28e76caea100b81f69f1672ccc02aa1a680a6c14.tar.gz bcm5719-llvm-28e76caea100b81f69f1672ccc02aa1a680a6c14.zip | |
NeXT: Emit correct properties for category.
- Was emitting duplicates of class properties instead of the category
properties.
llvm-svn: 55395
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 9413d7ebc0d..60c57289cbb 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -787,7 +787,14 @@ llvm::Constant *CGObjCMac::EmitMethodDescList(const std::string &TypeName, void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { unsigned Size = CGM.getTargetData().getABITypeSize(ObjCTypes.CategoryTy); + // FIXME: This is poor design, the OCD should have a pointer to the + // category decl. Additionally, note that Category can be null for + // the @implementation w/o an @interface case. Sema should just + // create one for us as it does for @implementation so everyone else + // can live life under a clear blue sky. const ObjCInterfaceDecl *Interface = OCD->getClassInterface(); + const ObjCCategoryDecl *Category = + Interface->FindCategoryDeclaration(OCD->getIdentifier()); std::string ExtName(std::string(Interface->getName()) + "_" + OCD->getName()); @@ -821,9 +828,15 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { Interface->protocol_begin(), Interface->protocol_end()); Values[5] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size); - Values[6] = EmitPropertyList(std::string("\01L_OBJC_$_PROP_LIST_") + ExtName, - Interface->classprop_begin(), - Interface->classprop_end()); + + // If there is no category @interface then there can be no properties. + if (Category) { + Values[6] = EmitPropertyList(std::string("\01L_OBJC_$_PROP_LIST_") + ExtName, + Category->classprop_begin(), + Category->classprop_end()); + } else { + Values[6] = llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy); + } llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.CategoryTy, Values); |

