[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-commits
Subject: [cfe-commits] r56838 - /cfe/trunk/lib/Sema/SemaDeclObjC.cpp
From: Steve Naroff <snaroff () apple ! com>
Date: 2008-09-30 10:07:56
Message-ID: 200809301007.m8UA7uxU032394 () zion ! cs ! uiuc ! edu
[Download RAW message or body]
Author: snaroff
Date: Tue Sep 30 05:07:56 2008
New Revision: 56838
URL: http://llvm.org/viewvc/llvm-project?rev=56838&view=rev
Log:
Improved fix for <rdar://problem/6247781> Parser rejecting properly mismatched \
properties. Needed to make sure the relaxed type checking only applies to "readonly" \
properties.
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=56838&r1=56837&r2=56838&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Sep 30 05:07:56 2008
@@ -1254,13 +1254,18 @@
PropertyId->getName());
return 0;
}
+ QualType PropType = Context.getCanonicalType(property->getType());
+ QualType IvarType = Context.getCanonicalType(Ivar->getType());
+
// Check that type of property and its ivar are type compatible.
- // A property is allowed to be a sub-class of the instance variable type.
- if (CheckAssignmentConstraints(property->getType(),
- Ivar->getType()) != Compatible) {
- Diag(PropertyLoc, diag::error_property_ivar_type, property->getName(),
- Ivar->getName());
- return 0;
+ if (PropType != IvarType) {
+ // A readonly property is allowed to be a sub-class of the ivar type.
+ if (!property->isReadOnly() ||
+ CheckAssignmentConstraints(PropType, IvarType) != Compatible) {
+ Diag(PropertyLoc, diag::error_property_ivar_type, property->getName(),
+ Ivar->getName());
+ return 0;
+ }
}
} else if (PropertyIvar) {
// @dynamic
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic