2 #include "swift-class-def.m"
4 SWIFT_CLASS(RealSwiftDylib1A, NSObject, nop);
5 SWIFT_STUB_CLASS(SwiftDylib1A, initSwiftDylib1A);
7 SWIFT_CLASS(RealSwiftDylib1B, NSObject, nop);
8 SWIFT_STUB_CLASS(SwiftDylib1B, initSwiftDylib1B);
12 @interface SwiftDylib1A: NSObject @end
13 @interface SwiftDylib1B: NSObject @end
15 @implementation SwiftDylib1A (Category)
16 - (const char *)dylib1ACategoryInSameDylib { return "dylib1ACategoryInSameDylib"; }
18 @implementation SwiftDylib1B (Category)
19 - (const char *)dylib1BCategoryInSameDylib { return "dylib1BCategoryInSameDylib"; }
22 EXTERN_C Class initSwiftDylib1A(Class cls, void *arg)
25 testassert(arg == nil);
26 testassert(cls == RawSwiftDylib1A);
28 if (Dylib1AInits == 1)
29 _objc_realizeClassFromSwift(RawRealSwiftDylib1A, cls);
31 return RawRealSwiftDylib1A;
36 EXTERN_C Class initSwiftDylib1B(Class cls, void *arg)
39 testassert(arg == nil);
40 testassert(cls == RawSwiftDylib1B);
42 if (Dylib1BInits == 1)
43 _objc_realizeClassFromSwift(RawRealSwiftDylib1B, cls);
45 return RawRealSwiftDylib1B;
48 EXTERN_C Class objc_loadClassref(_Nullable Class * _Nonnull clsref);
50 void Dylib1Test(void) {
51 testassert((uintptr_t)SwiftDylib1AClassref & 1);
52 Class SwiftDylib1A = objc_loadClassref(&SwiftDylib1AClassref);
53 testassert(((uintptr_t)SwiftDylib1AClassref & 1) == 0);
54 testassert(SwiftDylib1A == [SwiftDylib1A class]);
55 testassert(SwiftDylib1A == SwiftDylib1AClassref);
56 testassert(Dylib1AInits == 2);
58 testassert((uintptr_t)SwiftDylib1BClassref & 1);
59 Class SwiftDylib1B = objc_loadClassref(&SwiftDylib1BClassref);
60 testassert(((uintptr_t)SwiftDylib1BClassref & 1) == 0);
61 testassert(SwiftDylib1B == [SwiftDylib1B class]);
62 testassert(SwiftDylib1B == SwiftDylib1BClassref);
63 testassert(Dylib1BInits == 2);