Skip to content

Commit

Permalink
Revert "one more thing"
Browse files Browse the repository at this point in the history
This reverts commit e8dfd3e.
  • Loading branch information
stephencelis committed Jun 13, 2024
1 parent e8dfd3e commit 60b61d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
18 changes: 5 additions & 13 deletions Sources/Perception/Internal/RuntimeWarning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func runtimeWarn(
#if canImport(os)
os_log(
.fault,
dso: dso,
dso: dso.value,
log: OSLog(subsystem: "com.apple.runtime-issues", category: category),
"%@",
message
Expand All @@ -28,8 +28,7 @@ func runtimeWarn(
#endif
}

#if !DEBUG
#else
#if DEBUG
import XCTestDynamicOverlay

#if canImport(os)
Expand All @@ -40,15 +39,8 @@ func runtimeWarn(
// To work around this, we hook into SwiftUI's runtime issue delivery mechanism, instead.
//
// Feedback filed: https://gist.github.com/stephencelis/a8d06383ed6ccde3e5ef5d1b3ad52bbc
#if swift(>=5.10)
@usableFromInline
nonisolated(unsafe) let dso = getSwiftUIDSO()
#else
@usableFromInline
let dso = getSwiftUIDSO()
#endif

private func getSwiftUIDSO() -> UnsafeMutableRawPointer {
@usableFromInline
let dso = UncheckedSendable<UnsafeMutableRawPointer>({
let count = _dyld_image_count()
for i in 0..<count {
if let name = _dyld_get_image_name(i) {
Expand All @@ -61,7 +53,7 @@ func runtimeWarn(
}
}
return UnsafeMutableRawPointer(mutating: #dsohandle)
}
}())
#else
import Foundation

Expand Down
6 changes: 3 additions & 3 deletions Sources/Perception/Internal/UncheckedSendable.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
struct UncheckedSendable<Value>: @unchecked Sendable {
let value: Value
init(_ value: Value) {
@usableFromInline struct UncheckedSendable<Value>: @unchecked Sendable {
@usableFromInline let value: Value
@usableFromInline init(_ value: Value) {
self.value = value
}
}

0 comments on commit 60b61d5

Please sign in to comment.