File tree 5 files changed +45
-31
lines changed
SwiftCompilerPluginMessageHandling
_SwiftSyntaxCShims/include
5 files changed +45
-31
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,15 @@ add_swift_syntax_library(SwiftCompilerPluginMessageHandling
21
21
)
22
22
23
23
target_link_swift_syntax_libraries(SwiftCompilerPluginMessageHandling PUBLIC
24
- _SwiftSyntaxCShims
25
24
SwiftSyntax
26
25
SwiftBasicFormat
27
26
SwiftDiagnostics
28
27
SwiftParser
29
28
SwiftSyntaxMacros
30
29
SwiftSyntaxMacroExpansion
31
- SwiftOperators)
30
+ SwiftOperators
31
+ )
32
+
33
+ target_link_swift_syntax_libraries(SwiftCompilerPluginMessageHandling PRIVATE
34
+ _SwiftSyntaxCShims
35
+ )
Original file line number Diff line number Diff line change 11
11
//===----------------------------------------------------------------------===//
12
12
13
13
#if swift(>=6.0)
14
- #if canImport(Darwin)
15
- private import Darwin
16
- #elseif canImport(Glibc)
17
- private import Glibc
18
- #elseif canImport(ucrt)
19
- private import ucrt
20
- #endif
14
+ private import _SwiftSyntaxCShims
21
15
#else
22
- #if canImport(Darwin)
23
- import Darwin
24
- #elseif canImport(Glibc)
25
- import Glibc
26
- #elseif canImport(ucrt)
27
- import ucrt
28
- #endif
16
+ @_implementationOnly import _SwiftSyntaxCShims
29
17
#endif
30
18
31
19
func decodeFromJSON< T: Decodable > ( json: UnsafeBufferPointer < UInt8 > ) throws -> T {
Original file line number Diff line number Diff line change 12
12
13
13
#if swift(>=6.0)
14
14
private import _SwiftSyntaxCShims
15
- #if canImport(Darwin)
16
- private import Darwin
17
- #elseif canImport(Glibc)
18
- private import Glibc
19
- #elseif canImport(ucrt)
20
- private import ucrt
21
- #endif
22
15
#else
23
- import _SwiftSyntaxCShims
24
- #if canImport(Darwin)
25
- import Darwin
26
- #elseif canImport(Glibc)
27
- import Glibc
28
- #elseif canImport(ucrt)
29
- import ucrt
30
- #endif
16
+ @_implementationOnly import _SwiftSyntaxCShims
31
17
#endif
32
18
33
19
#if canImport(ucrt)
Original file line number Diff line number Diff line change 1
1
module _SwiftSyntaxCShims {
2
+ header "swiftsyntax/_includes.h"
2
3
header "swiftsyntax/AtomicBool.h"
3
4
header "swiftsyntax/errno.h"
4
5
header "swiftsyntax/stdio.h"
Original file line number Diff line number Diff line change
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2024 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See https://swift.org/LICENSE.txt for license information
9
+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ //===----------------------------------------------------------------------===//
12
+ //
13
+ // This file is for, instead of importing platform modules in Swift file, like:
14
+ //
15
+ // #if canImport(Darwin)
16
+ // import Darwin
17
+ // #elseif canImport(Glibc)
18
+ // import Glibc
19
+ // ...
20
+ //
21
+ // Just include them here using C facilities, so that Swift module can just:
22
+ //
23
+ // import _SwiftSyntaxCShims
24
+ //
25
+ //===----------------------------------------------------------------------===//
26
+
27
+ #if defined(_WIN32 )
28
+ #include <io.h>
29
+ #elif defined(__unix__ ) || defined(__APPLE__ )
30
+ #include <unistd.h>
31
+ #endif
32
+
33
+ #include <stdio.h>
34
+ #include <stdlib.h>
35
+ #include <string.h>
You can’t perform that action at this time.
0 commit comments