[interop][SwiftToCxx] bridge Swift's Optional type in an experimental manner

This commit is contained in:
Alex Lorenz
2022-09-14 18:12:07 -07:00
parent b96bcb4691
commit 143ce1e682
5 changed files with 285 additions and 23 deletions

View File

@@ -2,7 +2,9 @@
// RUN: %target-swift-frontend -parse-as-library %platform-module-dir/Swift.swiftmodule/%module-target-triple.swiftinterface -enable-library-evolution -disable-objc-attr-requires-foundation-module -typecheck -module-name Swift -parse-stdlib -enable-experimental-cxx-interop -emit-clang-header-path %t/Swift.h -experimental-skip-all-function-bodies
// RUN: %FileCheck %s < %t/Swift.h
// RUN: %check-generic-interop-cxx-header-in-clang(%t/Swift.h -Wno-unused-private-field -Wno-unused-function)
// RUN: %check-generic-interop-cxx-header-in-clang(%t/Swift.h -Wno-unused-private-field -Wno-unused-function -Wno-shadow)
// FIXME: remove need for -Wno-shadow
// CHECK: namespace Swift {
@@ -24,6 +26,26 @@
// CHECK: inline swift::Int getCount() const;
// CHECK: inline swift::Int getCapacity() const;
// CHECK: template<class T_0_0>
// CHECK: template<class T_0_0>
// CHECK: template<class T_0_0>
// CHECK: template<class T_0_0>
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
// CHECK-NEXT: class Optional final {
// CHECK-NEXT: public:
// CHECK-NEXT: inline ~Optional() {
// CHECK: }
// CHECK-NEXT: inline Optional(const Optional &other) {
// CHECK: }
// CHECK: enum class cases {
// CHECK-NEXT: some,
// CHECK-NEXT: none
// CHECK-NEXT: };
// CHECK: inline bool isSome() const;
// CHECK: inline bool isNone() const;
// CHECK: inline T_0_0 getUnsafelyUnwrapped() const;
// CHECK: class String final {
// CHECK-NEXT: public:
// CHECK-NEXT: inline ~String() {