aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-10-20 22:53:06 +0000
committerSteve Naroff <snaroff@apple.com>2008-10-20 22:53:06 +0000
commit18bc164e649bfc1909102e16d3d99836da65da4a (patch)
tree292701da61961d02c6b7d6fb02e8c862ac2c4b9c
parent87f3b93423062c343a35714517517a52cc9da4a5 (diff)
Fix <rdar://problem/6268365> Parser rejects property (dot notation) access on id<protocol>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57850 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp10
-rw-r--r--test/SemaObjC/property-9.m20
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 1f885165cd..5ff8b0e59f 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -999,7 +999,15 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
MemberLoc, BaseExpr);
}
}
-
+ // Handle properties on qualified "id" protocols.
+ const ObjCQualifiedIdType *QIdTy;
+ if (OpKind == tok::period && (QIdTy = BaseType->getAsObjCQualifiedIdType())) {
+ // Check protocols on qualified interfaces.
+ for (ObjCQualifiedIdType::qual_iterator I = QIdTy->qual_begin(),
+ E = QIdTy->qual_end(); I != E; ++I)
+ if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(&Member))
+ return new ObjCPropertyRefExpr(PD, PD->getType(), MemberLoc, BaseExpr);
+ }
// Handle 'field access' to vectors, such as 'V.xx'.
if (BaseType->isExtVectorType() && OpKind == tok::period) {
// Component access limited to variables (reject vec4.rg.g).
diff --git a/test/SemaObjC/property-9.m b/test/SemaObjC/property-9.m
index a1f29e6f98..03c2ba05ae 100644
--- a/test/SemaObjC/property-9.m
+++ b/test/SemaObjC/property-9.m
@@ -62,3 +62,23 @@ typedef signed char BOOL;
@end
+@protocol PVImageViewProtocol
+@property int inEyeDropperMode;
+@end
+
+@interface Cls
+@property int inEyeDropperMode;
+@end
+
+@interface PVAdjustColor @end
+
+@implementation PVAdjustColor
+
+- xx {
+ id <PVImageViewProtocol> view;
+ Cls *c;
+
+ c.inEyeDropperMode = 1;
+ view.inEyeDropperMode = 1;
+}
+@end