[cfe-commits] r157407 - in /cfe/trunk: lib/Sema/SemaExprObjC.cpp test/SemaObjC/property-user-setter.m
Fariborz Jahanian
fjahanian at apple.com
Thu May 24 11:29:41 PDT 2012
Author: fjahanian
Date: Thu May 24 13:29:41 2012
New Revision: 157407
URL: http://llvm.org/viewvc/llvm-project?rev=157407&view=rev
Log:
objective-c: Fixes a corner case and interesting bug.
Where diagnostic about unfound property is not
issued in the context where a setter is looked up
in situation in which name and property name differ
in their first letter case. // rdar://11363363
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/property-user-setter.m
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=157407&r1=157406&r2=157407&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Thu May 24 13:29:41 2012
@@ -1415,7 +1415,8 @@
return ExprError();
// Search for a declared property first.
- if (ObjCPropertyDecl *PD = IFace->FindPropertyDeclaration(Member)) {
+ ObjCPropertyDecl *PD = IFace->FindPropertyDeclaration(Member);
+ if (PD) {
// Check whether we can reference this property.
if (DiagnoseUseOfDecl(PD, MemberLoc))
return ExprError();
@@ -1483,6 +1484,10 @@
SelectorTable::constructSetterName(PP.getIdentifierTable(),
PP.getSelectorTable(), Member);
ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(SetterSel);
+ // Check for corner case of: @property int p; ... self.P = 0;
+ // setter name is synthesized "setP" but there is no property name 'P'.
+ if (Setter && Setter->isSynthesized() && !PD)
+ Setter = 0;
// May be founf in property's qualified list.
if (!Setter)
Modified: cfe/trunk/test/SemaObjC/property-user-setter.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-user-setter.m?rev=157407&r1=157406&r2=157407&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-user-setter.m (original)
+++ cfe/trunk/test/SemaObjC/property-user-setter.m Thu May 24 13:29:41 2012
@@ -102,3 +102,31 @@
abort ();
return 0;
}
+
+// rdar://11363363
+ at interface rdar11363363
+{
+ id R;
+}
+ at property (copy) id p;
+ at property (copy) id r;
+ at property (copy) id Q;
+ at property (copy) id t;
+ at property (copy) id T;
+ at end
+
+ at implementation rdar11363363
+ at synthesize p;
+ at synthesize r;
+ at synthesize Q;
+ at synthesize t, T;
+- (id) Meth {
+ self.P = 0; // expected-error {{property 'P' not found on object of type 'rdar11363363 *'}}
+ self.q = 0; // expected-error {{property 'q' not found on object of type 'rdar11363363 *'}}
+ self.t = 0; // OK
+ self.T = 0; // OK
+ self.R = 0; // expected-error {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access ivar 'R'?}}
+ return self.R; // expected-error {{property 'R' not found on object of type 'rdar11363363 *'; did you mean to access ivar 'R'?}}
+}
+ at end
+
More information about the cfe-commits
mailing list