aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-02-02 18:54:58 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-02-02 18:54:58 +0000
commite23518342e326e3d6e9139f05384f030e2a94d4a (patch)
tree03474664dc4825e4bc4f6b1661ea412e8ee758a9 /lib/Sema/SemaObjCProperty.cpp
parentee2127733af888638f830de5d5c4057cd98d7c77 (diff)
objective-c: When redeclaraing in continuation class a 'readonly'
property to 'readwrite', also allow redeclaration of property type to a narrowring object type. // rdar://10790488 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149614 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--lib/Sema/SemaObjCProperty.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index b4aee7c0dd..7f6d8c34f4 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -276,11 +276,18 @@ Sema::HandlePropertyInClassExtension(Scope *S,
L->AddedObjCPropertyInClassExtension(PDecl, /*OrigProp=*/0, CDecl);
return PDecl;
}
- if (PIDecl->getType().getCanonicalType()
- != PDecl->getType().getCanonicalType()) {
- Diag(AtLoc,
- diag::err_type_mismatch_continuation_class) << PDecl->getType();
- Diag(PIDecl->getLocation(), diag::note_property_declare);
+ if (!Context.hasSameType(PIDecl->getType(), PDecl->getType())) {
+ bool IncompatibleObjC = false;
+ QualType ConvertedType;
+ if (!isa<ObjCObjectPointerType>(PIDecl->getType()) ||
+ !isa<ObjCObjectPointerType>(PDecl->getType()) ||
+ (!isObjCPointerConversion(PDecl->getType(), PIDecl->getType(),
+ ConvertedType, IncompatibleObjC))
+ || IncompatibleObjC) {
+ Diag(AtLoc,
+ diag::err_type_mismatch_continuation_class) << PDecl->getType();
+ Diag(PIDecl->getLocation(), diag::note_property_declare);
+ }
}
// The property 'PIDecl's readonly attribute will be over-ridden