aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-03-03 18:49:40 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-03-03 18:49:40 +0000
commited1d29d62595a83ccf6ef23eb2759d355206df2e (patch)
tree9c8cd3f02a2cb5ce23376772661905164a57178e /lib/CodeGen/CGObjC.cpp
parent6076e0a65183e52dd118e34f62bc2adc056a54e1 (diff)
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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65955 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r--lib/CodeGen/CGObjC.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index cebaa1eb03..5798865077 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -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();