Objective-C++ Code gen. Handle code gen. for property

reference dot-syntax notation in a varierty of cases.
Fixes radar 7964490.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103440 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2010-05-10 22:57:35 +00:00
Родитель 45d9c2d2b1
Коммит b3ebe946d3
3 изменённых файлов: 33 добавлений и 2 удалений

Просмотреть файл

@ -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:

Просмотреть файл

@ -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);

Просмотреть файл

@ -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() {