[cfe-commits] r135050 - in /cfe/trunk: lib/Sema/SemaObjCProperty.cpp test/SemaObjC/property-inherited.m test/SemaObjCXX/property-type-mismatch.mm
Fariborz Jahanian
fjahanian at apple.com
Wed Jul 13 10:55:01 PDT 2011
Author: fjahanian
Date: Wed Jul 13 12:55:01 2011
New Revision: 135050
URL: http://llvm.org/viewvc/llvm-project?rev=135050&view=rev
Log:
objc++: Some level of covariance is allowed in ObjC properties.
Make it also available in ObjC++ propeties. Use common code for
objc and objc++ so they don't diverge. // rdar://9740328
Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjC/property-inherited.m
cfe/trunk/test/SemaObjCXX/property-type-mismatch.mm
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=135050&r1=135049&r2=135050&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Wed Jul 13 12:55:01 2011
@@ -910,12 +910,15 @@
Context.getCanonicalType(Property->getType());
if (!Context.propertyTypesAreCompatible(LHSType, RHSType)) {
- // FIXME: Incorporate this test with typesAreCompatible.
- if (LHSType->isObjCQualifiedIdType() && RHSType->isObjCQualifiedIdType())
- if (Context.ObjCQualifiedIdTypesAreCompatible(LHSType, RHSType, false))
- return;
- Diag(Property->getLocation(), diag::warn_property_types_are_incompatible)
- << Property->getType() << SuperProperty->getType() << inheritedName;
+ // Do cases not handled in above.
+ // FIXME. For future support of covariant property types, revisit this.
+ bool IncompatibleObjC = false;
+ QualType ConvertedType;
+ if (!isObjCPointerConversion(RHSType, LHSType,
+ ConvertedType, IncompatibleObjC) ||
+ IncompatibleObjC)
+ Diag(Property->getLocation(), diag::warn_property_types_are_incompatible)
+ << Property->getType() << SuperProperty->getType() << inheritedName;
}
}
Modified: cfe/trunk/test/SemaObjC/property-inherited.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-inherited.m?rev=135050&r1=135049&r2=135050&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-inherited.m (original)
+++ cfe/trunk/test/SemaObjC/property-inherited.m Wed Jul 13 12:55:01 2011
@@ -1,6 +1,8 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 -x objective-c++ %s -fsyntax-only -verify
-// <rdar://problem/6497242> Inherited overridden protocol declared objects don't work
+// rdar://6497242 Inherited overridden protocol declared objects don't work
+// rdar://9740328 Case for c++
@protocol NSObject @end
@interface NSObject @end
Modified: cfe/trunk/test/SemaObjCXX/property-type-mismatch.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/property-type-mismatch.mm?rev=135050&r1=135049&r2=135050&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/property-type-mismatch.mm (original)
+++ cfe/trunk/test/SemaObjCXX/property-type-mismatch.mm Wed Jul 13 12:55:01 2011
@@ -1,6 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar://9740328
-// XFAIL: *
@protocol P1;
More information about the cfe-commits
mailing list