Fix a code gen. bug involving generation of getter method

from properties of _Complex type. (radar 7351147).

llvm-svn: 99558
This commit is contained in:
Fariborz Jahanian 2010-03-25 21:56:43 +00:00
parent 91d2774416
commit f9c4585c80
2 changed files with 22 additions and 2 deletions

View File

@ -201,7 +201,12 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP,
EmitReturnOfRValue(RV, PD->getType());
} else {
LValue LV = EmitLValueForIvar(TypeOfSelfObject(), LoadObjCSelf(), Ivar, 0);
if (hasAggregateLLVMType(Ivar->getType())) {
if (Ivar->getType()->isAnyComplexType()) {
ComplexPairTy Pair = LoadComplexFromAddr(LV.getAddress(),
LV.isVolatileQualified());
StoreComplexToAddr(Pair, ReturnValue, LV.isVolatileQualified());
}
else if (hasAggregateLLVMType(Ivar->getType())) {
EmitAggregateCopy(ReturnValue, LV.getAddress(), Ivar->getType());
} else {
CodeGenTypes &Types = CGM.getTypes();

View File

@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s
// rdar: // 7351147
@interface A
@ -15,3 +15,18 @@ void f0(A *a) {
// CHECK-LP64: internal global [13 x i8] c"COMPLEX_PROP
// CHECK-LP64: internal global [17 x i8] c"setCOMPLEX_PROP
// rdar: // 7351147
@interface B
@property (assign) _Complex float f_complex_ivar;
@end
@implementation B
@synthesize f_complex_ivar = _f_complex_ivar;
-(void) unary_f_complex: (_Complex float) a0 {
self.f_complex_ivar = a0;
}
@end