blob: c04cbab40369914eedc2d6ad2b7cf3521d08cf98 [file] [log] [blame]
Fariborz Jahanian5bfc5362010-01-25 20:50:02 +00001// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
2// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
3// radar 7575882
4
5@interface F {
6 int supervar;
7}
8@end
9
10@interface G : F {
11@public
12 int ivar;
13}
14@end
15
16@implementation G
17- (void)foo:(F *)arg {
18 int q = arg->supervar;
19 int v = ((G *)arg)->ivar;
20}
21@end
22
Fariborz Jahaniana5d5fbc2010-01-26 00:29:22 +000023void objc_assign_strongCast(id);
24void __CFAssignWithWriteBarrier(void **location, void *value) {
25 objc_assign_strongCast((id)value);
26}
27
Fariborz Jahanian2b9b0b22010-02-05 01:35:00 +000028// radar 7607605
29@interface RealClass {
30 @public
31 int f;
32}
33@end
34
35@implementation RealClass
36@end
37
38@interface Foo {
39 id reserved;
40}
41@end
42
43@implementation Foo
44- (void)bar {
45 ((RealClass*)reserved)->f = 99;
46}
47@end
48
Fariborz Jahanian5bfc5362010-01-25 20:50:02 +000049// CHECK-LP: ((struct G_IMPL *)arg)->ivar
50
Fariborz Jahaniana5d5fbc2010-01-26 00:29:22 +000051// CHECK-LP: objc_assign_strongCast((id)value)
Fariborz Jahanian2b9b0b22010-02-05 01:35:00 +000052
53// CHECK-LP: ((struct RealClass_IMPL *)((RealClass *)((struct Foo_IMPL *)self)->reserved))->f