[cfe-commits] r108341 - in /cfe/trunk: lib/Sema/SemaObjCProperty.cpp test/SemaObjC/default-synthesize.m

Fariborz Jahanian fjahanian at apple.com
Wed Jul 14 11:11:52 PDT 2010


Author: fjahanian
Date: Wed Jul 14 13:11:52 2010
New Revision: 108341

URL: http://llvm.org/viewvc/llvm-project?rev=108341&view=rev
Log:
Don't error when doing default property synthesis 
and some are already synthesized by user declaration.


Modified:
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp
    cfe/trunk/test/SemaObjC/default-synthesize.m

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=108341&r1=108340&r2=108341&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Wed Jul 14 13:11:52 2010
@@ -930,6 +930,10 @@
         Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional ||
         IMPDecl->FindPropertyImplIvarDecl(Prop->getIdentifier()))
       continue;
+    // Property may have been synthesized by user.
+    if (IMPDecl->FindPropertyImplDecl(Prop->getIdentifier()))
+      continue;
+
     ActOnPropertyImplDecl(S, IMPDecl->getLocation(), IMPDecl->getLocation(),
                           true, DeclPtrTy::make(IMPDecl),
                           Prop->getIdentifier(), Prop->getIdentifier());

Modified: cfe/trunk/test/SemaObjC/default-synthesize.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/default-synthesize.m?rev=108341&r1=108340&r2=108341&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/default-synthesize.m (original)
+++ cfe/trunk/test/SemaObjC/default-synthesize.m Wed Jul 14 13:11:52 2010
@@ -103,3 +103,15 @@
 @implementation C (Category) // expected-note 2 {{implementation is here}}
 @end
 
+// Don't complain if a property is already @synthesized by usr.
+ at interface D
+{
+}
+ at property int PROP;
+ at end
+
+ at implementation D
+- (int) Meth { return self.PROP; }
+ at synthesize PROP=IVAR;
+ at end
+





More information about the cfe-commits mailing list