diff options
author | Steve Naroff <snaroff@apple.com> | 2009-03-03 15:43:24 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-03-03 15:43:24 +0000 |
commit | 15edf0de6b5bc9ae227bcc9658a157ac30efd92e (patch) | |
tree | 9ba515b45da108e228c73bfc9c6389f10d7bfff0 /lib/Sema/SemaDeclObjC.cpp | |
parent | ca33129bb28b05938c3e6c9f8a66165b5cceb4dd (diff) |
Fix <rdar://problem/6497242> Inherited overridden protocol declared objects don't work.
Change Sema::DiagnosePropertyMismatch() to check for type compatibility (rather than type equivalence, which is too strict).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65949 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 19a2a636db..1ca9d8da9a 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -320,12 +320,20 @@ Sema::DiagnosePropertyMismatch(ObjCPropertyDecl *Property, if (Property->getGetterName() != SuperProperty->getGetterName()) Diag(Property->getLocation(), diag::warn_property_attribute) << Property->getDeclName() << "getter" << inheritedName; - - if (Context.getCanonicalType(Property->getType()) != - Context.getCanonicalType(SuperProperty->getType())) - Diag(Property->getLocation(), diag::warn_property_type) - << Property->getType() << inheritedName; - + + QualType LHSType = + Context.getCanonicalType(SuperProperty->getType()); + QualType RHSType = + Context.getCanonicalType(Property->getType()); + + if (!Context.typesAreCompatible(LHSType, RHSType)) { + // FIXME: Incorporate this test with typesAreCompatible. + if (LHSType->isObjCQualifiedIdType() && RHSType->isObjCQualifiedIdType()) + if (ObjCQualifiedIdTypesAreCompatible(LHSType, RHSType, false)) + return; + Diag(Property->getLocation(), diag::warn_property_types_are_incompatible) + << Property->getType() << SuperProperty->getType() << inheritedName; + } } /// ComparePropertiesInBaseAndSuper - This routine compares property |