From: Steve Naroff Date: Mon, 20 Oct 2008 22:53:06 +0000 (+0000) Subject: Fix Parser rejects property (dot notation) access on id... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=18bc164e649bfc1909102e16d3d99836da65da4a;p=clang Fix Parser rejects property (dot notation) access on id. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57850 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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 view; + Cls *c; + + c.inEyeDropperMode = 1; + view.inEyeDropperMode = 1; +} +@end