3 #include <Foundation/NSObject.h>
4 #include <objc/runtime.h>
5 #include <objc/objc-internal.h>
11 // rdar://8350188 External references (handles)
13 id object = [NSObject new];
17 objc_xref_t xref = _object_addExternalReference(object, OBJC_XREF_STRONG);
19 testassert(_object_readExternalReference(xref) == object);
20 _object_removeExternalReference(xref);
21 // TODO: expect a crash if a stale xref is used.
24 xref = _object_addExternalReference(object, OBJC_XREF_WEAK);
26 testassert(_object_readExternalReference(xref) == object);
27 _object_removeExternalReference(xref);