From 72cdffa401698cccd63279718109c5fbf4e8a689 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Sat, 24 Jul 2010 00:34:08 +0000 Subject: [PATCH] Return type of a setter call caused by use of property-dot syntax using 'super' as receiver is 'void'. This fixes a bug in generating correct API for setter call. Fixes radar 8203426. llvm-svn: 109297 --- clang/lib/CodeGen/CGObjC.cpp | 2 +- .../super-dotsyntax-struct-property.m | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 clang/test/CodeGenObjC/super-dotsyntax-struct-property.m diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index be060b42e1a6..62a118cb02e2 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -572,7 +572,7 @@ void CodeGenFunction::EmitObjCSuperPropertySet(const Expr *Exp, Args.push_back(std::make_pair(Src, Exp->getType())); CGM.getObjCRuntime().GenerateMessageSendSuper(*this, ReturnValueSlot(), - Exp->getType(), + getContext().VoidTy, S, OMD->getClassInterface(), isCategoryImpl, diff --git a/clang/test/CodeGenObjC/super-dotsyntax-struct-property.m b/clang/test/CodeGenObjC/super-dotsyntax-struct-property.m new file mode 100644 index 000000000000..aac4c1de06a3 --- /dev/null +++ b/clang/test/CodeGenObjC/super-dotsyntax-struct-property.m @@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm %s -o - | FileCheck %s +// rdar: // 8203426 + + +typedef double CGFloat; +struct CGPoint { + CGFloat x; + CGFloat y; +}; +typedef struct CGPoint CGPoint; + + + +struct CGSize { + CGFloat width; + CGFloat height; +}; +typedef struct CGSize CGSize; + + +struct CGRect { + CGPoint origin; + CGSize size; +}; +typedef struct CGRect CGRect; + +@interface UIView { +} +@property CGRect frame; +@end + +@interface crashclass : UIView { + +} + +@end + +@implementation crashclass +- (void)setFrame:(CGRect)frame +{ + super.frame = frame; + [super setFrame:frame]; +} + +@end +// CHECK-NOT: declare void @objc_msgSendSuper2_stret +// CHECK: declare i8* @objc_msgSendSuper2