Fix API gen for objc_msgSend property of aggregate types

in Objective-c++ mode. Fixes radar 7986354.

llvm-svn: 103887
This commit is contained in:
Fariborz Jahanian 2010-05-15 23:05:52 +00:00
parent 932ce81fe9
commit e1b45a5e6b
2 changed files with 21 additions and 7 deletions

View File

@ -264,9 +264,11 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
LValue LV = EmitLValue(E->getArg(0)); LValue LV = EmitLValue(E->getArg(0));
llvm::Value *This; llvm::Value *This;
if (LV.isPropertyRef()) { if (LV.isPropertyRef()) {
RValue RV = EmitLoadOfPropertyRefLValue(LV, E->getArg(0)->getType()); llvm::Value *AggLoc = CreateMemTemp(E->getArg(0)->getType());
assert (!RV.isScalar() && "EmitCXXOperatorMemberCallExpr"); EmitAggExpr(E->getArg(1), AggLoc, false /*VolatileDest*/);
This = RV.getAggregateAddr(); EmitObjCPropertySet(LV.getPropertyRefExpr(),
RValue::getAggregate(AggLoc, false /*VolatileDest*/));
return RValue::getAggregate(0, false);
} }
else else
This = LV.getAddress(); This = LV.getAddress();
@ -285,9 +287,11 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
LValue LV = EmitLValue(E->getArg(0)); LValue LV = EmitLValue(E->getArg(0));
llvm::Value *This; llvm::Value *This;
if (LV.isPropertyRef()) { if (LV.isPropertyRef()) {
RValue RV = EmitLoadOfPropertyRefLValue(LV, E->getArg(0)->getType()); llvm::Value *AggLoc = CreateMemTemp(E->getArg(0)->getType());
assert (!RV.isScalar() && "EmitCXXOperatorMemberCallExpr"); EmitAggExpr(E->getArg(1), AggLoc, false /*VolatileDest*/);
This = RV.getAggregateAddr(); EmitObjCPropertySet(LV.getPropertyRefExpr(),
RValue::getAggregate(AggLoc, false /*VolatileDest*/));
return RValue::getAggregate(0, false);
} }
else else
This = LV.getAddress(); This = LV.getAddress();

View File

@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - | FileCheck %s
// CHECK-NOT: callq _objc_msgSend_stret
// CHECK: call void @_ZN1SC1ERKS_ // CHECK: call void @_ZN1SC1ERKS_
// CHECK: call %class.S* @_ZN1SaSERKS_ // CHECK: call %class.S* @_ZN1SaSERKS_
// CHECK: call %class.S* @_ZN6CGRectaSERKS_ // CHECK: call %class.S* @_ZN6CGRectaSERKS_
@ -20,15 +21,24 @@ struct CGRect {
} }
@property(assign, nonatomic) S position; @property(assign, nonatomic) S position;
@property CGRect bounds; @property CGRect bounds;
@property CGRect frame;
- (void)setFrame:(CGRect)frameRect;
- (CGRect)frame;
- (void) initWithOwner; - (void) initWithOwner;
@end @end
@implementation I @implementation I
@synthesize position; @synthesize position;
@synthesize bounds; @synthesize bounds;
@synthesize frame;
- (void)setFrame:(CGRect)frameRect {}
- (CGRect)frame {return bounds;}
- (void)initWithOwner { - (void)initWithOwner {
I* _labelLayer;
CGRect labelLayerFrame = self.bounds; CGRect labelLayerFrame = self.bounds;
labelLayerFrame = self.bounds; labelLayerFrame = self.bounds;
_labelLayer.frame = labelLayerFrame;
} }
@end @end