From: Fariborz Jahanian Date: Tue, 22 Jun 2010 16:33:55 +0000 (+0000) Subject: Fixes a problem in generation of meta-data for X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6afbdf52563942cbf3d68c1cc0fcf590c94a47d3;p=clang Fixes a problem in generation of meta-data for category implementation whereby property list was missing. NeXt ObjC runtime (radar 8093297). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106550 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 801b1f2c18..fb3bec5ad8 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -1931,10 +1931,18 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(llvm::Twine Name, Properties.push_back(llvm::ConstantStruct::get(ObjCTypes.PropertyTy, Prop)); } - if (const ObjCInterfaceDecl *OID = dyn_cast(OCD)) + if (const ObjCInterfaceDecl *OID = dyn_cast(OCD)) { for (ObjCInterfaceDecl::protocol_iterator P = OID->protocol_begin(), E = OID->protocol_end(); P != E; ++P) - PushProtocolProperties(PropertySet, Properties, Container, (*P), ObjCTypes); + PushProtocolProperties(PropertySet, Properties, Container, (*P), + ObjCTypes); + } + else if (const ObjCCategoryDecl *CD = dyn_cast(OCD)) { + for (ObjCCategoryDecl::protocol_iterator P = CD->protocol_begin(), + E = CD->protocol_end(); P != E; ++P) + PushProtocolProperties(PropertySet, Properties, Container, (*P), + ObjCTypes); + } // Return null for empty list. if (Properties.empty()) diff --git a/test/CodeGenObjC/property-category-impl.m b/test/CodeGenObjC/property-category-impl.m new file mode 100644 index 0000000000..80a18cb1da --- /dev/null +++ b/test/CodeGenObjC/property-category-impl.m @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s + +// rdar : // 8093297 + +@interface Foo @end + +@protocol Proto +@property (readonly) int proto_property; +@end + +@interface Foo (Category) @end + +@implementation Foo (Category) +-(int)proto_property { return 0; } +@end + + +// CHECK: l_OBJC_$_PROP_LIST_Foo_$_Category" = internal global +// CHECK: l_OBJC_$_CATEGORY_Foo_$_Category" = internal global +// CHECK: l_OBJC_$_PROP_LIST_Foo_$_Category