forked from OSchip/llvm-project
Code gen for aggregate-valued properties and a test case.
llvm-svn: 60122
This commit is contained in:
parent
397a11ccd8
commit
57251782d0
|
@ -187,10 +187,13 @@ void CodeGenFunction::GenerateObjCGetter(const ObjCPropertyImplDecl *PID) {
|
|||
Types.ConvertType(PD->getType())));
|
||||
EmitReturnOfRValue(RV, PD->getType());
|
||||
} else {
|
||||
EmitReturnOfRValue(EmitLoadOfLValue(EmitLValueForIvar(LoadObjCSelf(),
|
||||
Ivar, 0),
|
||||
Ivar->getType()),
|
||||
PD->getType());
|
||||
LValue LV = EmitLValueForIvar(LoadObjCSelf(), Ivar, 0);
|
||||
if (hasAggregateLLVMType(Ivar->getType())) {
|
||||
EmitAggregateCopy(ReturnValue, LV.getAddress(), Ivar->getType());
|
||||
}
|
||||
else
|
||||
EmitReturnOfRValue(EmitLoadOfLValue(LV, Ivar->getType()),
|
||||
PD->getType());
|
||||
}
|
||||
|
||||
FinishFunction();
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
// RUN: clang -emit-llvm -o %t %s
|
||||
|
||||
@interface Object
|
||||
- (id) new;
|
||||
@end
|
||||
|
||||
typedef struct {int x, y, w, h;} st1;
|
||||
typedef struct {int x, y, w, h;} st2;
|
||||
|
||||
@interface bar : Object
|
||||
- (void)setFrame:(st1)frameRect;
|
||||
@end
|
||||
|
||||
@interface bar1 : Object
|
||||
- (void)setFrame:(int)frameRect;
|
||||
@end
|
||||
|
||||
@interface foo : Object
|
||||
{
|
||||
st2 ivar;
|
||||
}
|
||||
@property (assign) st2 frame;
|
||||
@end
|
||||
|
||||
@implementation foo
|
||||
@synthesize frame = ivar;
|
||||
@end
|
||||
|
||||
extern void abort();
|
||||
|
||||
static st2 r = {1,2,3,4};
|
||||
st2 test (void)
|
||||
{
|
||||
foo *obj = [foo new];
|
||||
id objid = [foo new];;
|
||||
|
||||
obj.frame = r;
|
||||
|
||||
((foo*)objid).frame = obj.frame;
|
||||
|
||||
return ((foo*)objid).frame;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
st2 res = test ();
|
||||
if (res.x != 1 || res.h != 4)
|
||||
abort();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue