Skip to content

Commit 7fb16b8

Browse files
authored
Merge pull request #5 from apple/master
ddd
2 parents 7fc998c + 3091ee3 commit 7fb16b8

File tree

1,973 files changed

+69529
-44286
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,973 files changed

+69529
-44286
lines changed

.dir-locals.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
(fill-column . 80)
2121
(c-file-style . "swift"))
2222
(c++-mode
23-
(whitespace-style face lines indentation:space))
23+
(whitespace-style face lines indentation:space)
24+
(flycheck-clang-language-standard . "c++14"))
2425
(c-mode
2526
(whitespace-style face lines indentation:space))
2627
(objc-mode

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
| Contents |
88
| :--------------------- |
9+
| [Swift 5.0](#swift-50) |
910
| [Swift 4.1](#swift-41) |
1011
| [Swift 4.0](#swift-40) |
1112
| [Swift 3.1](#swift-31) |
@@ -19,9 +20,36 @@ CHANGELOG
1920

2021
</details>
2122

23+
Swift 5.0
24+
---------
25+
26+
* C macros containing casts are no longer imported to Swift if the type in the
27+
cast is unavailable or deprecated, or produces some other diagnostic when
28+
referenced. (These macros were already only imported under very limited
29+
circumstances with very simple values, so this is unlikely to affect
30+
real-world code.)
31+
32+
2233
Swift 4.1
2334
---------
2435

36+
* [SE-0189][]
37+
38+
If an initializer is declared in a different module from a struct, it must
39+
use `self.init(…)` or `self = …` before returning or accessing `self`.
40+
Failure to do so will produce a warning in Swift 4 and an error in Swift 5.
41+
This is to keep a client app from accidentally depending on a library's
42+
implementation details, and matches an existing restriction for classes,
43+
where cross-module initializers must be convenience initializers.
44+
45+
This will most commonly affect code that extends a struct imported from C.
46+
However, most imported C structs are given a zeroing no-argument initializer,
47+
which can be called as `self.init()` before modifying specific properties.
48+
49+
Swift library authors who wish to continue allowing initialization on a
50+
per-member basis should explicitly declare a public memberwise initializer
51+
for clients in other modules to use.
52+
2553
* [SE-0166][] / [SE-0143][]
2654

2755
The standard library now defines the conformances of `Optional`,
@@ -6828,4 +6856,10 @@ Swift 1.0
68286856
[SE-0184]: <https://github.com/apple/swift-evolution/blob/master/proposals/0184-unsafe-pointers-add-missing.md>
68296857
[SE-0185]: <https://github.com/apple/swift-evolution/blob/master/proposals/0185-synthesize-equatable-hashable.md>
68306858
[SE-0186]: <https://github.com/apple/swift-evolution/blob/master/proposals/0186-remove-ownership-keyword-support-in-protocols.md>
6859+
[SE-0187]: <https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md>
68316860
[SE-0188]: <https://github.com/apple/swift-evolution/blob/master/proposals/0188-stdlib-index-types-hashable.md>
6861+
[SE-0189]: <https://github.com/apple/swift-evolution/blob/master/proposals/0189-restrict-cross-module-struct-initializers.md>
6862+
[SE-0190]: <https://github.com/apple/swift-evolution/blob/master/proposals/0190-target-environment-platform-condition.md>
6863+
[SE-0191]: <https://github.com/apple/swift-evolution/blob/master/proposals/0191-eliminate-indexdistance.md>
6864+
[SE-0192]: <https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md>
6865+
[SE-0193]: <https://github.com/apple/swift-evolution/blob/master/proposals/0193-cross-module-inlining-and-specialization.md>

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ option(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT
207207
"Whether to enable CrashReporter integration"
208208
FALSE)
209209

210+
option(SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
211+
"Enable the Swift stable ABI's class marker bit"
212+
FALSE)
213+
210214
set(SWIFT_DARWIN_XCRUN_TOOLCHAIN "XcodeDefault" CACHE STRING
211215
"The name of the toolchain to pass to 'xcrun'")
212216

@@ -292,6 +296,10 @@ option(SWIFT_STDLIB_ENABLE_SIL_OWNERSHIP
292296
"Build the standard libraries and overlays with sil ownership enabled."
293297
FALSE)
294298

299+
option(SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS
300+
"Build the standard libraries, overlays, and runtime with normal arguments at +0"
301+
FALSE)
302+
295303
#
296304
# End of user-configurable options.
297305
#

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
| | **Swift** | **Package** |
66
|---|:---:|:---:|
7-
|**macOS** |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-osx/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-osx)|[![Build Status](https://ci.swift.org/job/oss-swift-package-osx/badge/icon)](https://ci.swift.org/job/oss-swift-package-osx)|
7+
|**macOS** |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-osx/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-osx)|[![Build Status](https://ci.swift.org/job/oss-swift-package-osx/badge/icon)](https://ci.swift.org/job/oss-swift-package-osx)|
88
|**Ubuntu 14.04** |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04)|
99
|**Ubuntu 16.04** |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
1010
|**Ubuntu 16.10** |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_10/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_10)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_10/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_10)|
@@ -54,7 +54,7 @@ supported host development operating systems.
5454

5555
#### macOS
5656

57-
To build for macOS, you need [Xcode 9.2 beta 2](https://developer.apple.com/xcode/downloads/).
57+
To build for macOS, you need [Xcode 9.3 beta](https://developer.apple.com/xcode/downloads/).
5858
The required version of Xcode changes frequently, and is often a beta release.
5959
Check this document or the host information on <https://ci.swift.org> for the
6060
current required version.
@@ -114,7 +114,7 @@ options such as building a Swift-compatible LLDB, building the Swift Package
114114
Manager, building for various platforms, running tests after builds, and more.
115115

116116
There are two primary build systems to use: Xcode and Ninja. The Xcode build
117-
system allows you to work in Xcode.app, but Ninja is a bit faster and supports
117+
system allows you to work in Xcode, but Ninja is a bit faster and supports
118118
more environments.
119119

120120
To build using Ninja, run:
@@ -143,7 +143,7 @@ information, see the inline help:
143143
#### Xcode
144144

145145
To build using Xcode, specify the `--xcode` argument on any of the above commands.
146-
Xcode.app can be used to edit the Swift source code, but it is not currently
146+
Xcode can be used to edit the Swift source code, but it is not currently
147147
fully supported as a build environment for SDKs other than macOS. The generated
148148
Xcode project does not integrate with the test runner, but the tests can be run
149149
with the 'check-swift' target.
@@ -159,7 +159,7 @@ helps to save this directory as an environment variable for future use.
159159

160160
#### Ninja
161161

162-
Once the first build has completed, ninja can perform fast incremental builds of
162+
Once the first build has completed, Ninja can perform fast incremental builds of
163163
various products. These incremental builds are a big timesaver when developing
164164
and debugging.
165165

@@ -210,17 +210,19 @@ See [docs/Testing.md](docs/Testing.md), in particular the section on [lit.py](do
210210

211211
## Learning More
212212

213-
Be sure to look through the [docs/] docs directory for more information about the
214-
compiler. In particular, the document on [Debugging The Compiler](docs/DebuggingTheCompiler.rst),
215-
and [Continuous Integration.md](docs/ContinuousIntegration.md) are very helpful
216-
to understand before submitting your first PR.
213+
Be sure to look through the [docs](https://github.com/apple/swift/tree/master/docs)
214+
directory for more information about the compiler. In particular, the documents
215+
titled [Debugging the Swift Compiler](docs/DebuggingTheCompiler.rst) and
216+
[Continuous Integration for Swift](docs/ContinuousIntegration.md) are very
217+
helpful to understand before submitting your first PR.
217218

218219
### Building Documentation
219220

220221
To read the compiler documentation, start by installing the
221-
[Sphinx](http://sphinx-doc.org) documentation generator tool by running the command:
222+
[Sphinx](http://sphinx-doc.org) documentation generator tool by running the
223+
command:
222224

223-
`easy_install -U Sphinx`
225+
easy_install -U Sphinx
224226

225227
Once complete, you can build the Swift documentation by changing directory into
226228
[docs](https://github.com/apple/swift/tree/master/docs) and typing `make`. This

benchmark/CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,22 @@ set(SWIFT_BENCH_MODULES
4040
single-source/ArrayOfRef
4141
single-source/ArraySetElement
4242
single-source/ArraySubscript
43+
single-source/BinaryFloatingPointConversionFromBinaryInteger
4344
single-source/BitCount
4445
single-source/ByteSwap
46+
single-source/COWTree
4547
single-source/CString
48+
single-source/CSVParsing
4649
single-source/Calculator
4750
single-source/CaptureProp
4851
single-source/CharacterLiteralsLarge
4952
single-source/CharacterLiteralsSmall
53+
single-source/CharacterProperties
5054
single-source/Chars
5155
single-source/ClassArrayGetter
56+
single-source/Combos
5257
single-source/DeadArray
58+
single-source/DictOfArraysToArrayOfDicts
5359
single-source/DictTest
5460
single-source/DictTest2
5561
single-source/DictTest3
@@ -59,6 +65,7 @@ set(SWIFT_BENCH_MODULES
5965
single-source/DictionaryRemove
6066
single-source/DictionarySubscriptDefault
6167
single-source/DictionarySwap
68+
single-source/DoubleWidthDivision
6269
single-source/DropFirst
6370
single-source/DropLast
6471
single-source/DropWhile
@@ -75,13 +82,16 @@ set(SWIFT_BENCH_MODULES
7582
single-source/Join
7683
single-source/LazyFilter
7784
single-source/LinkedList
85+
single-source/LuhnAlgoEager
86+
single-source/LuhnAlgoLazy
7887
single-source/MapReduce
7988
single-source/Memset
8089
single-source/MonteCarloE
8190
single-source/MonteCarloPi
8291
single-source/NSDictionaryCastToSwift
8392
single-source/NSError
8493
single-source/NSStringConversion
94+
single-source/NibbleSort
8595
single-source/NopDeinit
8696
single-source/ObjectAllocation
8797
single-source/ObjectiveCBridging
@@ -92,7 +102,9 @@ set(SWIFT_BENCH_MODULES
92102
single-source/ObserverPartiallyAppliedMethod
93103
single-source/ObserverUnappliedMethod
94104
single-source/OpenClose
105+
single-source/PartialApplyDynamicType
95106
single-source/Phonebook
107+
single-source/PointerArithmetics
96108
single-source/PolymorphicCalls
97109
single-source/PopFront
98110
single-source/PopFrontGeneric
@@ -105,9 +117,11 @@ set(SWIFT_BENCH_MODULES
105117
single-source/RGBHistogram
106118
single-source/RangeAssignment
107119
single-source/RangeIteration
120+
single-source/RangeReplaceableCollectionPlusDefault
108121
single-source/RecursiveOwnedParameter
109122
single-source/ReduceInto
110123
single-source/ReversedCollections
124+
single-source/RomanNumbers
111125
single-source/SetTests
112126
single-source/SevenBoom
113127
single-source/Sim2DArray
@@ -124,6 +138,7 @@ set(SWIFT_BENCH_MODULES
124138
single-source/StringEnum
125139
single-source/StringInterpolation
126140
single-source/StringMatch
141+
single-source/StringRemoveDupes
127142
single-source/StringTests
128143
single-source/StringWalk
129144
single-source/Substring
@@ -133,6 +148,7 @@ set(SWIFT_BENCH_MODULES
133148
single-source/TypeFlood
134149
single-source/UTF8Decode
135150
single-source/Walsh
151+
single-source/WordCount
136152
single-source/XorLoop
137153
)
138154

@@ -217,6 +233,20 @@ option(SWIFT_BENCHMARK_GENERATE_OPT_VIEW
217233
"Produce optimization view for benchmarks"
218234
FALSE)
219235

236+
set(SWIFT_BENCHMARK_OPT_VIEWER "" CACHE FILEPATH
237+
"Path to opt-viewer")
238+
239+
if(SWIFT_BENCHMARK_OPT_VIEWER)
240+
# If the path to the opt-viewer was specified manually and we have no access
241+
# to the LLVM tree, assume we have the modules for the opt-viewer installed.
242+
if(SWIFT_BENCHMARK_BUILT_STANDALONE)
243+
set(LLVM_HAVE_OPT_VIEWER_MODULES 1)
244+
endif()
245+
else()
246+
set (SWIFT_BENCHMARK_OPT_VIEWER
247+
"${LLVM_BUILD_MAIN_SRC_DIR}/tools/opt-viewer/opt-viewer.py")
248+
endif()
249+
220250
# Options for other configurations
221251
set(BENCHOPTS_MULTITHREADED
222252
"-whole-module-optimization" "-num-threads" "4")

benchmark/README.md

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,6 @@ of some benchmarks.
111111
** FIXME ** `gyb` should be invoked automatically during the
112112
build so that manually invoking `generate_harness.py` is not required.
113113

114-
### Generating harness files
115-
116-
To generate `CMakeLists.txt` and `utils/main.swift` from test sources, run the
117-
command:
118-
119-
$ scripts/generate_harness/generate_harness.py
120-
121-
### Modifying CMakeLists.txt or utils/main.swift
122-
123-
To make changes to `CMakeLists.txt` or `utils/main.swift`, modify the template
124-
files `CMakeLists.txt.gyb` and `main.swift.gyb` These are templates, rendered by
125-
`gyb` in `generate_harness.py`, so ensure static changes don't interfere
126-
with the template portions. Test changes by
127-
[regenerating the harness](#generating-harness-files) and rebuilding the
128-
repository with `build-script`.
129-
130114
Adding New Benchmarks
131115
---------------------
132116

@@ -136,9 +120,8 @@ To add a new single file test:
136120

137121
1. Add a new Swift file (`YourTestNameHere.swift`), built according to
138122
the template below, to the `single-source` directory.
139-
2. Regenerate harness files by following the directions in
140-
[Generating harness files](#generating-harness-files) before committing
141-
changes.
123+
2. Add the filename of the new Swift file to CMakeLists.txt
124+
3. Edit `main.swift`. Import and register your new Swift module.
142125

143126
To add a new multiple file test:
144127

@@ -151,17 +134,19 @@ To add a new multiple file test:
151134
|   |   +-- TestFile2.swift
152135
|   |   +-- TestFile3.swift
153136

154-
At least one run function (specified in the template below) must
155-
exist in the files.
137+
At least one file must define a public `YourTestName` variable, initialized to an
138+
instance of BenchmarkInfo (specified in the template below).
139+
140+
2. In `CMakeLists.txt` add the new directory name to
141+
`SWIFT_MULTISOURCE_SWIFT3_BENCHES`, and set `YourTestName_sources` to the
142+
list of source file paths.
156143

157-
2. Regenerate harness files by following the directions in
158-
[Generating harness files](#generating-harness-files) before committing
159-
changes.
144+
3. Edit `main.swift`. Import and register your new Swift module.
160145

161146
**Note:**
162147

163-
The generator script looks for functions prefixed with `run_` in order to
164-
populate `utils/main.swift`.
148+
The benchmark harness will execute the routine referenced by
149+
`BenchmarkInfo.runFunction`.
165150

166151
The benchmark driver will measure the time taken for `N = 1` and automatically calculate
167152
the necessary number of iterations `N` to run each benchmark in approximately one second,
@@ -175,14 +160,18 @@ If needed you can multiply N by a fixed amount (e.g. `1...100*N`) to achieve thi
175160
**Performance Test Template**
176161

177162
``` {.sourceCode .swift}
178-
// YourTestNameHere benchmark
163+
// YourTestName benchmark
179164
//
180165
// rdar://problem/00000000
181-
import Foundation
182166
import TestsUtils
183167
168+
public let YourTestName = BenchmarkInfo(
169+
name: "YourTestName",
170+
runFunction: run_YourTestName,
171+
tags: [.regression])
172+
184173
@inline(never)
185-
public func run_YourTestNameHere(N: Int) {
174+
public func run_YourTestName(N: Int) {
186175
# Declare variables
187176
188177
for i in 1...N {
@@ -194,3 +183,6 @@ public func run_YourTestNameHere(N: Int) {
194183
# Assert with CheckResults that work was done
195184
}
196185
```
186+
187+
The current set of tags are defined by the `BenchmarkCategory` enum in
188+
`TestsUtils.swift` .

0 commit comments

Comments
 (0)