Skip to content

Commit 1e94613

Browse files
Merge branch 'main'
2 parents 3c8bb5d + 2f2fc23 commit 1e94613

File tree

2,122 files changed

+137269
-26665
lines changed

Some content is hidden

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

2,122 files changed

+137269
-26665
lines changed

CHANGELOG.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,54 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
55

66
Swift 5.6
77
---------
8+
9+
* References to `Self` or so-called "`Self` requirements" in the type signatures
10+
of protocol members are now correctly detected in the parent of a nested type.
11+
As a result, protocol members that fall under this overlooked case are no longer
12+
available on values of protocol type:
13+
14+
```swift
15+
struct Outer<T> {
16+
struct Inner {}
17+
}
18+
19+
protocol P {}
20+
extension P {
21+
func method(arg: Outer<Self>.Inner) {}
22+
}
23+
24+
func test(p: P) {
25+
// error: 'method' has a 'Self' requirement and cannot be used on a value of
26+
// protocol type (use a generic constraint instead).
27+
_ = p.method
28+
}
29+
```
30+
31+
* [SE-0324][]:
32+
33+
Relax diagnostics for pointer arguments to C functions. The Swift
34+
compiler now accepts limited pointer type mismatches when directly
35+
calling functions imported from C as long as the C language allows
36+
those pointer types to alias. Consequently, any Swift
37+
`Unsafe[Mutable]Pointer<T>` or `Unsafe[Mutable]RawPointer` may be
38+
passed to C function arguments declared as `[signed|unsigned] char
39+
*`. Swift `Unsafe[Mutable]Pointer<T>` can also be passed to C
40+
function arguments with an integer type that differs from `T` only
41+
in its signedness.
42+
43+
For example, after importing a C function declaration:
44+
```c
45+
long long decode_int64(const char *ptr_to_int64);
46+
```
47+
Swift can now directly pass a raw pointer as the function argument:
48+
```swift
49+
func decodeAsInt64(data: Data) -> Int64 {
50+
data.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in
51+
decode_int64(bytes.baseAddress!)
52+
}
53+
}
54+
```
55+
856
* [SE-0315][]:
957

1058
Type expressions and annotations can now include "type placeholders" which
@@ -34,6 +82,23 @@ Swift 5.6
3482
Swift 5.5
3583
---------
3684

85+
### 2021-09-20 (Xcode 13.0)
86+
87+
* [SE-0323][]:
88+
89+
The main function is executed with `MainActor` isolation applied, so functions
90+
and variables with `MainActor` isolation may be called and modified
91+
synchronously from the main function. If the main function is annotated with a
92+
global actor explicitly, it must be the main actor or an error is emitted. If
93+
no global actor annotation is present, the main function is implicitly run on
94+
the main actor.
95+
96+
The main function is executed synchronously up to the first suspension point.
97+
Any tasks enqueued by initializers in Objective-C or C++ will run after the
98+
main function runs to the first suspension point. At the suspension point, the
99+
main function suspends and the tasks are executed according to the Swift
100+
concurrency mechanisms.
101+
37102
* [SE-0313][]:
38103

39104
Parameters of actor type can be declared as `isolated`, which means that they
@@ -8694,6 +8759,8 @@ Swift 1.0
86948759
[SE-0313]: <https://github.com/apple/swift-evolution/blob/main/proposals/0313-actor-isolation-control.md>
86958760
[SE-0315]: <https://github.com/apple/swift-evolution/blob/main/proposals/0315-placeholder-types.md>
86968761
[SE-0316]: <https://github.com/apple/swift-evolution/blob/main/proposals/0316-global-actors.md>
8762+
[SE-0324]: <https://github.com/apple/swift-evolution/blob/main/proposals/0324-c-lang-pointer-arg-conversion.md>
8763+
[SE-0323]: <https://github.com/apple/swift-evolution/blob/main/proposals/0323-async-main-semantics.md>
86978764

86988765
[SR-75]: <https://bugs.swift.org/browse/SR-75>
86998766
[SR-106]: <https://bugs.swift.org/browse/SR-106>

CMakeLists.txt

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
cmake_minimum_required(VERSION 3.19.6)
22

