summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-05-10 22:57:35 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-05-10 22:57:35 +0000
commit43a40f9399ac6d084abbef47a80d7ea69a837cf5 (patch)
tree9af82af2d7b5980a6fa788a790e5fd74ef6cd017
parent1a0df9a80ea82b94178a3500fbf52649df40c86e (diff)
downloadbcm5719-llvm-43a40f9399ac6d084abbef47a80d7ea69a837cf5.tar.gz
bcm5719-llvm-43a40f9399ac6d084abbef47a80d7ea69a837cf5.zip
Objective-C++ Code gen. Handle code gen. for property
reference dot-syntax notation in a varierty of cases. Fixes radar 7964490. llvm-svn: 103440
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp11
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp11
-rw-r--r--clang/test/CodeGenObjCXX/property-objects.mm13
3 files changed, 33 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 9ade916f42b..8b8b65932b1 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -1670,7 +1670,16 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
MakeQualifiers(E->getType()));
}
- case CastExpr::CK_NoOp:
+ case CastExpr::CK_NoOp: {
+ LValue LV = EmitLValue(E->getSubExpr());
+ // FIXME. assign a meaningfull cast kind.
+ if (LV.isPropertyRef()) {
+ RValue RV = EmitLoadOfPropertyRefLValue(LV, E->getSubExpr()->getType());
+ llvm::Value *V = RV.isScalar() ? RV.getScalarVal() : RV.getAggregateAddr();
+ return LValue::MakeAddr(V, MakeQualifiers(E->getSubExpr()->getType()));
+ }
+ return LV;
+ }
case CastExpr::CK_ConstructorConversion:
case CastExpr::CK_UserDefinedConversion:
case CastExpr::CK_AnyPointerToObjCPointerCast:
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 5714a3e4f13..2b0938ab84b 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -261,7 +261,16 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
if (ClassDecl->hasTrivialCopyAssignment()) {
assert(!ClassDecl->hasUserDeclaredCopyAssignment() &&
"EmitCXXOperatorMemberCallExpr - user declared copy assignment");
- llvm::Value *This = EmitLValue(E->getArg(0)).getAddress();
+ LValue LV = EmitLValue(E->getArg(0));
+ llvm::Value *This;
+ if (LV.isPropertyRef()) {
+ RValue RV = EmitLoadOfPropertyRefLValue(LV, E->getArg(0)->getType());
+ assert (!RV.isScalar() && "EmitCXXOperatorMemberCallExpr");
+ This = RV.getAggregateAddr();
+ }
+ else
+ This = LV.getAddress();
+
llvm::Value *Src = EmitLValue(E->getArg(1)).getAddress();
QualType Ty = E->getType();
EmitAggregateCopy(This, Src, Ty);
diff --git a/clang/test/CodeGenObjCXX/property-objects.mm b/clang/test/CodeGenObjCXX/property-objects.mm
index cd327c22ca2..a4cae087d30 100644
--- a/clang/test/CodeGenObjCXX/property-objects.mm
+++ b/clang/test/CodeGenObjCXX/property-objects.mm
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// CHECK: call void @_ZN1SC1ERKS_
// CHECK: call %class.S* @_ZN1SaSERKS_
+// CHECK: call %class.S* @_ZN6CGRectaSERKS_
class S {
public:
@@ -9,14 +10,26 @@ public:
S ();
};
+struct CGRect {
+ CGRect & operator = (const CGRect &);
+};
+
@interface I {
S position;
+ CGRect bounds;
}
@property(assign, nonatomic) S position;
+@property CGRect bounds;
+- (void) initWithOwner;
@end
@implementation I
@synthesize position;
+@synthesize bounds;
+- (void)initWithOwner {
+ CGRect labelLayerFrame = self.bounds;
+ labelLayerFrame = self.bounds;
+}
@end
int main() {
OpenPOWER on IntegriCloud