File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
test/Interop/SwiftToCxx/functions Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -1110,6 +1110,12 @@ class DeclAndTypePrinter::Implementation
1110
1110
1111
1111
void visitFuncDecl (FuncDecl *FD) {
1112
1112
if (outputLang == OutputLanguageMode::Cxx) {
1113
+ // Don't expose async functions or transparent functions
1114
+ // because they're currently unsupported
1115
+ if (FD->hasAsync () || FD->isTransparent ()) {
1116
+ return ;
1117
+ }
1118
+
1113
1119
// Emit the underlying C signature that matches the Swift ABI
1114
1120
// in the generated C++ implementation prologue for the module.
1115
1121
auto funcABI = getModuleProloguePrinter ()
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-swift-frontend %s -typecheck -module-name Functions -clang-header-expose-public-decls -emit-clang-header-path %t/functions.h
3
+ // RUN: %FileCheck %s < %t/functions.h
4
+
5
+ // RUN: %check-interop-cxx-header-in-clang(%t/functions.h)
6
+
7
+ // CHECK-NOT: SWIFT_EXTERN double $s9Functions10async_funcyS2dYaF(double x) SWIFT_NOEXCEPT SWIFT_CALL; // async_func(_:)
8
+ // CHECK-NOT: SWIFT_EXTERN bool $s9Functions16transparent_funcyS2bF(bool x) SWIFT_NOEXCEPT SWIFT_CALL; // transparent_func(_:)
9
+
10
+ // CHECK: namespace Functions {
11
+ // CHECK-EMPTY:
12
+ // CHECK-EMPTY:
13
+ // CHECK-EMPTY:
14
+ // CHECK-EMPTY:
15
+ // CHECK-EMPTY:
16
+ // CHECK-EMPTY:
17
+ // CHECK-NEXT: } // namespace Functions
18
+
19
+ // CHECK-NOT: inline double async_func(double x) noexcept SWIFT_WARN_UNUSED_RESULT {
20
+ // CHECK-NOT: return _impl::$s9Functions10async_funcyS2dYaF(x);
21
+ // CHECK-NOT: }
22
+
23
+ // CHECK-NOT: inline bool transparent_func(bool x) noexcept SWIFT_WARN_UNUSED_RESULT {
24
+ // CHECK-NOT: return _impl::$s9Functions16transparent_funcyS2bF(x);
25
+ // CHECK-NOT: }
26
+
27
+ public func async_func( _ x: Double ) async -> Double { return 2 * x }
28
+
29
+ @_transparent
30
+ public func transparent_func( _ x: Bool ) -> Bool { return !x }
You can’t perform that action at this time.
0 commit comments