Fixed an ir-gen bug in syntheszing a getter function

with property type which does not match its ivar and
in -fobjc-gc-only mode!

llvm-svn: 65955
This commit is contained in:
Fariborz Jahanian 2009-03-03 18:49:40 +00:00
parent 5340b248b4
commit eab5ecd8e0
2 changed files with 19 additions and 3 deletions

View File

@ -205,9 +205,13 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP,
if (hasAggregateLLVMType(Ivar->getType())) {
EmitAggregateCopy(ReturnValue, LV.getAddress(), Ivar->getType());
}
else
EmitReturnOfRValue(EmitLoadOfLValue(LV, Ivar->getType()),
PD->getType());
else {
CodeGenTypes &Types = CGM.getTypes();
RValue RV = EmitLoadOfLValue(LV, Ivar->getType());
RV = RValue::get(Builder.CreateBitCast(RV.getScalarVal(),
Types.ConvertType(PD->getType())));
EmitReturnOfRValue(RV, PD->getType());
}
}
FinishFunction();

View File

@ -0,0 +1,12 @@
// RUN: clang -triple x86_64-unknown-unknown -fobjc-gc-only -emit-llvm -o %t %s
@interface I0 {
I0 *_f0;
}
@property (retain) id p0;
@end
@implementation I0
@synthesize p0 = _f0;
@end