mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 06:06:34 +08:00
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:
@@ -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();
|
||||
|
||||
12
clang/test/CodeGenObjC/objc2-retain-codegen.m
Normal file
12
clang/test/CodeGenObjC/objc2-retain-codegen.m
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user