Skip to content

Commit e1f5371

Browse files
authored
Merge branch 'main' into trailing-comma
2 parents 2e3b987 + b7c241d commit e1f5371

File tree

1,300 files changed

+15545
-6719
lines changed

Some content is hidden

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

1,300 files changed

+15545
-6719
lines changed

.github/CODEOWNERS

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
/cmake/**/*Windows* @compnerd
4848

4949
# docs
50+
/docs/CrossCompilationModel.md @MaxDesiatov
5051
/docs/Generics.rst @slavapestov
5152
/docs/Generics/ @slavapestov
5253
/docs/HowToGuides/ @AnthonyLatsis @LucianoPAlmeida @xedin
@@ -144,7 +145,7 @@
144145
# TODO: /localization
145146

146147
# stdlib
147-
/stdlib/ @apple/standard-librarians
148+
/stdlib/ @swiftlang/standard-librarians
148149
/stdlib/public/Backtracing/ @al45tair
149150
/stdlib/public/Concurrency/ @ktoso
150151
/stdlib/public/Cxx/ @zoecarver @hyp @egorzhdan
@@ -181,14 +182,14 @@
181182
/test/Sema/moveonly* @kavon
182183
/test/SourceKit/ @ahoppen @bnbarham @hamishknight @rintaro
183184
/test/SymbolGraph/ @QuietMisdreavus
184-
/test/abi/ @apple/standard-librarians
185+
/test/abi/ @swiftlang/standard-librarians
185186
/test/decl/ @hborla @slavapestov
186187
/test/decl/protocol/ @AnthonyLatsis @hborla @slavapestov
187188
# FIXME: This file could have a dedicated directory.
188189
/test/decl/protocol/special/DistributedActor.swift @ktoso
189190
/test/expr/ @hborla @slavapestov @xedin
190191
/test/refactoring/ @ahoppen @bnbarham @hamishknight @rintaro
191-
/test/stdlib/ @apple/standard-librarians
192+
/test/stdlib/ @swiftlang/standard-librarians
192193
/test/stmt/ @hborla @xedin
193194
/test/type/ @hborla @slavapestov @xedin
194195

@@ -232,4 +233,4 @@
232233
# TODO: /validation-test/SILGen/
233234
# TODO: /validation-test/SILOptimizer/
234235
/validation-test/Sema/ @hborla @slavapestov @xedin
235-
/validation-test/stdlib/ @apple/standard-librarians
236+
/validation-test/stdlib/ @swiftlang/standard-librarians

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,10 @@ option(SWIFT_ENABLE_SYNCHRONIZATION
712712
"Enable build of the Swift Synchronization module"
713713
FALSE)
714714

715+
option(SWIFT_ENABLE_VOLATILE
716+
"Enable build of the Swift Volatile module"
717+
FALSE)
718+
715719
option(SWIFT_ENABLE_DISPATCH
716720
"Enable use of libdispatch"
717721
TRUE)
@@ -919,6 +923,12 @@ if (NOT BOOTSTRAPPING_MODE)
919923
message(FATAL_ERROR "turning off bootstrapping is not supported anymore")
920924
endif()
921925

