Skip to content

Commit b02fbcf

Browse files
Merge branch 'master' of https://github.com/apple/swift into SR-11295-warning-unecessary-casts
2 parents 613dd1a + c9d5604 commit b02fbcf

File tree

69 files changed

+1046
-626
lines changed

Some content is hidden

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

69 files changed

+1046
-626
lines changed

docs/WindowsBuild.md

Lines changed: 34 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Visual Studio 2017 or newer is needed to build swift on Windows.
99
installation.
1010

1111
## 2. Clone the repositories
12-
1. Configure git to work with Unix file endings
12+
1. Configure git to work with Unix file endings (ie `git config --global core.autocrlf false`)
1313
1. Create a folder to contain all the Swift repositories
1414
1. Clone `apple/swift-cmark` into a folder named `cmark`
1515
1. Clone `apple/swift-clang` into a folder named `clang`
@@ -51,28 +51,22 @@ git clone https://github.com/curl/curl.git
5151
git clone https://gitlab.gnome.org/GNOME/libxml2.git
5252
```
5353

54-
## 3. Acquire ICU
55-
1. Download ICU from [ICU Project](http://site.icu-project.org) for Windows x64 and extract the folder to a new folder called `thirdparty`. In other words, there should be a folder `S:\thirdparty\icu4c-64_2-Win64-MSVC2017` with the ICU.
56-
1. Add the `bin64` folder to your `Path` environment variable.
54+
## 3. Acquire ICU, SQLite3, curl, libxml2
55+
1. Go to https://dev.azure.com/compnerd/windows-swift and scroll down to "Dependencies" where you'll see bots (hopefully green) for icu, SQLite, curl, and libxml2. Download each of the zip files and copy their contents into S:/Library. The directory structure should resemble:
5756

58-
```cmd
59-
PATH S:\thirdparty\icu4c-64_2-Win64-MSVC2017\bin64;%PATH%
6057
```
61-
62-
## 4. Fetch SQLite3
63-
64-
```powershell
65-
(New-Object System.Net.WebClient).DownloadFile("https://www.sqlite.org/2019/sqlite-amalgamation-3270200.zip", "S:\sqlite-amalgamation-3270200.zip")
66-
Add-Type -A System.IO.Compression.FileSystem
67-
[IO.Compression.ZipFile]::ExtractToDirectory("S:\sqlite-amalgamation-3270200.zip", "S:\")
58+
S:/Library/
59+
/icu-64/usr
60+
/libcurl-development/usr
61+
/libxml2-development/usr
62+
/sqlite-3.28.0/usr
63+
/zlib-1.2.11/usr
6864
```
6965

70-
## 5. Get ready
71-
- From within a **developer** command prompt (not PowerShell nor cmd, but the [Visual Studio Developer Command Prompt](https://msdn.microsoft.com/en-us/library/f35ctcxw.aspx)), execute the following command if you have an x64 PC.
66+
## 4. Get ready
67+
- From within a **NATIVE developer** command prompt (not PowerShell nor cmd, but the [Visual Studio Developer Command Prompt](https://msdn.microsoft.com/en-us/library/f35ctcxw.aspx)), execute the following command if you have an x64 PC (The Native Developer command prompt is situated at "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools\VC\x64 Native Tools Command Prompt for VS 2019.lnk").
7268

73-
```cmd
74-
VsDevCmd -arch=amd64
75-
```
69+
Run this as administrator the first time, for setting up the symlinks below.
7670

7771
If instead you're compiling for a 32-bit Windows target, adapt the `arch` argument to `x86` and run
7872

@@ -98,7 +92,7 @@ mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\swift\stdlib\public\Pla
9892

9993
Warning: Creating the above links usually requires administrator privileges. The quick and easy way to do this is to open a second developer prompt by right clicking whatever shortcut you used to open the first one, choosing Run As Administrator, and pasting the above commands into the resulting window. You can then close the privileged prompt; this is the only step which requires elevation.
10094

101-
## 6. Build LLVM/Clang
95+
## 5. Build LLVM/Clang
10296
- This must be done from within a developer command prompt. Make sure that the build
10397
type for LLVM/Clang is compatible with the build type for Swift. That is,
10498
either build everything `Debug` or some variant of `Release` (e.g. `Release`,
@@ -124,7 +118,7 @@ ninja
124118
```cmd
125119
path S:\b\llvm\bin;%PATH%
126120
```
127-
## 7. Build CMark
121+
## 6. Build CMark
128122
- This must be done from within a developer command prompt.
129123

130124
```cmd
@@ -138,7 +132,7 @@ cmake -G Ninja^
138132
ninja
139133
```
140134

141-
## 8. Build Swift
135+
## 7. Build Swift
142136
- This must be done from within a developer command prompt
143137
- Note that Visual Studio vends a 32-bit python 2.7 installation in `C:\Python27` and a 64-bit python in `C:\Python27amd64`. You may use either one based on your installation.
144138

@@ -157,10 +151,10 @@ cmake -G Ninja^
157151
-DLLVM_DIR=S:\b\llvm\lib\cmake\llvm^
158152
-DClang_DIR=S:\b\llvm\lib\cmake\clang^
159153
-DSWIFT_PATH_TO_LIBDISPATCH_SOURCE="S:\swift-corelibs-libdispatch"^
160-
-DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/thirdparty/icu4c-64_2-Win64-MSVC2017/include"^
161-
-DSWIFT_WINDOWS_x86_64_ICU_UC="S:/thirdparty/icu4c-64_2-Win64-MSVC2017/lib64/icuuc.lib"^
162-
-DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/thirdparty/icu4c-64_2-Win64-MSVC2017/include"^
163-
-DSWIFT_WINDOWS_x86_64_ICU_I18N="S:/thirdparty/icu4c-64_2-Win64-MSVC2017/lib64/icuin.lib"^
154+
-DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-64/usr/include"^
155+
-DSWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-64/usr/lib/icuuc64.lib"^
156+
-DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-64/usr/include"^
157+
-DSWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-64/usr/lib/icuin64.lib"^
164158
-DCMAKE_INSTALL_PREFIX="C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr"^
165159
-DPYTHON_EXECUTABLE=C:\Python27\python.exe^
166160
S:\swift
@@ -178,7 +172,7 @@ ninja
178172
cmake -G "Visual Studio 2017" -A x64 -T "host=x64"^ ...
179173
```
180174

181-
## 9. Build lldb
175+
## 8. Build lldb
182176
- This must be done from within a developer command prompt.
183177

184178
```cmd
@@ -196,16 +190,16 @@ cmake -G Ninja^
196190
ninja
197191
```
198192

199-
## 10. Running tests on Windows
193+
## 9. Running tests on Windows
200194

201195
Running the testsuite on Windows has additional external dependencies.
202196

203197
```cmd
204-
path S:\thirdparty\icu4c-64_2-Win64-MSVC2017\bin64;S:\b\swift\bin;S:\b\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin
198+
path S:\Library\icu-64\usr\bin;S:\b\swift\bin;S:\b\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin
205199
ninja -C S:\b\swift check-swift
206200
```
207201

208-
## 11. Build swift-corelibs-libdispatch
202+
## 10. Build swift-corelibs-libdispatch
209203

210204
```cmd
211205
md "S:\b\libdispatch"
@@ -226,24 +220,7 @@ ninja
226220
path S:\b\libdispatch;S:\b\libdispatch\src;%PATH%
227221
```
228222

229-
## 12. Build curl
230-
231-
```cmd
232-
cd "S:\curl"
233-
.\buildconf.bat
234-
cd winbuild
235-
nmake /f Makefile.vc mode=static VC=15 MACHINE=x64
236-
```
237-
238-
## 13. Build libxml2
239-
240-
```cmd
241-
cd "S:\libxml2\win32"
242-
cscript //E:jscript configure.js iconv=no
243-
nmake /f Makefile.msvc
244-
```
245-
246-
## 14. Build swift-corelibs-foundation
223+
## 11. Build swift-corelibs-foundation
247224

248225
```cmd
249226
md "S:\b\foundation"
@@ -255,7 +232,7 @@ cmake -G Ninja^
255232
-DCURL_LIBRARY="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/lib/libcurl_a.lib"^
256233
-DCURL_INCLUDE_DIR="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/include"^
257234
-DENABLE_TESTING=NO^
258-
-DICU_ROOT="S:/thirdparty/icu4c-64_2-Win64-MSVC2017"^
235+
-DICU_ROOT="S:/Library/icu-64"^
259236
-DLIBXML2_LIBRARY="S:/libxml2/win32/bin.msvc/libxml2_a.lib"^
260237
-DLIBXML2_INCLUDE_DIR="S:/libxml2/include"^
261238
-DFOUNDATION_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch^
@@ -269,7 +246,7 @@ ninja
269246
path S:\b\foundation;%PATH%
270247
```
271248

272-
## 15. Build swift-corelibs-xctest
249+
## 12. Build swift-corelibs-xctest
273250

274251
```cmd
275252
md "S:\b\xctest"
@@ -292,13 +269,13 @@ ninja
292269
path S:\b\xctest;%PATH%
293270
```
294271

295-
## 16. Test XCTest
272+
## 13. Test XCTest
296273

297274
```cmd
298275
ninja -C S:\b\xctest check-xctest
299276
```
300277

301-
## 17. Rebuild Foundation
278+
## 14. Rebuild Foundation
302279

303280
```cmd
304281
cd "S:\b\foundation
@@ -309,7 +286,7 @@ cmake -G Ninja^
309286
-DCURL_LIBRARY="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/lib/libcurl_a.lib"^
310287
-DCURL_INCLUDE_DIR="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/include"^
311288
-DENABLE_TESTING=YES^
312-
-DICU_ROOT="S:/thirdparty/icu4c-64_2-Win64-MSVC2017"^
289+
-DICU_ROOT="S:/Library/icu-64"^
313290
-DLIBXML2_LIBRARY="S:/libxml2/win32/bin.msvc/libxml2_a.lib"^
314291
-DLIBXML2_INCLUDE_DIR="S:/libxml2/include"^
315292
-DFOUNDATION_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch^
@@ -319,27 +296,14 @@ cmake -G Ninja^
319296
ninja
320297
```
321298

322-
## 18. Test Foundation
299+
## 15. Test Foundation
323300

324301
```cmd
325302
cmake --build S:\b\foundation
326303
ninja -C S:\b\foundation test
327304
```
328305

329-
## 19. Build SQLite3
330-
331-
```cmd
332-
md S:\b\sqlite
333-
cd S:\b\sqlite
334-
cl /MD /Ox /Zi /LD /DSQLITE_API=__declspec(dllexport) S:\sqlite-amalgamation-3270200\sqlite3.c
335-
```
336-
337-
- Add SQLite3 to your path:
338-
```cmd
339-
path S:\b\sqlite;%PATH%
340-
```
341-
342-
## 20. Build llbuild
306+
## 16. Build llbuild
343307

344308
```cmd
345309
md S:\b\llbuild
@@ -364,15 +328,15 @@ ninja
364328
path S:\b\llbuild\bin;%PATH%
365329
```
366330

367-
## 21. Build swift-package-manager
331+
## 17. Build swift-package-manager
368332

369333
```cmd
370334
md S:\b\spm
371335
cd S:\b\spm
372336
C:\Python27\python.exe S:\swift-package-manager\Utilities\bootstrap --foundation S:\b\foundation --libdispatch-build-dir S:\b\libdispatch --libdispatch-source-dir S:\swift-corelibs-libdispatch --llbuild-build-dir S:\b\llbuild --llbuild-source-dir S:\llbuild --sqlite-build-dir S:\b\sqlite --sqlite-source-dir S:\sqlite-amalgamation-3270200
373337
```
374338

375-
## 22. Install Swift on Windows
339+
## 18. Install Swift on Windows
376340

377341
- Run ninja install:
378342

@@ -387,5 +351,5 @@ ninja -C S:\b\swift install
387351
If you resume development from a new shell, the path will need to be readjusted. The following will add the correct search order to the path:
388352

389353
```cmd
390-
path S:\thirdparty\icu4c-63_1-Win64-MSVC2017\bin64;S:\b\llvm\bin;S:\b\swift\bin;S:\b\libdispatch;S:\b\libdispatch\src;S:\b\foundation;S:\b\xctest;S:\b\llbuild\bin;S:\b\sqlite;%PATH%;%ProgramFiles%\Git\usr\bin
354+
path S:\Library\icu-64\bin;S:\b\llvm\bin;S:\b\swift\bin;S:\b\libdispatch;S:\b\libdispatch\src;S:\b\foundation;S:\b\xctest;S:\b\llbuild\bin;S:\b\sqlite;%PATH%;%ProgramFiles%\Git\usr\bin
391355
```

include/swift/AST/ASTScope.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,8 +1270,7 @@ class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
12701270
PatternEntryInitializerScope(PatternBindingDecl *pbDecl, unsigned entryIndex,
12711271
DeclVisibilityKind vis)
12721272
: AbstractPatternEntryScope(pbDecl, entryIndex, vis),
1273-
initAsWrittenWhenCreated(
1274-
pbDecl->getPatternList()[entryIndex].getOriginalInit()) {}
1273+
initAsWrittenWhenCreated(pbDecl->getOriginalInit(entryIndex)) {}
12751274
virtual ~PatternEntryInitializerScope() {}
12761275

12771276
protected:

include/swift/AST/ASTTypeIDZone.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ SWIFT_TYPEID_NAMED(GenericTypeParamType *, GenericTypeParamType)
3333
SWIFT_TYPEID_NAMED(InfixOperatorDecl *, InfixOperatorDecl)
3434
SWIFT_TYPEID_NAMED(IterableDeclContext *, IterableDeclContext)
3535
SWIFT_TYPEID_NAMED(ModuleDecl *, ModuleDecl)
36+
SWIFT_TYPEID_NAMED(NamedPattern *, NamedPattern)
3637
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
3738
SWIFT_TYPEID_NAMED(OpaqueTypeDecl *, OpaqueTypeDecl)
3839
SWIFT_TYPEID_NAMED(OperatorDecl *, OperatorDecl)
3940
SWIFT_TYPEID_NAMED(Optional<PropertyWrapperMutability>,
4041
PropertyWrapperMutability)
42+
SWIFT_TYPEID_NAMED(PatternBindingEntry *, PatternBindingEntry)
4143
SWIFT_TYPEID_NAMED(PrecedenceGroupDecl *, PrecedenceGroupDecl)
4244
SWIFT_TYPEID_NAMED(ProtocolDecl *, ProtocolDecl)
4345
SWIFT_TYPEID_NAMED(TypeAliasDecl *, TypeAliasDecl)

include/swift/AST/ASTTypeIDs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ class GenericTypeParamType;
3232
class InfixOperatorDecl;
3333
class IterableDeclContext;
3434
class ModuleDecl;
35+
class NamedPattern;
3536
class NominalTypeDecl;
3637
class OperatorDecl;
3738
class OpaqueTypeDecl;
39+
class PatternBindingEntry;
3840
class ParamDecl;
3941
enum class ParamSpecifier : uint8_t;
4042
class PrecedenceGroupDecl;

0 commit comments

Comments
 (0)