Fixed a property getter ir-gen crash.

llvm-svn: 80681
This commit is contained in:
Fariborz Jahanian 2009-09-01 17:02:21 +00:00
parent 1543d133db
commit 1a50477385
3 changed files with 25 additions and 2 deletions

View File

@ -1026,8 +1026,9 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
if (PTy->getPointeeType()->isUnionType())
isUnion = true;
CVRQualifiers = PTy->getPointeeType().getCVRQualifiers();
} else if (isa<ObjCPropertyRefExpr>(BaseExpr) ||
isa<ObjCImplicitSetterGetterRefExpr>(BaseExpr)) {
} else if (isa<ObjCPropertyRefExpr>(BaseExpr->IgnoreParens()) ||
isa<ObjCImplicitSetterGetterRefExpr>(
BaseExpr->IgnoreParens())) {
RValue RV = EmitObjCPropertyGet(BaseExpr);
BaseValue = RV.getAggregateAddr();
if (BaseExpr->getType()->isUnionType())

View File

@ -327,6 +327,7 @@ RValue CodeGenFunction::EmitObjCSuperPropertyGet(const Expr *Exp,
}
RValue CodeGenFunction::EmitObjCPropertyGet(const Expr *Exp) {
Exp = Exp->IgnoreParens();
// FIXME: Split it into two separate routines.
if (const ObjCPropertyRefExpr *E = dyn_cast<ObjCPropertyRefExpr>(Exp)) {
Selector S = E->getProperty()->getGetterName();

View File

@ -15,3 +15,24 @@ typedef struct {
}
@end
typedef struct _NSSize {
float width;
float height;
} NSSize;
@interface AnObject
{
NSSize size;
}
@property NSSize size;
@end
float f ()
{
AnObject* obj;
return (obj.size).width;
}