Skip to content

Commit f4ce1c6

Browse files
authored
Merge pull request #942 from apple/ifdefs
2 parents 00494c4 + 066e652 commit f4ce1c6

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ extension Driver {
972972
///
973973
/// - Parameter content: response file's content to be tokenized.
974974
private static func tokenizeResponseFile(_ content: String) -> [String] {
975-
#if !os(macOS) && !os(Linux) && !os(Android) && !os(OpenBSD)
975+
#if !canImport(Darwin) && !os(Linux) && !os(Android) && !os(OpenBSD)
976976
#warning("Response file tokenization unimplemented for platform; behavior may be incorrect")
977977
#endif
978978
return content.split { $0 == "\n" || $0 == "\r\n" }
@@ -2621,7 +2621,7 @@ extension Triple {
26212621

26222622
/// Toolchain computation.
26232623
extension Driver {
2624-
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
2624+
#if canImport(Darwin)
26252625
static let defaultToolchainType: Toolchain.Type = DarwinToolchain.self
26262626
#elseif os(Windows)
26272627
static let defaultToolchainType: Toolchain.Type = WindowsToolchain.self

Sources/SwiftDriver/ExplicitModuleBuilds/ExplicitDependencyBuildPlanner.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ extension ExplicitDependencyBuildPlanner {
442442
return previouslyHashsedName
443443
}
444444
let hashedArguments: String
445-
#if os(macOS)
446-
if #available(macOS 10.15, iOS 13, *) {
445+
#if canImport(Darwin)
446+
if #available(macOS 10.15, *) {
447447
hashedArguments = CryptoKitSHA256().hash(hashInput).hexadecimalRepresentation
448448
} else {
449449
hashedArguments = SHA256().hash(hashInput).hexadecimalRepresentation

Sources/SwiftDriver/IncrementalCompilation/BuildRecordInfo.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ import SwiftOptions
112112
.map { $0.option.spelling }
113113
.sorted()
114114
.joined()
115-
#if os(macOS)
116-
if #available(macOS 10.15, iOS 13, *) {
115+
#if canImport(Darwin)
116+
if #available(macOS 10.15, *) {
117117
return CryptoKitSHA256().hash(hashInput).hexadecimalRepresentation
118118
} else {
119119
return SHA256().hash(hashInput).hexadecimalRepresentation

Sources/SwiftDriver/Toolchains/DarwinToolchain.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public final class DarwinToolchain: Toolchain {
169169
diagnosticsEngine: DiagnosticsEngine) throws {
170170
// On non-darwin hosts, libArcLite won't be found and a warning will be emitted
171171
// Guard for the sake of tests running on all platforms
172-
#if os(macOS)
172+
#if canImport(Darwin)
173173
// Validating arclite library path when link-objc-runtime.
174174
validateLinkObjcRuntimeARCLiteLib(&parsedOptions,
175175
targetTriple: targetTriple,

Sources/SwiftDriver/Utilities/System.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#if os(macOS)
13+
#if canImport(Darwin)
1414
import Darwin
1515
#elseif canImport(Glibc)
1616
import Glibc
1717
#endif
1818

19-
#if os(macOS) || os(Linux) || os(Android) || os(OpenBSD)
19+
#if canImport(Darwin) || os(Linux) || os(Android) || os(OpenBSD)
2020
// Adapted from llvm::sys::commandLineFitsWithinSystemLimits.
2121
func commandLineFitsWithinSystemLimits(path: String, args: [String]) -> Bool {
2222
let upperBound = sysconf(Int32(_SC_ARG_MAX))

Sources/SwiftDriver/Utilities/VirtualPath.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import TSCBasic
1313
import Foundation
1414

15-
#if os(macOS)
15+
#if canImport(Darwin)
1616
import Darwin
1717
#endif
1818

@@ -736,7 +736,7 @@ extension TSCBasic.FileSystem {
736736
/// - Returns: A `Date` value containing the last modification time.
737737
public func lastModificationTime(for file: VirtualPath) throws -> Date {
738738
try resolvingVirtualPath(file) { path in
739-
#if os(macOS)
739+
#if canImport(Darwin)
740740
var s = Darwin.stat()
741741
let err = stat(path.pathString, &s)
742742
guard err == 0 else {

0 commit comments

Comments
 (0)