File tree Expand file tree Collapse file tree 2 files changed +63
-0
lines changed
test/Interop/SwiftToCxx/functions Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+
3
+ // RUN: %target-swift-frontend %S/swift-functions-errors.swift -typecheck -module-name Functions -clang-header-expose-public-decls -emit-clang-header-path %t/functions.h
4
+
5
+ // RUN: %target-interop-build-clangxx -c %s -I %t -o %t/swift-functions-errors-execution.o
6
+ // RUN: %target-interop-build-swift %S/swift-functions-errors.swift -o %t/swift-functions-errors-execution -Xlinker %t/swift-functions-errors-execution.o -module-name Functions -Xfrontend -entry-point-function-name -Xfrontend swiftMain
7
+
8
+ // RUN: %target-codesign %t/swift-functions-errors-execution
9
+ // RUN: %target-run %t/swift-functions-errors-execution | %FileCheck %s
10
+
11
+ // REQUIRES: executable_test
12
+ // XFAIL: *
13
+
14
+ #include < cassert>
15
+ #include " functions.h"
16
+
17
+ int main () {
18
+ static_assert (!noexcept (Functions::emptyThrowFunction ()), " noexcept function" );
19
+ static_assert (!noexcept (Functions::throwFunction ()), " noexcept function" );
20
+
21
+ Functions::emptyThrowFunction ();
22
+ Functions::throwFunction ();
23
+ return 0 ;
24
+ }
25
+
26
+ // CHECK: passEmptyThrowFunction
27
+ // CHECK-NEXT: passThrowFunction
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-LABEL: namespace Functions {
8
+
9
+ // CHECK-LABEL: namespace _impl {
10
+
11
+ // CHECK: SWIFT_EXTERN void $s9Functions18emptyThrowFunctionyyKF(void) SWIFT_CALL; // emptyThrowFunction()
12
+ // CHECK: SWIFT_EXTERN void $s9Functions13throwFunctionyyKF(void) SWIFT_CALL; // throwFunction()
13
+
14
+ // CHECK: }
15
+
16
+ //XFAIL: *
17
+
18
+ enum NaiveErrors : Error {
19
+ case returnError
20
+ case throwError
21
+ }
22
+
23
+ public func emptyThrowFunction( ) throws { print ( " passEmptyThrowFunction " ) }
24
+
25
+ // CHECK: inline void emptyThrowFunction() {
26
+ // CHECK: return _impl::$s9Functions18emptyThrowFunctionyyKF();
27
+ // CHECK: }
28
+
29
+ public func throwFunction( ) throws {
30
+ print ( " passThrowFunction " )
31
+ throw NaiveErrors . throwError
32
+ }
33
+
34
+ // CHECK: inline void throwFunction() {
35
+ // CHECK: return _impl::$s9Functions13throwFunctionyyKF();
36
+ // CHECK: }
You can’t perform that action at this time.
0 commit comments