aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-05-24 18:29:41 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-05-24 18:29:41 +0000
commitd5f1bd247630a19d2882fe9cf5777bd0da5edb67 (patch)
tree1a75c504da818a9f84e891dbb9257d87416d0241 /lib/Sema/SemaExprObjC.cpp
parent811ee0ed128403617e7944d370c71c822ce5a93d (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157407 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r--lib/Sema/SemaExprObjC.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index d3b803ab93..52e093c85b 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -1415,7 +1415,8 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
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 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
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)