[cfe-commits] r106550 - in /cfe/trunk: lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/property-category-impl.m

Fariborz Jahanian fjahanian at apple.com
Tue Jun 22 09:33:55 PDT 2010


Author: fjahanian
Date: Tue Jun 22 11:33:55 2010
New Revision: 106550

URL: http://llvm.org/viewvc/llvm-project?rev=106550&view=rev
Log:
Fixes a problem in generation of meta-data for
category implementation whereby property list was missing.
NeXt ObjC runtime (radar 8093297).


Added:
    cfe/trunk/test/CodeGenObjC/property-category-impl.m
Modified:
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=106550&r1=106549&r2=106550&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Jun 22 11:33:55 2010
@@ -1931,10 +1931,18 @@
     Properties.push_back(llvm::ConstantStruct::get(ObjCTypes.PropertyTy,
                                                    Prop));
   }
-  if (const ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(OCD))
+  if (const ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(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<ObjCCategoryDecl>(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())

Added: cfe/trunk/test/CodeGenObjC/property-category-impl.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/property-category-impl.m?rev=106550&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/property-category-impl.m (added)
+++ cfe/trunk/test/CodeGenObjC/property-category-impl.m Tue Jun 22 11:33:55 2010
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10  -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s
+
+// rdar : // 8093297
+
+ at interface Foo @end
+
+ at protocol Proto
+ at property (readonly) int proto_property;
+ at end
+
+ at interface Foo (Category) <Proto> @end
+
+ at implementation Foo (Category)
+-(int)proto_property { return 0; }
+ at 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





More information about the cfe-commits mailing list