]> granicus.if.org Git - clang/commitdiff
Fix a code gen. bug involving generation of getter method
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 25 Mar 2010 21:56:43 +0000 (21:56 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 25 Mar 2010 21:56:43 +0000 (21:56 +0000)
from properties of _Complex type. (radar 7351147).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99558 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjC.cpp
test/CodeGenObjC/complex-property.m

index 3ff77f0170c1cf90dc510b5189a7f1dd153db0d5..f40b3d705d2b57d64d13c8b4eefb90d6256cd5cb 100644 (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();
index bd3bfea94b549a83e52fed125772bef86db12aec..5a2b78b5977a983fe9761a4f9cb4c9e6ac9a0406 100644 (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
+