[cfe-commits] r99558 - in /cfe/trunk: lib/CodeGen/CGObjC.cpp test/CodeGenObjC/complex-property.m
Fariborz Jahanian
fjahanian at apple.com
Thu Mar 25 14:56:44 PDT 2010
Author: fjahanian
Date: Thu Mar 25 16:56:43 2010
New Revision: 99558
URL: http://llvm.org/viewvc/llvm-project?rev=99558&view=rev
Log:
Fix a code gen. bug involving generation of getter method
from properties of _Complex type. (radar 7351147).
Modified:
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/test/CodeGenObjC/complex-property.m
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=99558&r1=99557&r2=99558&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Thu Mar 25 16:56:43 2010
@@ -201,7 +201,12 @@
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();
Modified: cfe/trunk/test/CodeGenObjC/complex-property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/complex-property.m?rev=99558&r1=99557&r2=99558&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/complex-property.m (original)
+++ cfe/trunk/test/CodeGenObjC/complex-property.m Thu Mar 25 16:56:43 2010
@@ -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 @@
// CHECK-LP64: internal global [13 x i8] c"COMPLEX_PROP
// CHECK-LP64: internal global [17 x i8] c"setCOMPLEX_PROP
+
+// rdar: // 7351147
+ at interface B
+ at property (assign) _Complex float f_complex_ivar;
+ at end
+
+ at implementation B
+
+ at synthesize f_complex_ivar = _f_complex_ivar;
+-(void) unary_f_complex: (_Complex float) a0 {
+ self.f_complex_ivar = a0;
+}
+
+ at end
+
More information about the cfe-commits
mailing list