aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/CGExpr.cpp5
-rw-r--r--lib/CodeGen/CGObjC.cpp1
-rw-r--r--test/CodeGenObjC/property-agrr-getter.m21
3 files changed, 25 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 48326ee832..43120156f8 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -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())
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 8c0c225d1a..5899912981 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -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();
diff --git a/test/CodeGenObjC/property-agrr-getter.m b/test/CodeGenObjC/property-agrr-getter.m
index 0e9b040b1b..4620579693 100644
--- a/test/CodeGenObjC/property-agrr-getter.m
+++ b/test/CodeGenObjC/property-agrr-getter.m
@@ -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;
+}