]> git.saurik.com Git - apple/objc4.git/blob - test/MRCBase.m
objc4-818.2.tar.gz
[apple/objc4.git] / test / MRCBase.m
1 //
2 // MRCBase.m
3 // TestARCLayouts
4 //
5 // Created by Patrick Beard on 3/8/11.
6 // Copyright 2011 __MyCompanyName__. All rights reserved.
7 //
8
9 #include "MRCBase.h"
10 #include "test.h"
11
12 // MRCBase->alignment ensures that there is a gap between the end of
13 // NSObject's ivars and the start of MRCBase's ivars, which exercises
14 // handling of storage that is not represented in any class's ivar
15 // layout bitmaps.
16
17 #if __has_feature(objc_arc_weak)
18 bool supportsMRCWeak = true;
19 #else
20 bool supportsMRCWeak = false;
21 #endif
22
23 @interface MRCBase () {
24 @private
25 double DOUBLEWORD_ALIGNED alignment;
26 uintptr_t pad[3]; // historically this made OBJC2 layout bitmaps match OBJC1
27 double number;
28 id object;
29 void *pointer;
30 #if __has_feature(objc_arc_weak)
31 __weak
32 #endif
33 id delegate;
34 }
35 @end
36
37 @implementation MRCBase
38 @synthesize number, object, pointer, delegate;
39 @end
40
41 // Call object_copy from MRC.
42 extern id __attribute__((ns_returns_retained))
43 docopy(id obj)
44 {
45 return object_copy(obj, 0);
46 }