Setting hardcode SWIFT_NOEXCEPT and noexcept flags only to

non-throwing functions.
Activating swift-functions-errors tests
Inserting macros and additional parameters in C and C++ functions following the pattern to lowering to LLVM IR.
This commit is contained in:
Roberto Rosmaninho
2022-06-22 13:58:58 -03:00
parent d128d81ea5
commit ff222acebc
11 changed files with 153 additions and 35 deletions

View File

@@ -8,14 +8,12 @@
// CHECK-LABEL: namespace _impl {
// CHECK: SWIFT_EXTERN void $s9Functions18emptyThrowFunctionyyKF(void) SWIFT_CALL; // emptyThrowFunction()
// CHECK: SWIFT_EXTERN void $s9Functions13throwFunctionyyKF(void) SWIFT_CALL; // throwFunction()
// CHECK: SWIFT_EXTERN void $s9Functions18emptyThrowFunctionyyKF(SWIFT_CONTEXT void * _Nonnull _self, SWIFT_ERROR_RESULT void ** _error) SWIFT_CALL; // emptyThrowFunction()
// CHECK: SWIFT_EXTERN void $s9Functions13throwFunctionyyKF(SWIFT_CONTEXT void * _Nonnull _self, SWIFT_ERROR_RESULT void ** _error) SWIFT_CALL; // throwFunction()
// CHECK: }
//XFAIL: *
enum NaiveErrors: Error {
enum NaiveErrors : Error {
case returnError
case throwError
}
@@ -23,7 +21,9 @@ enum NaiveErrors: Error {
public func emptyThrowFunction() throws { print("passEmptyThrowFunction") }
// CHECK: inline void emptyThrowFunction() {
// CHECK: return _impl::$s9Functions18emptyThrowFunctionyyKF();
// CHECK: void* opaqueError = nullptr;
// CHECK: void* self = nullptr;
// CHECK: return _impl::$s9Functions18emptyThrowFunctionyyKF(self, &opaqueError);
// CHECK: }
public func throwFunction() throws {
@@ -32,5 +32,7 @@ public func throwFunction() throws {
}
// CHECK: inline void throwFunction() {
// CHECK: return _impl::$s9Functions13throwFunctionyyKF();
// CHECK: }
// CHECK: void* opaqueError = nullptr;
// CHECK: void* self = nullptr;
// CHECK: return _impl::$s9Functions13throwFunctionyyKF(self, &opaqueError);
// CHECK: }