Fix <rdar://problem/6268365> Parser rejects property (dot notation) access on id<protocol>.

llvm-svn: 57850
This commit is contained in:
Steve Naroff 2008-10-20 22:53:06 +00:00
parent 7e721ecd21
commit bca9fd755d
2 changed files with 29 additions and 1 deletions

View File

@ -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).

View File

@ -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