926+
# As a temporary workaround, disable SwiftCompilerSources on
927+
# Windows/ARM64 because the compiler segfaults
928+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64")
929+
set(BOOTSTRAPPING_MODE "OFF")
930+
endif()
931+
922932
set(SWIFT_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
923933
set(SWIFT_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
924934
if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "")
@@ -1359,6 +1369,7 @@ if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
13591369
message(STATUS "Unicode Support: ${SWIFT_STDLIB_ENABLE_UNICODE_DATA}")
13601370
message(STATUS "Observation Support: ${SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION}")
13611371
message(STATUS "Synchronization Support: ${SWIFT_ENABLE_SYNCHRONIZATION}")
1372+
message(STATUS "Volatile Support: ${SWIFT_ENABLE_VOLATILE}")
13621373
message(STATUS "")
13631374
else()
13641375
message(STATUS "Not building Swift standard library, SDK overlays, and runtime")

CODE_OF_CONDUCT.md

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

CONTRIBUTING.md

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

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ To learn more about the programming language, visit [swift.org](https://swift.or
6363
Contributions to Swift are welcomed and encouraged! Please see the
6464
[Contributing to Swift guide](https://swift.org/contributing/).
6565

66+
Before submitting the pull request, please make sure you have [tested your
67+
changes](https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md)
68+
and that they follow the Swift project [guidelines for contributing
69+
code](https://swift.org/contributing/#contributing-code).
70+
6671
To be a truly great community, [Swift.org](https://swift.org/) needs to welcome
6772
developers from all walks of life, with different backgrounds, and with a wide
6873
range of experience. A diverse and friendly community will have more great

SwiftCompilerSources/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ function(add_swift_compiler_modules_library name)
181181
# Workaround a crash in the LoadableByAddress pass
182182
# https://github.com/apple/swift/issues/73254
183183
list(APPEND swift_compile_options "-Xllvm" "-sil-disable-pass=loadable-address")
184+
185+
# The STL in VS 17.10 requires Clang 17 or higher, but bootstrapping generally uses toolchains with older versions
186+
# versions of Clang. Swift 6 toolchains are the first to include Clang 17, so if we are on Windows and using an
187+
# earlier toolchain, we need to relax to relax this requirement with ALLOW_COMPILER_AND_STL_VERSION_MISMATCH.
188+
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 6.0)
189+
list(APPEND swift_compile_options "-Xcc" "-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH")
190+
endif()
184191
else()
185192
list(APPEND sdk_option "-I" "${swift_exec_bin_dir}/../lib" "-I" "${sdk_path}/usr/lib")
186193
endif()

SwiftCompilerSources/Sources/Basic/Utils.swift

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,36 @@
2121
/// case for `precondition`.
2222
@_transparent
2323
public func assert(_ condition: Bool, _ message: @autoclosure () -> String,
24-
file: StaticString = #fileID, line: UInt = #line) {
25-
if !condition {
26-
fatalError(message(), file: file, line: line)
27-
}
24+
file: StaticString = #fileID, line: UInt = #line, function: StaticString = #function) {
25+
precondition(condition, message(), file: file, line: line, function: function)
2826
}
2927

3028
/// The assert function (without a message) to be used in the compiler.
3129
///
3230
/// Unforuntately it's not possible to just add a default argument to `message` in the
3331
/// other `assert` function. We need to defined this overload.
32+
/// TODO: For some reason the compiler is not happy when adding a `function` argument.
3433
@_transparent
3534
public func assert(_ condition: Bool, file: StaticString = #fileID, line: UInt = #line) {
36-
if !condition {
37-
fatalError("", file: file, line: line)
35+
precondition(condition, "", file: file, line: line, function: "")
36+
}
37+
38+
/// The assert function to be used in the compiler.
39+
///
40+
/// This overrides the standard Swift precondition and forwards an assertion failure
41+
/// to the assertion-handling in the C++ code base.
42+
@_transparent
43+
public func precondition(_ condition: Bool, _ message: @autoclosure () -> String,
44+
file: StaticString = #fileID, line: UInt = #line, function: StaticString = #function) {
45+
if !_fastPath(condition) {
46+
let msg = message()
47+
msg.withCString { msgStr in
48+
file.withUTF8Buffer { fileBytes in
49+
function.withUTF8Buffer { functionBytes in
50+
assertFail(msgStr, fileBytes.baseAddress!, line, functionBytes.baseAddress!)
51+
}
52+
}
53+
}
3854
}
3955
}
4056

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ComputeSideEffects.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ private struct CollectedEffects {
287287
private mutating func addEffects<Arguments: Sequence>(ofFunctions callees: FunctionArray?,
288288
withArguments arguments: Arguments)
289289
where Arguments.Element == (calleeArgumentIndex: Int, callerArgument: Value) {
290+
// The argument summary for @in_cxx is insufficient in OSSA because the function body does not contain the
291+
// destroy. But the call is still effectively a release from the caller's perspective.
290292
guard let callees = callees else {
291293
// We don't know which function(s) are called.
292294
globalEffects = .worstEffects

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceDiagnostics.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ private func log(prefix: Bool = true, _ message: @autoclosure () -> String) {
2929
let lifetimeDependenceDiagnosticsPass = FunctionPass(
3030
name: "lifetime-dependence-diagnostics")
3131
{ (function: Function, context: FunctionPassContext) in
32+
#if os(Windows)
33+
if !context.options.hasFeature(.NonescapableTypes) {
34+
return
35+
}
36+
#endif
3237
log(prefix: false, "\n--- Diagnosing lifetime dependence in \(function.name)")
3338
log("\(function)")
3439

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceInsertion.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ private func log(prefix: Bool = true, _ message: @autoclosure () -> String) {
3131
let lifetimeDependenceInsertionPass = FunctionPass(
3232
name: "lifetime-dependence-insertion")
3333
{ (function: Function, context: FunctionPassContext) in
34+
#if os(Windows)
35+
if !context.options.hasFeature(.NonescapableTypes) {
36+
return
37+
}
38+
#endif
3439
log(prefix: false, "\n--- Inserting lifetime dependence markers in \(function.name)")
3540

3641
for instruction in function.instructions {

0 commit comments

Comments
 (0)