3+
4+
# set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 1)
5+
36
# TODO: Fix RPATH usage to be CMP0068 compliant
47
# Disable Policy CMP0068 for CMake 3.9
58
# rdar://37725888
@@ -196,9 +199,13 @@ set(SWIFT_TOOLS_ENABLE_LTO OFF CACHE STRING "Build Swift tools with LTO. One
196199
no effect on the target libraries (the standard library and the runtime).")
197200

198201
# NOTE: We do not currently support building libswift with the Xcode generator.
199-
cmake_dependent_option(SWIFT_TOOLS_ENABLE_LIBSWIFT
200-
"Enable building libswift and linking libswift into the compiler itself." FALSE
201-
"NOT CMAKE_GENERATOR STREQUAL \"Xcode\"" FALSE)
202+
cmake_dependent_option(LIBSWIFT_BUILD_MODE "How to build libswift. Possible values are
203+
OFF: the compiler is built without libswift
204+
HOSTTOOLS: libswift is built with a pre-installed toolchain
205+
BOOTSTRAPPING: libswift is built with a 2-stage bootstrapping process
206+
BOOTSTRAPPING-WITH-HOSTLIBS: libswift is built with a 2-stage bootstrapping process,
207+
but the compiler links against the host system swift libs (macOS only)"
208+
OFF "NOT CMAKE_GENERATOR STREQUAL \"Xcode\"" OFF)
202209

203210
# The following only works with the Ninja generator in CMake >= 3.0.
204211
set(SWIFT_PARALLEL_LINK_JOBS "" CACHE STRING
@@ -390,13 +397,25 @@ option(SWIFT_CHECK_INCREMENTAL_COMPILATION
390397
"Check if incremental compilation works when compiling the Swift libraries"
391398
FALSE)
392399

400+
option(SWIFT_ENABLE_ARRAY_COW_CHECKS
401+
"Compile the stdlib with Array COW checks enabled (only relevant for assert builds)"
402+
FALSE)
403+
393404
option(SWIFT_REPORT_STATISTICS
394405
"Create json files which contain internal compilation statistics"
395406
FALSE)
396407

397-
option(SWIFT_DISABLE_OBJC_INTEROP
398-
"Disable Objective-C interoperability even on platforms what would normally have it"
399-
FALSE)
408+
# Only Darwin platforms enable ObjC interop by default.
409+
if("${SWIFT_HOST_VARIANT_SDK}" MATCHES "(OSX|IOS*|TVOS*|WATCHOS*)")
410+
set(SWIFT_STDLIB_ENABLE_OBJC_INTEROP_default TRUE)
411+
else()
412+
set(SWIFT_STDLIB_ENABLE_OBJC_INTEROP_default FALSE)
413+
endif()
414+
415+
# Used by stdlib/toolchain as well, so this cannot be in stdlib/CMakeLists.txt
416+
option(SWIFT_STDLIB_ENABLE_OBJC_INTEROP
417+
"Should stdlib be built with Obj-C interop."
418+
"${SWIFT_STDLIB_ENABLE_OBJC_INTEROP_default}")
400419

401420
#
402421
# User-configurable experimental options. Do not use in production builds.
@@ -487,7 +506,7 @@ endif()
487506
# Use dispatch as the system scheduler by default.
488507
# For convenience, we set this to false when concurrency is disabled.
489508
set(SWIFT_CONCURRENCY_USES_DISPATCH FALSE)
490-
if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND NOT SWIFT_STDLIB_SINGLE_THREADED_RUNTIME)
509+
if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY AND "${SWIFT_CONCURRENCY_GLOBAL_EXECUTOR}" STREQUAL "dispatch")
491510
set(SWIFT_CONCURRENCY_USES_DISPATCH TRUE)
492511
endif()
493512

