зеркало из https://github.com/microsoft/clang-1.git
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:
Родитель
45d9c2d2b1
Коммит
b3ebe946d3
|
@ -1670,7 +1670,16 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
|
||||||
MakeQualifiers(E->getType()));
|
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_ConstructorConversion:
|
||||||
case CastExpr::CK_UserDefinedConversion:
|
case CastExpr::CK_UserDefinedConversion:
|
||||||
case CastExpr::CK_AnyPointerToObjCPointerCast:
|
case CastExpr::CK_AnyPointerToObjCPointerCast:
|
||||||
|
|
|
@ -261,7 +261,16 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
|
||||||
if (ClassDecl->hasTrivialCopyAssignment()) {
|
if (ClassDecl->hasTrivialCopyAssignment()) {
|
||||||
assert(!ClassDecl->hasUserDeclaredCopyAssignment() &&
|
assert(!ClassDecl->hasUserDeclaredCopyAssignment() &&
|
||||||
"EmitCXXOperatorMemberCallExpr - user declared copy assignment");
|
"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();
|
llvm::Value *Src = EmitLValue(E->getArg(1)).getAddress();
|
||||||
QualType Ty = E->getType();
|
QualType Ty = E->getType();
|
||||||
EmitAggregateCopy(This, Src, Ty);
|
EmitAggregateCopy(This, Src, Ty);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
|
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
|
||||||
// CHECK: call void @_ZN1SC1ERKS_
|
// CHECK: call void @_ZN1SC1ERKS_
|
||||||
// CHECK: call %class.S* @_ZN1SaSERKS_
|
// CHECK: call %class.S* @_ZN1SaSERKS_
|
||||||
|
// CHECK: call %class.S* @_ZN6CGRectaSERKS_
|
||||||
|
|
||||||
class S {
|
class S {
|
||||||
public:
|
public:
|
||||||
|
@ -9,14 +10,26 @@ public:
|
||||||
S ();
|
S ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CGRect {
|
||||||
|
CGRect & operator = (const CGRect &);
|
||||||
|
};
|
||||||
|
|
||||||
@interface I {
|
@interface I {
|
||||||
S position;
|
S position;
|
||||||
|
CGRect bounds;
|
||||||
}
|
}
|
||||||
@property(assign, nonatomic) S position;
|
@property(assign, nonatomic) S position;
|
||||||
|
@property CGRect bounds;
|
||||||
|
- (void) initWithOwner;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation I
|
@implementation I
|
||||||
@synthesize position;
|
@synthesize position;
|
||||||
|
@synthesize bounds;
|
||||||
|
- (void)initWithOwner {
|
||||||
|
CGRect labelLayerFrame = self.bounds;
|
||||||
|
labelLayerFrame = self.bounds;
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче