Skip to content

Commit aafe736

Browse files
authored
Revert "Revert "Eliminate SWIFT_SYNTAX_ALWAYS_SINGLE_THREADED""
1 parent e07287b commit aafe736

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ if (NOT SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
4242
$<$<COMPILE_LANGUAGE:Swift>:-disable-implicit-string-processing-module-import>)
4343
endif()
4444

45-
# Force single-threaded-only syntax trees to eliminate the Darwin
46-
# dependency in the compiler.
47-
add_compile_definitions(
48-
$<$<COMPILE_LANGUAGE:Swift>:SWIFT_SYNTAX_ALWAYS_SINGLE_THREADED>
49-
)
50-
5145
add_subdirectory(Sources)
5246

5347
export(EXPORT SwiftSyntaxTargets

Sources/SwiftSyntax/SyntaxText.swift

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#if !SWIFT_SYNTAX_ALWAYS_SINGLE_THREADED
14-
#if canImport(Darwin)
15-
@_implementationOnly import Darwin
16-
#elseif canImport(Glibc)
17-
@_implementationOnly import Glibc
18-
#endif
19-
#endif
20-
2113
/// Represent a string.
2214
///
2315
/// This type does not own the string data. The data reside in some other buffer
@@ -220,17 +212,17 @@ extension String {
220212
}
221213
}
222214

215+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(FreeBSD) || os(OpenBSD)
216+
@_silgen_name("memcmp")
217+
public func memcmp(_: UnsafeRawPointer?, _: UnsafeRawPointer?, _: Int) -> Int32
218+
#endif
219+
223220
private func compareMemory(
224221
_ s1: UnsafePointer<UInt8>, _ s2: UnsafePointer<UInt8>, _ count: Int
225222
) -> Bool {
226223
assert(count >= 0)
227-
#if SWIFT_SYNTAX_ALWAYS_SINGLE_THREADED
228-
return UnsafeBufferPointer(start: s1, count: count)
229-
.elementsEqual(UnsafeBufferPointer(start: s2, count: count))
230-
#elseif canImport(Darwin)
231-
return Darwin.memcmp(s1, s2, count) == 0
232-
#elseif canImport(Glibc)
233-
return Glibc.memcmp(s1, s2, count) == 0
224+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(FreeBSD) || os(OpenBSD)
225+
return memcmp(s1, s2, count) == 0
234226
#else
235227
return UnsafeBufferPointer(start: s1, count: count)
236228
.elementsEqual(UnsafeBufferPointer(start: s2, count: count))

Tests/SwiftParserTest/LinkageTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ final class LinkageTest: XCTestCase {
3232
.library("-lswiftCompatibility56", condition: .mayBeAbsent("Starting in Xcode 14 this library is not always autolinked")),
3333
.library("-lswiftCompatibilityConcurrency"),
3434
.library("-lswiftCore"),
35-
.library("-lswiftDarwin", condition: .mayBeAbsent("Not present when building inside the compiler")),
3635
.library("-lswiftSwiftOnoneSupport", condition: .when(configuration: .debug)),
3736
.library("-lswift_Concurrency"),
3837
.library("-lswift_StringProcessing", condition: .mayBeAbsent("Starting in Xcode 14 this library is not always autolinked")),

0 commit comments

Comments
 (0)