@@ -506,6 +525,18 @@ if(SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
506525
endif()
507526
endif()
508527

528+
set(SWIFT_STDLIB_AVAILABILITY_DEFINITIONS
529+
"SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2"
530+
"SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0"
531+
"SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4"
532+
"SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0"
533+
"SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5"
534+
"SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0"
535+
"SwiftStdlib 5.6:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999"
536+
"SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999" # Unknown future release
537+
CACHE STRING
538+
"Availability macros for stdlib versions")
539+
509540
#
510541
# Include CMake modules
511542
#
@@ -589,6 +620,20 @@ set(SWIFT_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin")
589620
set(SWIFT_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib")
590621
if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "")
591622
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "${SWIFT_RUNTIME_OUTPUT_INTDIR}")
623+
set(SWIFT_EXEC_FOR_LIBSWIFT "${CMAKE_Swift_COMPILER}")
624+
elseif(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING" OR LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING-WITH-HOSTLIBS")
625+
# If cross-compiling we don't have to bootstrap. We can just use the previously
626+
# built native swiftc to build libswift.
627+
message(STATUS "Building libswift with native host tools instead of bootstrapping")
628+
set(LIBSWIFT_BUILD_MODE "HOSTTOOLS")
629+
set(SWIFT_EXEC_FOR_LIBSWIFT "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc")
630+
endif()
631+
632+
if(LIBSWIFT_BUILD_MODE STREQUAL "HOSTTOOLS" OR LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING-WITH-HOSTLIBS")
633+
if(SWIFT_ENABLE_ARRAY_COW_CHECKS)
634+
message(STATUS "array COW checks disabled when building libswift with host libraries")
635+
set(SWIFT_ENABLE_ARRAY_COW_CHECKS FALSE)
636+
endif()
592637
endif()
593638

594639
# This setting causes all CMakeLists.txt to automatically have
@@ -933,7 +978,7 @@ if(SWIFT_INCLUDE_TOOLS)
933978
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
934979
message(STATUS " Assertions: ${LLVM_ENABLE_ASSERTIONS}")
935980
message(STATUS " LTO: ${SWIFT_TOOLS_ENABLE_LTO}")
936-
message(STATUS " libswift: ${SWIFT_TOOLS_ENABLE_LIBSWIFT}")
981+
message(STATUS " libswift: ${LIBSWIFT_BUILD_MODE}")
937982
message(STATUS "")
938983
else()
939984
message(STATUS "Not building host Swift tools")
@@ -1040,6 +1085,9 @@ if(SWIFT_ENABLE_DISPATCH)
10401085
include(Libdispatch)
10411086
endif()
10421087

1088+
add_bootstrapping_target(0)
1089+
add_bootstrapping_target(1)
1090+
10431091
# Add all of the subdirectories, where we actually do work.
10441092

10451093
###############

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@
1717

1818
| **OS** | **Architecture** | **Build** |
1919
|---|:---:|:---:|
20-
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le)|
21-
|**[Ubuntu 18.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_18.04_docker.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-18.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-18.04-aarch64)|
22-
|**[Ubuntu 20.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_20.04_docker.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-20.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-20.04-aarch64)|
23-
|**[CentOS 8 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_centos_8_docker.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-centos8-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-centos8-aarch64)|
24-
|**[Amazon Linux 2](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_amazon_linux_2_docker.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-amazon-linux-2-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-amazon-linux-2-aarch64)|
25-
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|
26-
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64)|
27-
|**[Windows 2019 (VS 2017)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_windows_2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-windows-x86_64)|
28-
|**[Windows 2019 (VS 2019)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_windows_2019_VS2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019)|
20+
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le)|
21+
|**[Ubuntu 18.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/aarch64_ubuntu_18.04_docker.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-18.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-18.04-aarch64)|
22+
|**[Ubuntu 20.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/aarch64_ubuntu_20.04_docker.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-20.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-20.04-aarch64)|
23+
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|
24+
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64)|
25+
|**[Windows 2019 (VS 2017)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/x86_64_windows_2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-windows-x86_64)|
26+
|**[Windows 2019 (VS 2019)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/x86_64_windows_2019_VS2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019)|
2927

3028
## Welcome to Swift
3129

