MRCBase.m 1008 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #include "MRCBase.h"
  9. #include "test.h"
  10. // MRCBase->alignment ensures that there is a gap between the end of
  11. // NSObject's ivars and the start of MRCBase's ivars, which exercises
  12. // handling of storage that is not represented in any class's ivar
  13. // layout bitmaps.
  14. #if __has_feature(objc_arc_weak)
  15. bool supportsMRCWeak = true;
  16. #else
  17. bool supportsMRCWeak = false;
  18. #endif
  19. @interface MRCBase () {
  20. @private
  21. double DOUBLEWORD_ALIGNED alignment;
  22. uintptr_t pad[3]; // historically this made OBJC2 layout bitmaps match OBJC1
  23. double number;
  24. id object;
  25. void *pointer;
  26. #if __has_feature(objc_arc_weak)
  27. __weak
  28. #endif
  29. id delegate;
  30. }
  31. @end
  32. @implementation MRCBase
  33. @synthesize number, object, pointer, delegate;
  34. @end
  35. // Call object_copy from MRC.
  36. extern id __attribute__((ns_returns_retained))
  37. docopy(id obj)
  38. {
  39. return object_copy(obj, 0);
  40. }