Skip to content

Commit 99bb1d1

Browse files
committed
Consistently use canImport(Darwin) throughout the codebase
Easier than listing every Apple platform and keeping that list updated.
1 parent 43bcf89 commit 99bb1d1

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Sources/SwiftDriver/SwiftScan/Loader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import var Foundation.NSLocalizedDescriptionKey
1515

1616
#if os(Windows)
1717
import WinSDK
18-
#elseif os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
18+
#elseif canImport(Darwin)
1919
import Darwin
2020
#elseif canImport(Glibc)
2121
import Glibc
@@ -121,7 +121,7 @@ extension Loader.Flags {
121121
}
122122

123123
// Platform-specific flags
124-
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
124+
#if canImport(Darwin)
125125
public static var first: Loader.Flags {
126126
Loader.Flags(rawValue: RTLD_FIRST)
127127
}

Sources/SwiftDriver/Utilities/DateAdditions.swift

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

1313
#if os(Windows)
1414
import WinSDK
15-
#elseif os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
15+
#elseif canImport(Darwin)
1616
import Darwin
1717
#elseif canImport(Glibc)
1818
import Glibc

Sources/swift-build-sdk-interfaces/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import SwiftDriverExecution
1313
import SwiftDriver
1414
#if os(Windows)
1515
import CRT
16-
#elseif os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
16+
#elseif canImport(Darwin)
1717
import Darwin
1818
#elseif canImport(Glibc)
1919
import Glibc

Sources/swift-driver/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import SwiftDriver
1414
import SwiftOptions
1515
#if os(Windows)
1616
import CRT
17-
#elseif os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
17+
#elseif canImport(Darwin)
1818
import Darwin
1919
#elseif canImport(Glibc)
2020
import Glibc

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,7 +2915,7 @@ final class SwiftDriverTests: XCTestCase {
29152915
}
29162916

29172917
func testSanitizeStableAbi() throws {
2918-
#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS))
2918+
#if !canImport(Darwin)
29192919
throw XCTSkip("-sanitize-stable-abi is only implemented on Darwin")
29202920
#else
29212921
var driver = try Driver(args: ["swiftc", "-sanitize=address", "-sanitize-stable-abi", "Test.swift"])
@@ -7243,7 +7243,7 @@ final class SwiftDriverTests: XCTestCase {
72437243
}
72447244

72457245
func testSwiftClangxxOverride() throws {
7246-
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
7246+
#if canImport(Darwin)
72477247
throw XCTSkip("Darwin always uses `clang` to link")
72487248
#else
72497249
var env = ProcessEnv.vars
@@ -7876,7 +7876,7 @@ final class SwiftDriverTests: XCTestCase {
78767876
}
78777877

78787878
func testCxxLinking() throws {
7879-
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
7879+
#if canImport(Darwin)
78807880
throw XCTSkip("Darwin does not use clang as the linker driver")
78817881
#else
78827882
VirtualPath.resetTemporaryFileStore()

0 commit comments

Comments
 (0)