Skip to content

Commit 2d109e5

Browse files
committed
Merge branch 'main'
Conflicts: Tests/SwiftLexicalLookupTest/NameLookupTests.swift
2 parents 6759b05 + 3db6f01 commit 2d109e5

File tree

78 files changed

+7891
-4077
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+7891
-4077
lines changed

.spi.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ builder:
1212
- SwiftCompilerPlugin
1313
- SwiftDiagnostics
1414
- SwiftIDEUtils
15+
- SwiftIfConfig
1516
- SwiftLexicalLookup
1617
- SwiftOperators
1718
- SwiftParser

CMakeLists.txt

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,24 @@ option(SWIFT_SYNTAX_ENABLE_WMO_PRE_3_26
4242
$<IF:$<AND:$<NOT:$<CONFIG:Debug>>,$<PLATFORM_ID:Darwin>>,YES,NO>)
4343

4444
include(AddSwiftHostLibrary)
45+
include(SwiftCompilerCapability)
4546

46-
# Ensure that we do not link the _StringProcessing module. But we can
47-
# only pass this flag for new-enough compilers that support it.
48-
file(WRITE "${CMAKE_BINARY_DIR}/tmp/empty-check-string-processing.swift" "")
49-
execute_process(
50-
COMMAND
51-
"${CMAKE_Swift_COMPILER}"
52-
-Xfrontend -disable-implicit-string-processing-module-import
53-
-Xfrontend -parse-stdlib
54-
-typecheck "${CMAKE_BINARY_DIR}/tmp/empty-check-string-processing.swift"
55-
OUTPUT_QUIET ERROR_QUIET
56-
RESULT_VARIABLE
57-
SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
58-
if (NOT SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
59-
add_compile_options(
60-
$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend>
61-
$<$<COMPILE_LANGUAGE:Swift>:-disable-implicit-string-processing-module-import>)
47+
# Don't link with 'string-processing' and 'backtracing'.
48+
swift_supports_implicit_module("string-processing" SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
49+
swift_supports_implicit_module("backtracing" SWIFT_SUPPORTS_DISABLE_IMPLICIT_BACKTRACING_MODULE_IMPORT)
50+
if(SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
51+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>")
52+
endif()
53+
if(SWIFT_SUPPORTS_DISABLE_IMPLICIT_BACKTRACING_MODULE_IMPORT)
54+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-backtracing-module-import>")
55+
endif()
56+
57+
# SWIFTSYNTAX_EMIT_MODULE is TRUE by default
58+
if(NOT DEFINED SWIFTSYNTAX_EMIT_MODULE)
59+
set(SWIFTSYNTAX_EMIT_MODULE TRUE)
60+
endif()
61+
if(SWIFTSYNTAX_EMIT_MODULE)
62+
swift_get_package_cmo_support(SWIFT_PACKAGE_CMO_SUPPORT)
6263
endif()
6364

6465
# Determine the module triple.

CONTRIBUTING.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,9 @@ Once you've pushed your branch, you should see an option on this repository's pa
8484
8585
## Opening a PR for Release Branch
8686

87-
In order for a pull request to be considered for inclusion in a release branch (e.g. `release/6.0`) after it has been cut, it must meet the following requirements:
87+
See the [dedicated section][section] on the Swift project website.
8888

89-
1. The title of the PR should start with the tag `[{swift version number}]`. For example, `[6.0]` for the Swift 6.0 release branch.
90-
91-
1. [This][form] should be filled out in the description of the PR.
92-
To use this template when creating a PR, append the `template=release.md`
93-
query parameter to the current URL and refresh.
94-
For example:
95-
```diff
96-
-https://github.com/swiftlang/swift-syntax/compare/main...my-branch?quick_pull=1
97-
+https://github.com/swiftlang/swift-syntax/compare/main...my-branch?quick_pull=1&template=release.md
98-
```
99-
100-
All changes going into a release branch must go through pull requests that are approved and merged by the corresponding release manager.
101-
102-
[form]: https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1
89+
[section]: https://www.swift.org/contributing/#release-branch-pull-requests
10390

10491
## Review and CI Testing
10592

CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SwiftSyntaxDoccIndexTemplate.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code.
1818

1919
- <doc:Working-with-SwiftSyntax>
2020
- <doc:Macro-Versioning>
21+
- <doc:RawSyntaxValidation>
2122
- <doc:Glossary>
2223

2324
### Tutorials

CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SyntaxBaseNodesFile.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
183183
DeclSyntax(
184184
"""
185185
/// Create a \(raw: node.kind.doccLink) node from a specialized syntax node.
186-
public init(_ syntax: some \(node.kind.protocolType)) {
186+
public init(_ syntax: __shared some \(node.kind.protocolType)) {
187187
// We know this cast is going to succeed. Go through init(_: SyntaxData)
188188
// to do a sanity check and verify the kind matches in debug builds and get
189189
// maximum performance in release builds.
@@ -195,7 +195,7 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
195195
DeclSyntax(
196196
"""
197197
/// Create a \(raw: node.kind.doccLink) node from a specialized optional syntax node.
198-
public init?(_ syntax: (some \(node.kind.protocolType))?) {
198+
public init?(_ syntax: __shared (some \(node.kind.protocolType))?) {
199199
guard let syntax = syntax else { return nil }
200200
self.init(syntax)
201201
}
@@ -204,7 +204,7 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
204204

205205
DeclSyntax(
206206
"""
207-
public init(fromProtocol syntax: \(node.kind.protocolType)) {
207+
public init(fromProtocol syntax: __shared \(node.kind.protocolType)) {
208208
// We know this cast is going to succeed. Go through init(_: SyntaxData)
209209
// to do a sanity check and verify the kind matches in debug builds and get
210210
// maximum performance in release builds.
@@ -216,14 +216,14 @@ let syntaxBaseNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
216216
DeclSyntax(
217217
"""
218218
/// Create a \(raw: node.kind.doccLink) node from a specialized optional syntax node.
219-
public init?(fromProtocol syntax: \(node.kind.protocolType)?) {
219+
public init?(fromProtocol syntax: __shared \(node.kind.protocolType)?) {
220220
guard let syntax = syntax else { return nil }
221221
self.init(fromProtocol: syntax)
222222
}
223223
"""
224224
)
225225

226-
try InitializerDeclSyntax("public init?(_ node: some SyntaxProtocol)") {
226+
try InitializerDeclSyntax("public init?(_ node: __shared some SyntaxProtocol)") {
227227
try SwitchExprSyntax("switch node.raw.kind") {
228228
SwitchCaseListSyntax {
229229
SwitchCaseSyntax(

CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax/SyntaxNodesFile.swift

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func syntaxNode(nodesStartingWith: [Character]) -> SourceFileSyntax {
4747

4848
DeclSyntax(
4949
"""
50-
public init?(_ node: some SyntaxProtocol) {
50+
public init?(_ node: __shared some SyntaxProtocol) {
5151
guard node.raw.kind == .\(node.varOrCaseName) else { return nil }
5252
self._syntaxNode = node._syntaxNode
5353
}
@@ -199,17 +199,14 @@ func syntaxNode(nodesStartingWith: [Character]) -> SourceFileSyntax {
199199
}
200200
}
201201

202-
try! VariableDeclSyntax("public static var structure: SyntaxNodeStructure") {
203-
let layout = ArrayExprSyntax {
204-
for child in node.children {
205-
ArrayElementSyntax(
206-
expression: ExprSyntax(#"\Self.\#(child.varOrCaseName)"#)
207-
)
208-
}
202+
let layout = ArrayExprSyntax {
203+
for child in node.children {
204+
ArrayElementSyntax(
205+
expression: ExprSyntax(#"\Self.\#(child.varOrCaseName)"#)
206+
)
209207
}
210-
211-
StmtSyntax("return .layout(\(layout))")
212208
}
209+
"public static let structure: SyntaxNodeStructure = .layout(\(layout))"
213210
}
214211
}
215212
}
@@ -256,7 +253,7 @@ private func generateSyntaxChildChoices(for child: Child) throws -> EnumDeclSynt
256253
}
257254
}
258255

259-
try! InitializerDeclSyntax("public init?(_ node: some SyntaxProtocol)") {
256+
try! InitializerDeclSyntax("public init?(_ node: __shared some SyntaxProtocol)") {
260257
for choice in choices {
261258
StmtSyntax(
262259
"""

0 commit comments

Comments
 (0)