Fix crash when synthesizing property setters when the property type and ivar
type have mismatched Objective-C types.
- <rdar://problem/7336352> [irgen] crash in synthesized property construction
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85275 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenObjC/synthesize_ivar.m b/test/CodeGenObjC/synthesize_ivar.m
index 7646f70..e1746f1 100644
--- a/test/CodeGenObjC/synthesize_ivar.m
+++ b/test/CodeGenObjC/synthesize_ivar.m
@@ -1,8 +1,6 @@
// RUN: clang-cc -triple x86_64-apple-darwin10 -emit-llvm -o %t %s
@interface I
-{
-}
@property int IP;
@end
@@ -25,3 +23,16 @@
@implementation OrganizerViolatorView
@synthesize bindingInfo;
@end
+
+// <rdar://problem/7336352> [irgen] crash in synthesized property construction
+
+@interface I0 @end
+@protocol P0 @end
+@interface I1 {
+ I0<P0> *iv0;
+}
+@property (assign, readwrite) id p0;
+@end
+@implementation I1
+@synthesize p0 = iv0;
+@end
diff --git a/test/Coverage/objc-language-features.inc b/test/Coverage/objc-language-features.inc
index dd57dfb..dbbf205 100644
--- a/test/Coverage/objc-language-features.inc
+++ b/test/Coverage/objc-language-features.inc
@@ -14,6 +14,7 @@
@interface A : Root <P1> {
int iv0;
B *iv1;
+ B<P1> *iv2;
}
@property(readonly) int p0;
@@ -21,11 +22,16 @@
@property(copy) id p2;
@property(retain) id p3;
@property(assign, getter=getme, setter=setme:) id p4;
+@property(assign, readwrite) id p5;
@end
@implementation A
@dynamic p0;
@synthesize p1 = iv0;
+
+// Property type can differ from ivar type.
+@synthesize p5 = iv2;
+
+(void) fm0 {
[super fm0];
}