@@ -289,7 +289,7 @@ CFHashRef CFSetCreateCopy(CFAllocatorRef allocator, CFHashRef other) {
289
289
__CFGenericValidateType (other , typeID );
290
290
Boolean markImmutable = false;
291
291
CFBasicHashRef ht = NULL ;
292
- if (CF_IS_OBJC (typeID , other )) {
292
+ if (CF_IS_OBJC (typeID , other ) || CF_IS_SWIFT ( typeID , other ) ) {
293
293
if (objc_collectingEnabled ()) {
294
294
CFIndex numValues = CFSetGetCount (other );
295
295
const_any_pointer_t vbuffer [256 ], kbuffer [256 ];
@@ -313,7 +313,11 @@ CFHashRef CFSetCreateCopy(CFAllocatorRef allocator, CFHashRef other) {
313
313
}
314
314
else { // non-GC
315
315
#if CFDictionary || CFSet
316
+ #if DEPLOYMENT_RUNTIME_SWIFT
317
+ ht = (CFBasicHashRef )CF_SWIFT_CALLV (other , NSSet .copy );
318
+ #else
316
319
ht = (CFBasicHashRef )CF_OBJC_CALLV ((id )other , copyWithZone :NULL);
320
+ #endif
317
321
#elif CFBag
318
322
CFIndex numValues = CFSetGetCount (other );
319
323
const_any_pointer_t vbuffer [256 ];
@@ -349,7 +353,7 @@ CFMutableHashRef CFSetCreateMutableCopy(CFAllocatorRef allocator, CFIndex capaci
349
353
__CFGenericValidateType (other , typeID );
350
354
CFAssert (0 <= capacity , __kCFLogAssertion , "%s(): capacity (%ld) cannot be less than zero" , __PRETTY_FUNCTION__ , capacity );
351
355
CFBasicHashRef ht = NULL ;
352
- if (CF_IS_OBJC (typeID , other )) {
356
+ if (CF_IS_OBJC (typeID , other ) || CF_IS_SWIFT ( typeID , other ) ) {
353
357
CFIndex numValues = CFSetGetCount (other );
354
358
const_any_pointer_t vbuffer [256 ], kbuffer [256 ];
355
359
const_any_pointer_t * vlist = (numValues <= 256 ) ? vbuffer : (const_any_pointer_t * )CFAllocatorAllocate (kCFAllocatorSystemDefault , numValues * sizeof (const_any_pointer_t ), 0 );
@@ -382,6 +386,7 @@ CFIndex CFSetGetCount(CFHashRef hc) {
382
386
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), CFIndex , (NSDictionary * )hc , count );
383
387
#endif
384
388
#if CFSet
389
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), CFIndex , (CFSwiftRef )hc , NSSet .count );
385
390
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), CFIndex , (NSSet * )hc , count );
386
391
#endif
387
392
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -398,6 +403,7 @@ CFIndex CFSetGetCountOfValue(CFHashRef hc, const_any_pointer_t key) {
398
403
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), CFIndex , (NSDictionary * )hc , countForKey :(id )key );
399
404
#endif
400
405
#if CFSet
406
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), CFIndex , (CFSwiftRef )hc , NSSet .countForValue , key );
401
407
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), CFIndex , (NSSet * )hc , countForObject :(id )key );
402
408
#endif
403
409
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -414,6 +420,7 @@ Boolean CFSetContainsValue(CFHashRef hc, const_any_pointer_t key) {
414
420
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), char , (NSDictionary * )hc , containsKey :(id )key );
415
421
#endif
416
422
#if CFSet
423
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), char , (CFSwiftRef )hc , NSSet .containsValue , key );
417
424
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), char , (NSSet * )hc , containsObject :(id )key );
418
425
#endif
419
426
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -425,6 +432,7 @@ const_any_pointer_t CFSetGetValue(CFHashRef hc, const_any_pointer_t key) {
425
432
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), const_any_pointer_t , (NSDictionary * )hc , objectForKey :(id )key );
426
433
#endif
427
434
#if CFSet
435
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), CFTypeRef , (CFSwiftRef )hc , NSSet .getValue , key );
428
436
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), const_any_pointer_t , (NSSet * )hc , member :(id )key );
429
437
#endif
430
438
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -437,6 +445,7 @@ Boolean CFSetGetValueIfPresent(CFHashRef hc, const_any_pointer_t key, const_any_
437
445
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), Boolean , (NSDictionary * )hc , __getValue :(id * )value forKey :(id )key );
438
446
#endif
439
447
#if CFSet
448
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), Boolean , (CFSwiftRef )hc , NSSet .getValueIfPresent , key , value );
440
449
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), Boolean , (NSSet * )hc , __getValue :(id * )value forObj :(id )key );
441
450
#endif
442
451
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -495,6 +504,7 @@ void CFSetGetValues(CFHashRef hc, const_any_pointer_t *keybuf) {
495
504
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSDictionary * )hc , getObjects :(id * )valuebuf andKeys :(id * )keybuf );
496
505
#endif
497
506
#if CFSet
507
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), void , (CFSwiftRef )hc , NSSet .getValues , keybuf );
498
508
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSSet * )hc , getObjects :(id * )keybuf );
499
509
#endif
500
510
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -522,6 +532,7 @@ void CFSetApplyFunction(CFHashRef hc, CFSetApplierFunction applier, any_pointer_
522
532
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSDictionary * )hc , __apply :(void (* )(const void * , const void * , void * ))applier context :(void * )context );
523
533
#endif
524
534
#if CFSet
535
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), void , (CFSwiftRef )hc , NSSet .apply , applier , context );
525
536
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSSet * )hc , __applyValues :(void (* )(const void * , void * ))applier context :(void * )context );
526
537
#endif
527
538
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -601,6 +612,7 @@ void CFSetAddValue(CFMutableHashRef hc, const_any_pointer_t key) {
601
612
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSMutableDictionary * )hc , __addObject :(id )value forKey :(id )key );
602
613
#endif
603
614
#if CFSet
615
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), void , (CFSwiftRef )hc , NSMutableSet .addValue , key );
604
616
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSMutableSet * )hc , addObject :(id )key );
605
617
#endif
606
618
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -624,6 +636,7 @@ void CFSetReplaceValue(CFMutableHashRef hc, const_any_pointer_t key) {
624
636
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSMutableDictionary * )hc , replaceObject :(id )value forKey :(id )key );
625
637
#endif
626
638
#if CFSet
639
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), void , (CFSwiftRef )hc , NSMutableSet .replaceValue , key );
627
640
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSMutableSet * )hc , replaceObject :(id )key );
628
641
#endif
629
642
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -647,6 +660,7 @@ void CFSetSetValue(CFMutableHashRef hc, const_any_pointer_t key) {
647
660
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSMutableDictionary * )hc , __setObject :(id )value forKey :(id )key );
648
661
#endif
649
662
#if CFSet
663
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), void , (CFSwiftRef )hc , NSMutableSet .setValue , key );
650
664
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSMutableSet * )hc , setObject :(id )key );
651
665
#endif
652
666
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -665,6 +679,7 @@ void CFSetRemoveValue(CFMutableHashRef hc, const_any_pointer_t key) {
665
679
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSMutableDictionary * )hc , removeObjectForKey :(id )key );
666
680
#endif
667
681
#if CFSet
682
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), void , (CFSwiftRef )hc , NSMutableSet .removeValue , key );
668
683
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSMutableSet * )hc , removeObject :(id )key );
669
684
#endif
670
685
__CFGenericValidateType (hc , CFSetGetTypeID ());
@@ -682,6 +697,7 @@ void CFSetRemoveAllValues(CFMutableHashRef hc) {
682
697
if (CFDictionary ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSMutableDictionary * )hc , removeAllObjects );
683
698
#endif
684
699
#if CFSet
700
+ if (CFSet ) CF_SWIFT_FUNCDISPATCHV (CFSetGetTypeID (), void , (CFSwiftRef )hc , NSMutableSet .removeAllValues );
685
701
if (CFSet ) CF_OBJC_FUNCDISPATCHV (CFSetGetTypeID (), void , (NSMutableSet * )hc , removeAllObjects );
686
702
#endif
687
703
__CFGenericValidateType (hc , CFSetGetTypeID ());
0 commit comments