llvm-project
93 строки · 1.9 Кб
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 -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 -x objective-c++ %s > %t
5// RUN: diff %t %s.result
6
7#include "Common.h"
8#include "GC.h"
9
10void test1(CFTypeRef *cft) {
11id x = NSMakeCollectable(cft);
12}
13
14@interface I1
15@end
16
17@implementation I1
18-(void)dealloc {
19// dealloc
20test1(0);
21}
22
23-(void)finalize {
24// finalize
25test1(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 {
37self.prop = 0;
38// finalize
39test1(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 {
57I4Impl *pds2;
58I4Impl *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 {
76id 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
89
90void test2(id p, __strong I1 *ap[]) {
91for (__strong I1 *specRule in p) {
92}
93}
94