| 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 = CFBridgingRelease(cft); |
| 12 |
} |
| 13 |
|
| 14 |
@interface I1 |
| 15 |
@end |
| 16 |
|
| 17 |
@implementation I1 |
| 18 |
-(void)dealloc { |
| 19 |
// dealloc |
| 20 |
test1(0); |
| 21 |
} |
| 22 |
|
| 23 |
#if !__has_feature(objc_arc) |
| 24 |
-(void)finalize { |
| 25 |
// finalize |
| 26 |
test1(0); |
| 27 |
} |
| 28 |
#endif |
| 29 |
@end |
| 30 |
|
| 31 |
@interface I2 |
| 32 |
@property (strong) id prop; |
| 33 |
@end |
| 34 |
|
| 35 |
@implementation I2 |
| 36 |
@synthesize prop; |
| 37 |
|
| 38 |
#if !__has_feature(objc_arc) |
| 39 |
-(void)finalize { |
| 40 |
self.prop = 0; |
| 41 |
// finalize |
| 42 |
test1(0); |
| 43 |
} |
| 44 |
#endif |
| 45 |
-(void)dealloc { |
| 46 |
// finalize |
| 47 |
test1(0); |
| 48 |
} |
| 49 |
@end |
| 50 |
|
| 51 |
__attribute__((objc_arc_weak_reference_unavailable)) |
| 52 |
@interface QQ { |
| 53 |
__weak id s; |
| 54 |
__unsafe_unretained QQ *q; |
| 55 |
} |
| 56 |
@end |
| 57 |
|
| 58 |
@interface I3 |
| 59 |
@property (weak) I3 * pw1, * pw2; |
| 60 |
@property (strong) I3 * ps; |
| 61 |
@property (assign) I3 * pds; |
| 62 |
@end |
| 63 |
|
| 64 |
@interface I4Impl { |
| 65 |
I4Impl *__strong pds2; |
| 66 |
I4Impl *pds3; |
| 67 |
__weak I4Impl *pw3; |
| 68 |
__weak I4Impl *pw4; |
| 69 |
} |
| 70 |
@property (weak) I4Impl * pw1, * pw2; |
| 71 |
@property (strong) I4Impl * ps; |
| 72 |
@property (strong) I4Impl * pds; |
| 73 |
@property (strong) I4Impl * pds2; |
| 74 |
@property (readwrite) I4Impl * pds3; |
| 75 |
@property (readonly) I4Impl * pds4; |
| 76 |
@property (weak, readonly) I4Impl *pw3; |
| 77 |
@property (weak) I4Impl *pw4; |
| 78 |
@end |
| 79 |
|
| 80 |
@implementation I4Impl |
| 81 |
@synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4; |
| 82 |
|
| 83 |
-(void)test1:(CFTypeRef *)cft { |
| 84 |
id x = CFBridgingRelease(cft); |
| 85 |
} |
| 86 |
@end |
| 87 |
|
| 88 |
@interface rdar10532449 |
| 89 |
@property (strong) id assign_prop; |
| 90 |
@property (strong, readonly) id strong_readonly_prop; |
| 91 |
@property (weak) id weak_prop; |
| 92 |
@end |
| 93 |
|
| 94 |
@implementation rdar10532449 |
| 95 |
@synthesize assign_prop, strong_readonly_prop, weak_prop; |
| 96 |
@end |