diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-01-12 23:27:26 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-01-12 23:27:26 +0000 |
commit | 30e7864661ffff4ad2c7b542401dbc2172529660 (patch) | |
tree | 15a00c03bcad1fdafb6daf94c3e3c688e91d5b0f | |
parent | b3730b50c70c4b5cdb4b28fee7c98fee491f3a0d (diff) | |
download | bcm5719-llvm-30e7864661ffff4ad2c7b542401dbc2172529660.tar.gz bcm5719-llvm-30e7864661ffff4ad2c7b542401dbc2172529660.zip |
Patch to implement code gen for aggrgate-valued property used
to access a field of its type.
llvm-svn: 62123
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 8 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/property-agrr-getter.m | 17 |
2 files changed, 25 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 20a7693faf6..2d51efa474e 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/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/clang/test/CodeGenObjC/property-agrr-getter.m b/clang/test/CodeGenObjC/property-agrr-getter.m new file mode 100644 index 00000000000..903dcc7e970 --- /dev/null +++ b/clang/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 + |