Skip to content

Use swift_getErrorValue() unless Objective-C is available. #922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Testing/SourceAttribution/Backtrace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ extension Backtrace {
/// - errorAddress: The address of the error existential box.
init(_ errorAddress: UnsafeMutableRawPointer) {
_rawValue = errorAddress
#if SWT_TARGET_OS_APPLE
#if _runtime(_ObjC)
let error = Unmanaged<AnyObject>.fromOpaque(errorAddress).takeUnretainedValue() as! any Error
if type(of: error) is AnyObject.Type {
_rawValue = Unmanaged.passUnretained(error as AnyObject).toOpaque()
Expand Down Expand Up @@ -336,7 +336,7 @@ extension Backtrace {
/// - Note: The underlying Foundation function is called (if present) the
/// first time the value of this property is read.
static let isFoundationCaptureEnabled = {
#if SWT_TARGET_OS_APPLE && !SWT_NO_DYNAMIC_LINKING
#if _runtime(_ObjC) && !SWT_NO_DYNAMIC_LINKING
if Environment.flag(named: "SWT_FOUNDATION_ERROR_BACKTRACING_ENABLED") == true {
let _CFErrorSetCallStackCaptureEnabled = symbol(named: "_CFErrorSetCallStackCaptureEnabled").map {
unsafeBitCast($0, to: (@convention(c) (DarwinBoolean) -> DarwinBoolean).self)
Expand Down
4 changes: 2 additions & 2 deletions Sources/_TestingInternals/include/WillThrow.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ typedef void (* SWT_SENDABLE SWTWillThrowTypedHandler)(void *error, const void *
/// ``SWTWillThrowTypedHandler``
SWT_EXTERN SWTWillThrowTypedHandler SWT_SENDABLE _Nullable swt_setWillThrowTypedHandler(SWTWillThrowTypedHandler SWT_SENDABLE _Nullable handler);

#if !defined(__APPLE__)
/// The result of `swift__getErrorValue()`.
#if defined(__swift__) && !defined(__OBJC__)
/// The result of `swift_getErrorValue()`.
///
/// For more information, see this type's declaration
/// [in the Swift repository](https://github.com/swiftlang/swift/blob/main/include/swift/Runtime/Error.h).
Expand Down