Skip to content

Commit 23111df

Browse files
authored
Merge pull request #64284 from hyp/eng/hide-error-apis-inteorp
[interop][SwiftToCxx] hide swift::Error APIs by default in C++ Swift …
2 parents 9b492d8 + 75fd11c commit 23111df

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

lib/PrintAsClang/_SwiftStdlibCxxOverlay.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ SWIFT_INLINE_THUNK cxxOverlay::IterationEndSentinel end(const Array<T> &) {
124124
return {};
125125
}
126126

127+
#ifdef SWIFT_CXX_INTEROP_EXPERIMENTAL_SWIFT_ERROR
128+
127129
extern "C" void *_Nonnull swift_errorRetain(void *_Nonnull swiftError) noexcept;
128130

129131
extern "C" void swift_errorRelease(void *_Nonnull swiftError) noexcept;
@@ -405,5 +407,6 @@ template <class T> using ThrowingResult = swift::Expected<T>;
405407
#endif
406408

407409
#endif // SWIFT_CXX_INTEROP_HIDE_SWIFT_ERROR
410+
#endif // SWIFT_CXX_INTEROP_EXPERIMENTAL_SWIFT_ERROR
408411

409412
#endif

test/Interop/SwiftToCxx/functions/swift-expected-execution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// RUN: %target-swift-frontend %S/swift-functions-errors.swift -typecheck -module-name Functions -Xcc -fno-exceptions -enable-experimental-cxx-interop -clang-header-expose-decls=has-expose-attr-or-stdlib -enable-experimental-feature GenerateBindingsForThrowingFunctionsInCXX -emit-clang-header-path %t/functions.h
44

5-
// RUN: %target-interop-build-clangxx -c %s -I %t -fno-exceptions -o %t/swift-expected-execution.o
5+
// RUN: %target-interop-build-clangxx -c %s -I %t -fno-exceptions -o %t/swift-expected-execution.o -DSWIFT_CXX_INTEROP_EXPERIMENTAL_SWIFT_ERROR
66
// RUN: %target-interop-build-swift %S/swift-functions-errors.swift -o %t/swift-expected-execution -Xlinker %t/swift-expected-execution.o -module-name Functions -Xfrontend -entry-point-function-name -Xfrontend swiftMain -enable-experimental-feature GenerateBindingsForThrowingFunctionsInCXX
77

88
// RUN: %target-codesign %t/swift-expected-execution

test/Interop/SwiftToCxx/functions/swift-functions-errors-execution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// RUN: %target-swift-frontend %S/swift-functions-errors.swift -typecheck -module-name Functions -enable-experimental-cxx-interop -clang-header-expose-decls=has-expose-attr-or-stdlib -enable-experimental-feature GenerateBindingsForThrowingFunctionsInCXX -emit-clang-header-path %t/functions.h
44

5-
// RUN: %target-interop-build-clangxx -c %s -I %t -o %t/swift-functions-errors-execution.o
5+
// RUN: %target-interop-build-clangxx -c %s -I %t -o %t/swift-functions-errors-execution.o -DSWIFT_CXX_INTEROP_EXPERIMENTAL_SWIFT_ERROR
66
// 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 -enable-experimental-feature GenerateBindingsForThrowingFunctionsInCXX
77

88
// RUN: %target-codesign %t/swift-functions-errors-execution

test/Interop/SwiftToCxx/functions/swift-functions-errors.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %target-swift-frontend %s -typecheck -module-name Functions -enable-experimental-cxx-interop -clang-header-expose-decls=has-expose-attr-or-stdlib -enable-experimental-feature GenerateBindingsForThrowingFunctionsInCXX -emit-clang-header-path %t/functions.h
33
// RUN: %FileCheck %s < %t/functions.h
44

5-
// RUN: %check-interop-cxx-header-in-clang(%t/functions.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -Wno-unused-function)
5+
// RUN: %check-interop-cxx-header-in-clang(%t/functions.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -DSWIFT_CXX_INTEROP_EXPERIMENTAL_SWIFT_ERROR -Wno-unused-function)
66

77
// for experimental feature GenerateBindingsForThrowingFunctionsInCXX:
88
// REQUIRES: asserts

0 commit comments

Comments
 (0)