| 1 |
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -x objective-c %s.result |
| 2 |
// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-gc-only -no-finalize-removal -x objective-c %s > %t |
| 3 |
// RUN: diff %t %s.result |
| 4 |
// RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-gc-only -no-finalize-removal -x objective-c++ %s > %t |
| 5 |
// RUN: diff %t %s.result |
| 6 |
|
| 7 |
#include "Common.h" |
| 8 |
#include "GC.h" |
| 9 |
|
| 10 |
void test1(CFTypeRef *cft) { |
| 11 |
id x = NSMakeCollectable(cft); |
| 12 |
} |
| 13 |
|
| 14 |
@interface I1 |
| 15 |
@end |
| 16 |
|
| 17 |
@implementation I1 |
| 18 |
-(void)dealloc { |
| 19 |
// dealloc |
| 20 |
test1(0); |
| 21 |
} |
| 22 |
|
| 23 |
-(void)finalize { |
| 24 |
// finalize |
| 25 |
test1(0); |
| 26 |
} |
| 27 |
@end |
| 28 |
|
| 29 |
@interface I2 |
| 30 |
@property (retain) id prop; |
| 31 |
@end |
| 32 |
|
| 33 |
@implementation I2 |
| 34 |
@synthesize prop; |
| 35 |
|
| 36 |
-(void)finalize { |
| 37 |
self.prop = 0; |
| 38 |
// finalize |
| 39 |
test1(0); |
| 40 |
} |
| 41 |
@end |
| 42 |
|
| 43 |
__attribute__((objc_arc_weak_reference_unavailable)) |
| 44 |
@interface QQ { |
| 45 |
__weak id s; |
| 46 |
__weak QQ *q; |
| 47 |
} |
| 48 |
@end |
| 49 |
|
| 50 |
@interface I3 |
| 51 |
@property (assign) I3 *__weak pw1, *__weak pw2; |
| 52 |
@property (assign) I3 *__strong ps; |
| 53 |
@property (assign) I3 * pds; |
| 54 |
@end |
| 55 |
|
| 56 |
@interface I4Impl { |
| 57 |
I4Impl *pds2; |
| 58 |
I4Impl *pds3; |
| 59 |
__weak I4Impl *pw3; |
| 60 |
__weak I4Impl *pw4; |
| 61 |
} |
| 62 |
@property (assign) I4Impl *__weak pw1, *__weak pw2; |
| 63 |
@property (assign) I4Impl *__strong ps; |
| 64 |
@property (assign) I4Impl * pds; |
| 65 |
@property (assign) I4Impl * pds2; |
| 66 |
@property (readwrite) I4Impl * pds3; |
| 67 |
@property (readonly) I4Impl * pds4; |
| 68 |
@property (readonly) __weak I4Impl *pw3; |
| 69 |
@property (assign) __weak I4Impl *pw4; |
| 70 |
@end |
| 71 |
|
| 72 |
@implementation I4Impl |
| 73 |
@synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4; |
| 74 |
|
| 75 |
-(void)test1:(CFTypeRef *)cft { |
| 76 |
id x = NSMakeCollectable(cft); |
| 77 |
} |
| 78 |
@end |
| 79 |
|
| 80 |
@interface rdar10532449 |
| 81 |
@property (assign) id assign_prop; |
| 82 |
@property (assign, readonly) id __strong strong_readonly_prop; |
| 83 |
@property (assign) id __weak weak_prop; |
| 84 |
@end |
| 85 |
|
| 86 |
@implementation rdar10532449 |
| 87 |
@synthesize assign_prop, strong_readonly_prop, weak_prop; |
| 88 |
@end |