Skip to content

Commit

Permalink
Add compile-time check for macho_arch_name_for_mach_header_reexported
Browse files Browse the repository at this point in the history
  • Loading branch information
Gleb Tarasov committed Nov 30, 2023
1 parent 26b1906 commit 70bc712
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions PerformanceSuite/Sources/HangInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public struct HangInfo: Codable {
/// because main binaries currently can have only arm64.
/// System binaries can be arm64 or arm64e.
private static let currentArchitecture: String? = {
#if swift(>=5.9)
if #available(iOS 16, *) {
if let archName = macho_arch_name_for_mach_header_reexported() {
return String(cString: archName)
Expand All @@ -90,6 +91,12 @@ public struct HangInfo: Codable {
return String(cString: name)
}
}
#else
let info = NXGetLocalArchInfo()
if let name = info?.pointee.name {
return String(cString: name)
}
#endif
return nil
}()

Expand Down

0 comments on commit 70bc712

Please sign in to comment.