Skip to content

Commit 9bfe1b1

Browse files
committed
Merge branch 'main' into tbkka-RemoteMirror-MPE-zero-sized-plus-generics
2 parents 894f116 + db14ae8 commit 9bfe1b1

File tree

522 files changed

+10481
-3750
lines changed

Some content is hidden

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

522 files changed

+10481
-3750
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# CHANGELOG
22

3-
_**Note:** This is in reverse chronological order, so newer entries are added to the top._
3+
> **Note**\
4+
> This is in reverse chronological order, so newer entries are added to the top.
45
56
## Swift 5.9
67

@@ -92,6 +93,8 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
9293

9394
## Swift 5.8
9495

96+
### 2023-03-30 (Xcode 14.3)
97+
9598
* [SE-0376][]:
9699

97100
The `@backDeployed(before:)` attribute may now be used to extend the availability of a function to OS releases prior to the introduction of that function as ABI.

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ option(SWIFT_BUILD_STDLIB_EXTRA_TOOLCHAIN_CONTENT
243243
"If not building stdlib, controls whether to build 'stdlib/toolchain' content"
244244
TRUE)
245245

246+
option(SWIFT_BUILD_STDLIB_CXX_MODULE
247+
"If not building stdlib, controls whether to build the Cxx module"
248+
TRUE)
249+
246250
# In many cases, the CMake build system needs to determine whether to include
247251
# a directory, or perform other actions, based on whether the stdlib or SDK is
248252
# being built at all -- statically or dynamically. Please note that these
@@ -1265,6 +1269,10 @@ else()
12651269

12661270
if(SWIFT_BUILD_STDLIB_EXTRA_TOOLCHAIN_CONTENT)
12671271
add_subdirectory(stdlib/toolchain)
1272+
1273+
if(SWIFT_BUILD_STDLIB_CXX_MODULE)
1274+
add_subdirectory(stdlib/public/Cxx)
1275+
endif()
12681276
endif()
12691277

12701278
if (BUILD_SWIFT_CONCURRENCY_BACK_DEPLOYMENT_LIBRARIES)
@@ -1274,7 +1282,7 @@ else()
12741282

12751283
# Some tools (e.g. swift-reflection-dump) rely on a host swiftRemoteInspection,
12761284
# so ensure we build that when building tools.
1277-
if(SWIFT_INCLUDE_TOOLS)
1285+
if(SWIFT_INCLUDE_TOOLS OR SWIFT_BUILD_STDLIB_CXX_MODULE)
12781286
add_subdirectory(stdlib/public/SwiftShims/swift/shims)
12791287
endif()
12801288

SwiftCompilerSources/Sources/AST/DiagnosticEngine.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,17 @@ public struct DiagnosticFixIt {
5353
}
5454

