Skip to content

Commit 0f4ed67

Browse files
committed
Rename _CShims -> _SwiftSyntaxCShims
Avoid possible module name collision (cherry picked from commit 1e2c3bd)
1 parent bea2562 commit 0f4ed67

File tree

11 files changed

+46
-34
lines changed

11 files changed

+46
-34
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let package = Package(
3131
targets: [
3232
// MARK: - Internal helper targets
3333
.target(
34-
name: "_CShims"
34+
name: "_SwiftSyntaxCShims"
3535
),
3636

3737
.target(
@@ -77,7 +77,7 @@ let package = Package(
7777

7878
.target(
7979
name: "SwiftCompilerPlugin",
80-
dependencies: ["SwiftCompilerPluginMessageHandling", "SwiftSyntaxMacros", "_CShims"],
80+
dependencies: ["SwiftCompilerPluginMessageHandling", "SwiftSyntaxMacros", "_SwiftSyntaxCShims"],
8181
exclude: ["CMakeLists.txt"]
8282
),
8383

Sources/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# See http://swift.org/LICENSE.txt for license information
77
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
88

9-
add_subdirectory(_CShims)
9+
add_subdirectory(_SwiftSyntaxCShims)
1010
add_subdirectory(SwiftBasicFormat)
1111
add_subdirectory(SwiftSyntax)
1212
add_subdirectory(SwiftDiagnostics)

Sources/SwiftCompilerPlugin/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ add_swift_syntax_library(SwiftCompilerPlugin
1414
target_link_swift_syntax_libraries(SwiftCompilerPlugin PUBLIC
1515
SwiftSyntaxMacros
1616
SwiftCompilerPluginMessageHandling
17-
SwiftSyntax_CShims
17+
_SwiftSyntaxCShims
1818
)

Sources/SwiftCompilerPlugin/CompilerPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// https://github.com/apple/swift-package-manager/blob/main/Sources/PackagePlugin/Plugin.swift
1414

1515
#if swift(>=6.0)
16-
private import _CShims
16+
private import _SwiftSyntaxCShims
1717
public import SwiftSyntaxMacros
1818
@_spi(PluginMessage) private import SwiftCompilerPluginMessageHandling
1919
#if canImport(Darwin)
@@ -24,7 +24,7 @@ private import Glibc
2424
private import ucrt
2525
#endif
2626
#else
27-
import _CShims
27+
import _SwiftSyntaxCShims
2828
import SwiftSyntaxMacros
2929
@_spi(PluginMessage) import SwiftCompilerPluginMessageHandling
3030
#if canImport(Darwin)

Sources/_CShims/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

Sources/_CShims/include/_CShims.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

Sources/_CShims/include/module.modulemap

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
add_library(_SwiftSyntaxCShims INTERFACE)
2+
target_include_directories(_SwiftSyntaxCShims INTERFACE "include")
3+
set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS _SwiftSyntaxCShims)
4+
install(TARGETS _SwiftSyntaxCShims EXPORT SwiftSyntaxTargets)
File renamed without changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
#include <errno.h>
14+
#include <stdio.h>
15+
16+
typedef FILE *_ss_ptr_FILE;
17+
18+
static _ss_ptr_FILE _ss_stdout(void) {
19+
return stdout;
20+
}
21+
22+
static _ss_ptr_FILE _ss_stdin(void) {
23+
return stdin;
24+
}
25+
26+
static _ss_ptr_FILE _ss_stderr(void) {
27+
return stderr;
28+
}
29+
30+
static int _ss_errno(void) {
31+
return errno;
32+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module _SwiftSyntaxCShims {
2+
header "_stdio.h"
3+
export *
4+
}

0 commit comments

Comments
 (0)