summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp3
-rw-r--r--clang/test/SemaObjC/writable-property-in-superclass.m17
2 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 299f101bdbf..80d46bcabbe 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -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/clang/test/SemaObjC/writable-property-in-superclass.m b/clang/test/SemaObjC/writable-property-in-superclass.m
new file mode 100644
index 00000000000..182b1c47bb3
--- /dev/null
+++ b/clang/test/SemaObjC/writable-property-in-superclass.m
@@ -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
+
OpenPOWER on IntegriCloud