5555
public struct DiagnosticEngine {
56-
private let bridged: swift.DiagnosticEngine
56+
private let bridged: BridgedDiagnosticEngine
5757

58-
public init(bridged: swift.DiagnosticEngine) {
58+
public init(bridged: BridgedDiagnosticEngine) {
5959
self.bridged = bridged
6060
}
61+
public init?(bridged: BridgedOptionalDiagnosticEngine) {
62+
guard let object = bridged.object else {
63+
return nil
64+
}
65+
self.bridged = BridgedDiagnosticEngine(object: object)
66+
}
6167

6268
public func diagnose(_ position: SourceLoc?,
6369
_ id: DiagID,

SwiftCompilerSources/Sources/Parse/Regex.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private func _RegexLiteralLexingFn(
4646
_ curPtrPtr: UnsafeMutablePointer<UnsafePointer<CChar>>,
4747
_ bufferEndPtr: UnsafePointer<CChar>,
4848
_ mustBeRegex: CBool,
49-
_ bridgedDiagnosticEngine: swift.DiagnosticEngine?
49+
_ bridgedDiagnosticEngine: BridgedOptionalDiagnosticEngine
5050
) -> /*CompletelyErroneous*/ CBool {
5151
let inputPtr = curPtrPtr.pointee
5252

@@ -62,8 +62,7 @@ private func _RegexLiteralLexingFn(
6262

6363
if let error = error {
6464
// Emit diagnostic if diagnostics are enabled.
65-
if let bridged = bridgedDiagnosticEngine {
66-
let diagEngine = DiagnosticEngine(bridged: bridged)
65+
if let diagEngine = DiagnosticEngine(bridged: bridgedDiagnosticEngine) {
6766
let startLoc = SourceLoc(
6867
locationInFile: error.location.assumingMemoryBound(to: UInt8.self))!
6968
diagEngine.diagnose(startLoc, .foreign_diagnostic, error.message)
@@ -94,7 +93,7 @@ public func _RegexLiteralParsingFn(
9493
_ captureStructureOut: UnsafeMutableRawPointer,
9594
_ captureStructureSize: CUnsignedInt,
9695
_ bridgedDiagnosticBaseLoc: swift.SourceLoc,
97-
_ bridgedDiagnosticEngine: swift.DiagnosticEngine
96+
_ bridgedDiagnosticEngine: BridgedDiagnosticEngine
9897
) -> Bool {
9998
let str = String(cString: inputPtr)
10099
let captureBuffer = UnsafeMutableRawBufferPointer(

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,10 @@ final public class MoveValueInst : SingleValueInstruction, UnaryInstruction {
647647
public var fromValue: Value { operand.value }
648648
}
649649

650+
final public class DropDeinitInst : SingleValueInstruction, UnaryInstruction {
651+
public var fromValue: Value { operand.value }
652+
}
653+
650654
final public class StrongCopyUnownedValueInst : SingleValueInstruction, UnaryInstruction {}
651655

652656
final public class StrongCopyUnmanagedValueInst : SingleValueInstruction, UnaryInstruction {}

SwiftCompilerSources/Sources/SIL/Registration.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public func registerSILClasses() {
125125
register(ProjectBoxInst.self)
126126
register(CopyValueInst.self)
127127
register(MoveValueInst.self)
128+
register(DropDeinitInst.self)
128129
register(EndCOWMutationInst.self)
129130
register(ClassifyBridgeObjectInst.self)
130131
register(PartialApplyInst.self)

benchmark/cxx-source/CxxSetToCollection.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public let benchmarks = [
3636
runFunction: run_CxxSetOfU32_to_Set,
3737
tags: [.validation, .bridging, .cxxInterop],
3838
setUpFunction: makeSetOnce),
39+
BenchmarkInfo(
40+
name: "CxxSetU32.forEach",
41+
runFunction: run_CxxSetOfU32_forEach,
42+
tags: [.validation, .bridging, .cxxInterop],
43+
setUpFunction: makeSetOnce),
3944
]
4045

4146
func makeSetOnce() {
@@ -58,4 +63,13 @@ public func run_CxxSetOfU32_to_Set(_ n: Int) {
5863
}
5964
}
6065

66+
@inline(never)
67+
public func run_CxxSetOfU32_forEach(_ n: Int) {
68+
for _ in 0..<n {
69+
set.forEach {
70+
blackHole($0)
71+
}
72+
}
73+
}
74+
6175
#endif

cmake/caches/Windows-aarch64.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ set(LLDB_ENABLE_LIBXML2 NO CACHE BOOL "")
7373
# This requires perl which may not be available on Windows
7474
set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "")
7575
set(SWIFT_BUILD_ENABLE_PARSER_LIB YES CACHE BOOL "")
76+
set(SWIFT_BUILD_STDLIB_EXTRA_TOOLCHAIN_CONTENT NO CACHE BOOL "")
77+
set(SWIFT_BUILD_STDLIB_CXX_MODULE NO CACHE BOOL "")
7678
# static linking is not supported on Windows yet
7779
set(SWIFT_BUILD_STATIC_STDLIB NO CACHE BOOL "")
7880
set(SWIFT_BUILD_STATIC_SDK_OVERLAY NO CACHE BOOL "")

cmake/caches/Windows-x86_64.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ set(LLDB_EMBED_PYTHON_HOME NO CACHE BOOL "")
7272
# This requires perl which may not be available on Windows
7373
set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "")
7474
set(SWIFT_BUILD_ENABLE_PARSER_LIB YES CACHE BOOL "")
75+
set(SWIFT_BUILD_STDLIB_EXTRA_TOOLCHAIN_CONTENT NO CACHE BOOL "")
76+
set(SWIFT_BUILD_STDLIB_CXX_MODULE NO CACHE BOOL "")
7577
# static linking is not supported on Windows yet
7678
set(SWIFT_BUILD_STATIC_STDLIB NO CACHE BOOL "")
7779
set(SWIFT_BUILD_STATIC_SDK_OVERLAY NO CACHE BOOL "")

docs/ABI/Mangling.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,13 @@ Entities
396396

397397
macro-discriminator-list ::= macro-discriminator-list? file-discriminator? macro-expansion-operator INDEX
398398

399-
macro-expansion-operator ::= identifier 'fMa' // attached accessor macro
400-
macro-expansion-operator ::= identifier 'fMA' // attached member-attribute macro
399+
macro-expansion-operator ::= decl-name identifier 'fMa' // attached accessor macro
400+
macro-expansion-operator ::= decl-name identifier 'fMA' // attached member-attribute macro
401401
macro-expansion-operator ::= identifier 'fMf' // freestanding macro
402-
macro-expansion-operator ::= identifier 'fMm' // attached member macro
403-
macro-expansion-operator ::= identifier 'fMp' // attached peer macro
404-
macro-expansion-operator ::= identifier 'fMc' // attached conformance macro
405-
macro-expansion-operator ::= identifier 'fMu' // uniquely-named entity
402+
macro-expansion-operator ::= decl-name identifier 'fMm' // attached member macro
403+
macro-expansion-operator ::= decl-name identifier 'fMp' // attached peer macro
404+
macro-expansion-operator ::= decl-name identifier 'fMc' // attached conformance macro
405+
macro-expansion-operator ::= decl-name identifier 'fMu' // uniquely-named entity
406406

407407
file-discriminator ::= identifier 'Ll' // anonymous file-discriminated declaration
408408

0 commit comments

Comments
 (0)