r234440 - [Objective-C Sema] Use canonical type of properties when comparing
Fariborz Jahanian
fjahanian at apple.com
Wed Apr 8 14:34:04 PDT 2015
Author: fjahanian
Date: Wed Apr 8 16:34:04 2015
New Revision: 234440
URL: http://llvm.org/viewvc/llvm-project?rev=234440&view=rev
Log:
[Objective-C Sema] Use canonical type of properties when comparing
redeclaration of property in class extension and to avoid
bogus error. rdar://20469452
Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjC/property-9.m
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=234440&r1=234439&r2=234440&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Wed Apr 8 16:34:04 2015
@@ -407,9 +407,11 @@ Sema::HandlePropertyInClassExtension(Sco
// this conversion is safe only because the wider type is for a 'readonly'
// property in primary class and 'narrowed' type for a 'readwrite' property
// in continuation class.
- if (!isa<ObjCObjectPointerType>(PIDecl->getType()) ||
- !isa<ObjCObjectPointerType>(PDecl->getType()) ||
- (!isObjCPointerConversion(PDecl->getType(), PIDecl->getType(),
+ QualType PrimaryClassPropertyT = Context.getCanonicalType(PIDecl->getType());
+ QualType ClassExtPropertyT = Context.getCanonicalType(PDecl->getType());
+ if (!isa<ObjCObjectPointerType>(PrimaryClassPropertyT) ||
+ !isa<ObjCObjectPointerType>(ClassExtPropertyT) ||
+ (!isObjCPointerConversion(ClassExtPropertyT, PrimaryClassPropertyT,
ConvertedType, IncompatibleObjC))
|| IncompatibleObjC) {
Diag(AtLoc,
Modified: cfe/trunk/test/SemaObjC/property-9.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-9.m?rev=234440&r1=234439&r2=234440&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-9.m (original)
+++ cfe/trunk/test/SemaObjC/property-9.m Wed Apr 8 16:34:04 2015
@@ -106,3 +106,18 @@ id f0(MDATestDocument *d) {
return d.instance.path; // expected-error {{property 'path' cannot be found in forward class object 'MDAInstance'}}
}
+// rdar://20469452
+ at interface UIView @end
+
+ at interface FRFakeBannerView : UIView
+ at end
+
+ at interface FRAdCollectionViewCell
+ at property (nonatomic, weak, readonly) UIView *bannerView;
+ at end
+
+ at interface FRAdCollectionViewCell ()
+
+ at property (nonatomic, weak, readwrite) FRFakeBannerView *bannerView;
+
+ at end
More information about the cfe-commits
mailing list