[cfe-commits] r104084 - in /cfe/trunk: lib/Sema/SemaObjCProperty.cpp lib/Sema/SemaOverload.cpp test/SemaObjC/error-property-gc-attr.m
Fariborz Jahanian
fjahanian at apple.com
Tue May 18 16:04:17 PDT 2010
Author: fjahanian
Date: Tue May 18 18:04:17 2010
New Revision: 104084
URL: http://llvm.org/viewvc/llvm-project?rev=104084&view=rev
Log:
Misc. fixes to bring Objetive-C++'s handling of
gc attributes to be inline with Objective-C
(for radar 7925141).
Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaObjC/error-property-gc-attr.m
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=104084&r1=104083&r2=104084&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Tue May 18 18:04:17 2010
@@ -383,7 +383,16 @@
// Check that type of property and its ivar are type compatible.
if (PropType != IvarType) {
- if (CheckAssignmentConstraints(PropType, IvarType) != Compatible) {
+ bool compat = false;
+ if (isa<ObjCObjectPointerType>(PropType)
+ && isa<ObjCObjectPointerType>(IvarType))
+ compat =
+ Context.canAssignObjCInterfaces(
+ PropType->getAs<ObjCObjectPointerType>(),
+ IvarType->getAs<ObjCObjectPointerType>());
+ else
+ compat = (CheckAssignmentConstraints(PropType, IvarType) == Compatible);
+ if (!compat) {
Diag(PropertyLoc, diag::error_property_ivar_type)
<< property->getDeclName() << PropType
<< Ivar->getDeclName() << IvarType;
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=104084&r1=104083&r2=104084&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue May 18 18:04:17 2010
@@ -1042,7 +1042,8 @@
CanonTo = Context.getCanonicalType(ToType);
if (CanonFrom.getLocalUnqualifiedType()
== CanonTo.getLocalUnqualifiedType() &&
- CanonFrom.getLocalCVRQualifiers() != CanonTo.getLocalCVRQualifiers()) {
+ (CanonFrom.getLocalCVRQualifiers() != CanonTo.getLocalCVRQualifiers()
+ || CanonFrom.getObjCGCAttr() != CanonTo.getObjCGCAttr())) {
FromType = ToType;
CanonFrom = CanonTo;
}
Modified: cfe/trunk/test/SemaObjC/error-property-gc-attr.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/error-property-gc-attr.m?rev=104084&r1=104083&r2=104084&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/error-property-gc-attr.m (original)
+++ cfe/trunk/test/SemaObjC/error-property-gc-attr.m Tue May 18 18:04:17 2010
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify %s
@interface INTF
{
@@ -11,7 +12,7 @@
}
@property (assign) __weak id pweak;
@property (assign) __weak id WID;
- at property (assign) __strong id not;
+ at property (assign) __strong id NOT;
@property (assign) id ID;
@property (assign) INTF* AWEAK;
@property (assign) __weak INTF* WI;
@@ -19,7 +20,7 @@
@implementation INTF
@synthesize pweak=IVAR; // expected-error {{existing ivar 'IVAR' for __weak property 'pweak' must be __weak}}
- at synthesize not=II; // expected-error {{existing ivar 'II' for a __strong property 'not' must be garbage collectable}}
+ at synthesize NOT=II; // expected-error {{existing ivar 'II' for a __strong property 'NOT' must be garbage collectable}}
@synthesize WID;
@synthesize ID;
@synthesize AWEAK; // expected-error {{existing ivar 'AWEAK' for a __strong property 'AWEAK' must be garbage collectable}}
More information about the cfe-commits
mailing list