[cfe-commits] r57850 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaObjC/property-9.m
Steve Naroff
snaroff at apple.com
Mon Oct 20 15:53:06 PDT 2008
Author: snaroff
Date: Mon Oct 20 17:53:06 2008
New Revision: 57850
URL: http://llvm.org/viewvc/llvm-project?rev=57850&view=rev
Log:
Fix <rdar://problem/6268365> Parser rejects property (dot notation) access on id<protocol>.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaObjC/property-9.m
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=57850&r1=57849&r2=57850&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Oct 20 17:53:06 2008
@@ -999,7 +999,15 @@
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).
Modified: cfe/trunk/test/SemaObjC/property-9.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-9.m?rev=57850&r1=57849&r2=57850&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-9.m (original)
+++ cfe/trunk/test/SemaObjC/property-9.m Mon Oct 20 17:53:06 2008
@@ -62,3 +62,23 @@
@end
+ at protocol PVImageViewProtocol
+ at property int inEyeDropperMode;
+ at end
+
+ at interface Cls
+ at property int inEyeDropperMode;
+ at end
+
+ at interface PVAdjustColor @end
+
+ at implementation PVAdjustColor
+
+- xx {
+ id <PVImageViewProtocol> view;
+ Cls *c;
+
+ c.inEyeDropperMode = 1;
+ view.inEyeDropperMode = 1;
+}
+ at end
More information about the cfe-commits
mailing list