File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
test/Interop/SwiftToCxx/stdlib Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -622,7 +622,8 @@ static bool isOptionalForeignReferenceType(Type ty) {
622
622
if (auto obj = ty->getOptionalObjectType ()) {
623
623
if (const auto *cd =
624
624
dyn_cast_or_null<ClassDecl>(obj->getNominalOrBoundGenericNominal ()))
625
- return cd->isForeignReferenceType ();
625
+ return cd->isForeignReferenceType () ||
626
+ cd->getForeignClassKind () == ClassDecl::ForeignKind::CFType;
626
627
}
627
628
return false ;
628
629
}
@@ -1780,7 +1781,8 @@ bool DeclAndTypeClangFunctionPrinter::hasKnownOptionalNullableCxxMapping(
1780
1781
return typeInfo->canBeNullable ;
1781
1782
}
1782
1783
if (const auto *cd = dyn_cast<ClassDecl>(nominal))
1783
- if (cd->isForeignReferenceType ())
1784
+ if (cd->isForeignReferenceType () ||
1785
+ cd->getForeignClassKind () == ClassDecl::ForeignKind::CFType)
1784
1786
return true ;
1785
1787
return isa_and_nonnull<clang::ObjCInterfaceDecl>(nominal->getClangDecl ());
1786
1788
}
Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ public func foobar(_ a: CFData) -> Bool {
16
16
true
17
17
}
18
18
19
+ public func returnsCFDate( ) -> CFDate ? {
20
+ nil
21
+ }
22
+
23
+ public func takesCFDate( x: CFDate ? ) { }
24
+
19
25
public func networkThing( ) -> in_addr ? {
20
26
return nil
21
27
}
@@ -25,4 +31,9 @@ public enum MyEnum {
25
31
}
26
32
27
33
// CHECK: SWIFT_EXTERN bool $s17UseCoreFoundation6foobarySbSo9CFDataRefaF(CFDataRef _Nonnull a) SWIFT_NOEXCEPT SWIFT_CALL; // foobar(_:)
34
+ // CHECK: SWIFT_EXTERN CFDateRef _Nullable $s17UseCoreFoundation13returnsCFDateSo0E3RefaSgyF(void) SWIFT_NOEXCEPT SWIFT_CALL; // returnsCFDate()
35
+ // CHECK: SWIFT_EXTERN void $s17UseCoreFoundation11takesCFDate1xySo0E3RefaSg_tF(CFDateRef _Nullable x) SWIFT_NOEXCEPT SWIFT_CALL; // takesCFDate(x:)
36
+
28
37
// CHECK: SWIFT_INLINE_THUNK swift::Optional<in_addr> networkThing() noexcept SWIFT_SYMBOL("s:17UseCoreFoundation12networkThingSo7in_addrVSgyF") SWIFT_WARN_UNUSED_RESULT {
38
+ // CHECK: SWIFT_INLINE_THUNK CFDateRef _Nullable returnsCFDate() noexcept SWIFT_SYMBOL("s:17UseCoreFoundation13returnsCFDateSo0E3RefaSgyF") SWIFT_WARN_UNUSED_RESULT {
39
+ // CHECK: SWIFT_INLINE_THUNK void takesCFDate(CFDateRef _Nullable x) noexcept SWIFT_SYMBOL("s:17UseCoreFoundation11takesCFDate1xySo0E3RefaSg_tF") {
You can’t perform that action at this time.
0 commit comments