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
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 19a2a63..1ca9d8d 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -320,12 +320,20 @@
   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