GC.m revision 12192cf50a96cb59a3039af044b7fa97f043101c
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) {
11  id x = NSMakeCollectable(cft);
12}
13
14@interface I1 {
15  __strong I1 *myivar;
16}
17@end
18
19@implementation I1
20-(void)dealloc {
21  // dealloc
22  test1(0);
23}
24
25-(void)finalize {
26  // finalize
27  test1(0);
28}
29@end
30
31@interface I2
32@property (retain) id prop;
33@end
34
35@implementation I2
36@synthesize prop;
37
38-(void)finalize {
39  self.prop = 0;
40  // finalize
41  test1(0);
42}
43@end
44
45__attribute__((objc_arc_weak_reference_unavailable))
46@interface QQ {
47  __weak id s;
48  __weak QQ *q;
49}
50@end
51