diff options
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 8 | ||||
-rw-r--r-- | test/CodeGenObjC/property-agrr-getter.m | 17 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 20a7693faf..2d51efa474 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -802,6 +802,14 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) { isUnion = true; CVRQualifiers = PTy->getPointeeType().getCVRQualifiers(); } + else if (BaseExpr->getStmtClass() == Expr::ObjCPropertyRefExprClass || + BaseExpr->getStmtClass() == Expr::ObjCKVCRefExprClass) { + RValue RV = EmitObjCPropertyGet(BaseExpr); + BaseValue = RV.getAggregateAddr(); + if (BaseExpr->getType()->isUnionType()) + isUnion = true; + CVRQualifiers = BaseExpr->getType().getCVRQualifiers(); + } else { LValue BaseLV = EmitLValue(BaseExpr); if (BaseLV.isObjCIvar()) diff --git a/test/CodeGenObjC/property-agrr-getter.m b/test/CodeGenObjC/property-agrr-getter.m new file mode 100644 index 0000000000..903dcc7e97 --- /dev/null +++ b/test/CodeGenObjC/property-agrr-getter.m @@ -0,0 +1,17 @@ +// RUN: clang -emit-llvm -o %t %s + +typedef struct { + unsigned f0; +} s0; + +@interface A +- (s0) f0; +@end + +@implementation A +-(s0) f0{} +- (unsigned) bar { + return self.f0.f0; +} +@end + |