| 1 |
// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp |
| 2 |
// RUN: FileCheck -check-prefix CHECK-LP --input-file=%t-rw.cpp %s |
| 3 |
|
| 4 |
@interface F { |
| 5 |
int supervar; |
| 6 |
} |
| 7 |
@end |
| 8 |
|
| 9 |
@interface G : F { |
| 10 |
@public |
| 11 |
int ivar; |
| 12 |
} |
| 13 |
@end |
| 14 |
|
| 15 |
@implementation G |
| 16 |
- (void)foo:(F *)arg { |
| 17 |
int q = arg->supervar; |
| 18 |
int v = ((G *)arg)->ivar; |
| 19 |
} |
| 20 |
@end |
| 21 |
|
| 22 |
void objc_assign_strongCast(id); |
| 23 |
void __CFAssignWithWriteBarrier(void **location, void *value) { |
| 24 |
objc_assign_strongCast((id)value); |
| 25 |
} |
| 26 |
|
| 27 |
@interface RealClass { |
| 28 |
@public |
| 29 |
int f; |
| 30 |
} |
| 31 |
@end |
| 32 |
|
| 33 |
@implementation RealClass |
| 34 |
@end |
| 35 |
|
| 36 |
@interface Foo { |
| 37 |
id reserved; |
| 38 |
} |
| 39 |
@end |
| 40 |
|
| 41 |
@implementation Foo |
| 42 |
- (void)bar { |
| 43 |
((RealClass*)reserved)->f = 99; |
| 44 |
} |
| 45 |
@end |
| 46 |
|
| 47 |
// CHECK-LP: ((struct G_IMPL *)arg)->ivar |
| 48 |
|
| 49 |
// CHECK-LP: objc_assign_strongCast((id)value) |
| 50 |
|
| 51 |
// CHECK-LP: ((struct RealClass_IMPL *)((RealClass *)((struct Foo_IMPL *)self)->reserved))->f |