]> granicus.if.org Git - clang/commitdiff
writable property in a category of class's superclass
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 6 Apr 2009 16:59:10 +0000 (16:59 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 6 Apr 2009 16:59:10 +0000 (16:59 +0000)
makes the property writable in the current class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68446 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/writable-property-in-superclass.m [new file with mode: 0644]

index 299f101bdbf8ba2d18ef0c55b9abb5b07be14127..80d46bcabbed5ee60a662bce99df7de373862496 100644 (file)
@@ -835,6 +835,9 @@ bool Sema::isPropertyReadonly(ObjCPropertyDecl *PDecl,
         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;
 }
 
diff --git a/test/SemaObjC/writable-property-in-superclass.m b/test/SemaObjC/writable-property-in-superclass.m
new file mode 100644 (file)
index 0000000..182b1c4
--- /dev/null
@@ -0,0 +1,17 @@
+// RUN: clang-cc  -fsyntax-only -verify %s
+
+@interface MessageStore
+@property (assign, readonly) int P;
+@end
+
+@interface MessageStore (CAT)
+@property (assign) int P;
+@end
+
+@interface  NeXTMbox : MessageStore
+@end
+
+@implementation NeXTMbox
+- (void) Meth { self.P = 1; }
+@end
+