[cfe-commits] r68446 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/writable-property-in-superclass.m

Fariborz Jahanian fjahanian at apple.com
Mon Apr 6 09:59:10 PDT 2009


Author: fjahanian
Date: Mon Apr  6 11:59:10 2009
New Revision: 68446

URL: http://llvm.org/viewvc/llvm-project?rev=68446&view=rev
Log:
writable property in a category of class's superclass
makes the property writable in the current class.
 

Added:
    cfe/trunk/test/SemaObjC/writable-property-in-superclass.m
Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=68446&r1=68445&r2=68446&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Apr  6 11:59:10 2009
@@ -835,6 +835,9 @@
         ObjCImplementations[IDecl->getIdentifier()])
     if (ImpDecl->getInstanceMethod(PDecl->getSetterName()))
       return false;
+  // If all fails, look at the super class.
+  if (ObjCInterfaceDecl *SIDecl = IDecl->getSuperClass())
+    return isPropertyReadonly(PDecl, SIDecl);
   return true;
 }
 

Added: cfe/trunk/test/SemaObjC/writable-property-in-superclass.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/writable-property-in-superclass.m?rev=68446&view=auto

==============================================================================
--- cfe/trunk/test/SemaObjC/writable-property-in-superclass.m (added)
+++ cfe/trunk/test/SemaObjC/writable-property-in-superclass.m Mon Apr  6 11:59:10 2009
@@ -0,0 +1,17 @@
+// RUN: clang-cc  -fsyntax-only -verify %s
+
+ at interface MessageStore
+ at property (assign, readonly) int P;
+ at end
+
+ at interface MessageStore (CAT)
+ at property (assign) int P;
+ at end
+
+ at interface  NeXTMbox : MessageStore
+ at end
+
+ at implementation NeXTMbox
+- (void) Meth { self.P = 1; }
+ at end
+





More information about the cfe-commits mailing list