Skip to content

Mark Triple and its nested types as Sendable #1579

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 3 commits into from
Apr 10, 2024
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/SwiftDriver/Utilities/Triple+Platforms.swift
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,9 @@ extension Triple {
/// `tripleVersion >= featureVersion`.
///
/// - SeeAlso: `Triple.supports(_:)`
public struct FeatureAvailability {
public struct FeatureAvailability: Sendable {

public enum Availability {
public enum Availability: Sendable {
case unavailable
case available(since: Version)
case availableInAllVersions
Expand Down
24 changes: 12 additions & 12 deletions Sources/SwiftDriver/Utilities/Triple.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
///
/// This is a port of https://github.com/apple/swift-llvm/blob/stable/include/llvm/ADT/Triple.h
@dynamicMemberLookup
public struct Triple {
public struct Triple: Sendable {
/// `Triple` proxies predicates from `Triple.OS`, returning `false` for an unknown OS.
public subscript(dynamicMember predicate: KeyPath<OS, Bool>) -> Bool {
os?[keyPath: predicate] ?? false
Expand Down Expand Up @@ -60,7 +60,7 @@ public struct Triple {
public let objectFormat: ObjectFormat?

/// Represents a version that may be present in the target triple.
public struct Version: Equatable, Comparable, CustomStringConvertible {
public struct Version: Equatable, Comparable, CustomStringConvertible, Sendable {
public static let zero = Version(0, 0, 0)

public var major: Int
Expand Down Expand Up @@ -415,7 +415,7 @@ extension Triple {
}
}

public enum Arch: String, CaseIterable, Decodable {
public enum Arch: String, CaseIterable, Decodable, Sendable {
/// ARM (little endian): arm, armv.*, xscale
case arm
// ARM (big endian): armeb
Expand Down Expand Up @@ -841,11 +841,11 @@ extension Triple {
// MARK: - Parse SubArch

extension Triple {
public enum SubArch: Hashable {
public enum SubArch: Hashable, Sendable {

public enum ARM {
public enum ARM: Sendable {

public enum Profile {
public enum Profile: Sendable {
case a, r, m
}

Expand Down Expand Up @@ -913,13 +913,13 @@ extension Triple {
}
}

public enum Kalimba {
public enum Kalimba: Sendable {
case v3
case v4
case v5
}

public enum MIPS {
public enum MIPS: Sendable {
case r6
}

Expand Down Expand Up @@ -1019,7 +1019,7 @@ extension Triple {
// MARK: - Parse Vendor

extension Triple {
public enum Vendor: String, CaseIterable, TripleComponent {
public enum Vendor: String, CaseIterable, TripleComponent, Sendable {
case apple
case pc
case scei
Expand Down Expand Up @@ -1084,7 +1084,7 @@ extension Triple {
// MARK: - Parse OS

extension Triple {
public enum OS: String, CaseIterable, TripleComponent {
public enum OS: String, CaseIterable, TripleComponent, Sendable {
case ananas
case cloudABI = "cloudabi"
case darwin
Expand Down Expand Up @@ -1261,7 +1261,7 @@ extension Triple {
}
}

public enum Environment: String, CaseIterable, Equatable {
public enum Environment: String, CaseIterable, Equatable, Sendable {
case eabihf
case eabi
case elfv1
Expand Down Expand Up @@ -1357,7 +1357,7 @@ extension Triple {
// MARK: - Parse Object Format

extension Triple {
public enum ObjectFormat {
public enum ObjectFormat: Sendable {
case coff
case elf
case macho
Expand Down