benchmark/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ set(SWIFT_BENCH_MODULES
5959
single-source/CharacterProperties
6060
single-source/Chars
6161
single-source/ClassArrayGetter
62-
single-source/Codable
62+
single-source/CodableTest
6363
single-source/Combos
6464
single-source/DataBenchmarks
6565
single-source/DeadArray
@@ -76,7 +76,7 @@ set(SWIFT_BENCH_MODULES
7676
single-source/DictionaryCopy
7777
single-source/DictionaryGroup
7878
single-source/DictionaryKeysContains
79-
single-source/DictionaryLiteral
79+
single-source/DictionaryLiteralTest
8080
single-source/DictionaryOfAnyHashableStrings
8181
single-source/DictionaryRemove
8282
single-source/DictionarySubscriptDefault
@@ -112,11 +112,11 @@ set(SWIFT_BENCH_MODULES
112112
single-source/LuhnAlgoLazy
113113
single-source/MapReduce
114114
single-source/Memset
115-
single-source/Mirror
115+
single-source/MirrorTest
116116
single-source/MonteCarloE
117117
single-source/MonteCarloPi
118118
single-source/NSDictionaryCastToSwift
119-
single-source/NSError
119+
single-source/NSErrorTest
120120
single-source/NSStringConversion
121121
single-source/NibbleSort
122122
single-source/NIOChannelPipeline
@@ -143,7 +143,7 @@ set(SWIFT_BENCH_MODULES
143143
single-source/ProtocolConformance
144144
single-source/ProtocolDispatch
145145
single-source/ProtocolDispatch2
146-
single-source/Queue
146+
single-source/QueueTest
147147
single-source/RC4
148148
single-source/RGBHistogram
149149
single-source/Radix2CooleyTukey
@@ -186,7 +186,7 @@ set(SWIFT_BENCH_MODULES
186186
single-source/StringSwitch
187187
single-source/StringTests
188188
single-source/StringWalk
189-
single-source/Substring
189+
single-source/SubstringTest
190190
single-source/Suffix
191191
single-source/SuperChars
192192
single-source/TwoSum

benchmark/README.md

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,30 @@ benchmarks will be compiled with -Onone!**
199199
* `$ ./Benchmark_O --tags=Dictionary`
200200
* `$ ./Benchmark_O --skip-tags=unstable,skip,validation`
201201

202-
### Note
202+
### Deterministic Hashing Requirement
203+
204+
To run benchmarks, you'll need to disable randomized hash seeding by setting the
205+
`SWIFT_DETERMINISTIC_HASHING` environment variable to `1`. (You only need to do
206+
this when running the benchmark executables directly -- the driver script does
207+
this for you automatically.)
208+
209+
* `$ env SWIFT_DETERMINISTIC_HASHING=1 ./Benchmark_O --num-iters=1 --num-samples=1`
210+
211+
This makes for more stable results, by preventing random hash collision changes
212+
from affecting benchmark measurements. Benchmark measurements start by checking
213+
that deterministic hashing is enabled and they fail with a runtime trap when it
214+
isn't.
215+
216+
If for some reason you want to run the benchmarks using standard randomized
217+
hashing, you can disable this check by passing the
218+
`--allow-nondeterministic-hashing` option to the executable.
219+
220+
* `$ ./Benchmark_O --num-iters=1 --num-samples=1 --allow-nondeterministic-hashing`
221+
222+
This will affect the reliability of measurements, so this is not recommended.
223+
224+
### Benchmarking by Numbers
225+
203226
As a shortcut, you can also refer to benchmarks by their ordinal numbers.
204227
These are printed out together with benchmark names and tags using the
205228
`--list` parameter. For a complete list of all available performance tests run
@@ -290,16 +313,18 @@ If needed you can multiply N by a fixed amount (e.g. `1...100*N`) to achieve thi
290313
// rdar://problem/00000000
291314
import TestsUtils
292315
293-
public let YourTestName = BenchmarkInfo(
294-
name: "YourTestName",
295-
runFunction: run_YourTestName,
296-
tags: [.regression])
316+
public let benchmarks = [
317+
BenchmarkInfo(
318+
name: "YourTestName",
319+
runFunction: run_YourTestName,
320+
tags: [.regression])
321+
]
297322
298323
@inline(never)
299-
public func run_YourTestName(N: Int) {
324+
public func run_YourTestName(n: Int) {
300325
# Declare variables
301326
302-
for i in 1...N {
327+
for i in 1...n {
303328
# Perform work
304329
305330
# Verify work was done; break otherwise

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ function (swift_benchmark_compile_archopts)
683683
${objcfile}
684684
"-o" "${OUTPUT_EXEC}"
685685
COMMAND
686-
"codesign" "-f" "-s" "-" "${OUTPUT_EXEC}")
686+
"${srcdir}/../utils/swift-darwin-postprocess.py" "${OUTPUT_EXEC}")
687687
else()
688688
# TODO: rpath.
689689
add_custom_command(

benchmark/cxx-source/CreateObjects.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
import TestsUtils
1717
import CxxCreateObjects
1818

19-
public let CreateObjects = BenchmarkInfo(
20-
name: "CreateObjects",
21-
runFunction: run_CreateObjects,
22-
tags: [.validation, .bridging])
19+
public let benchmarks = [
20+
BenchmarkInfo(
21+
name: "CreateObjects",
22+
runFunction: run_CreateObjects,
23+
tags: [.validation, .bridging])
24+
]
2325

2426
@inline(never)
25-
public func run_CreateObjects(_ N: Int) {
26-
for i in 0...(N * 10_000) {
27+
public func run_CreateObjects(_ n: Int) {
28+
for i in 0...(n * 10_000) {
2729
let x = Int32(i)
2830
let f = CxxLoadableIntWrapper(value: x)
2931
blackHole(f)

0 commit comments

Comments
 (0)