Skip to content

Commit 26508ca

Browse files
committed
Merge branch 'master' into feature/easier-install
2 parents 2942c32 + 872dc69 commit 26508ca

File tree

201 files changed

+3294
-2009
lines changed

Some content is hidden

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

201 files changed

+3294
-2009
lines changed

Diff for: .gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,9 @@ docs/_build
3636

3737
# Finder metadata
3838
.DS_Store
39+
40+
#==============================================================================#
41+
# Ignore CMake temporary files
42+
#==============================================================================#
43+
CMakeCache.txt
44+
CMakeFiles

Diff for: CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ if(NOT EXISTS "${CLANG_MAIN_INCLUDE_DIR}/clang/AST/Decl.h")
289289
endif()
290290

291291
# This could be computed using ${CMAKE_CFG_INTDIR} if we want to link Swift
292-
# against a mathing LLVM build configuration. However, we usually want to be
292+
# against a matching LLVM build configuration. However, we usually want to be
293293
# flexible and allow linking a debug Swift against optimized LLVM.
294294
set(LLVM_RUNTIME_OUTPUT_INTDIR "${LLVM_BINARY_DIR}")
295295
set(LLVM_LIBRARY_OUTPUT_INTDIR "${LLVM_LIBRARY_DIR}")

Diff for: README.md

+55-18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**Welcome to Swift!**
44

5-
Swift is a high performance systems programming language. It has a clean
5+
Swift is a high-performance system programming language. It has a clean
66
and modern syntax, and offers seamless access to existing C and Objective-C code
77
and frameworks, and is memory safe (by default).
88

@@ -18,20 +18,20 @@ modules, eliminating the need for headers and the code duplication they entail.
1818
To read the documentation, start by installing the Sphinx documentation
1919
generator tool (http://sphinx-doc.org, just run `easy_install -U Sphinx` from
2020
the command line and you're good to go). Once you have that, you can build the
21-
swift documentation by going into `swift/docs` and typing `make`. This compiles
22-
the 'rst' files in the docs directory into HTML in the `swift/docs/_build/html`
21+
Swift documentation by going into `docs` and typing `make`. This compiles
22+
the `.rst` files in the `docs` directory into HTML in the `docs/_build/html`
2323
directory.
2424

25-
Once built, the best place to start is with the swift whitepaper, which gives a
26-
tour of the language (in `swift/docs/_build/html/whitepaper/index.html`).
25+
Once built, the best place to start is with the Swift white paper, which gives a
26+
tour of the language (in `docs/_build/html/whitepaper/index.html`).
2727
Another potentially useful document is `docs/LangRef`, which gives a low level
2828
tour of how the language works from the implementation perspective.
2929

3030
Many of the docs are out of date, but you can see some historical design
3131
documents in the `docs` directory.
3232

33-
Another source of documentation is the standard library itself, located at
34-
`swift/stdlib`. Much of the language is actually implemented in the library
33+
Another source of documentation is the standard library itself, located in
34+
`stdlib`. Much of the language is actually implemented in the library
3535
(including `Int`), and the standard library gives some examples of what can be
3636
expressed today.
3737

@@ -66,9 +66,31 @@ compiler for C++14 support and create a symlink:
6666

6767
### Getting Sources for Swift and Related Projects
6868

69+
For those checking out sources as read-only:
70+
6971
git clone https://github.com/apple/swift.git swift
70-
cd swift
71-
./utils/update-checkout --clone
72+
git clone https://github.com/apple/swift-llvm.git llvm
73+
git clone https://github.com/apple/swift-clang.git clang
74+
git clone https://github.com/apple/swift-lldb.git lldb
75+
git clone https://github.com/apple/swift-cmark.git cmark
76+
git clone https://github.com/apple/swift-llbuild.git llbuild
77+
git clone https://github.com/apple/swift-package-manager.git swiftpm
78+
git clone https://github.com/apple/swift-corelibs-xctest.git
79+
git clone https://github.com/apple/swift-corelibs-foundation.git
80+
81+
For those who plan on regular making direct commits, cloning over
82+
SSH may provide a better experience (which requires uploading
83+
SSH keys to GitHub):
84+
85+
git clone [email protected]:apple/swift.git swift
86+
git clone [email protected]:apple/swift-llvm.git llvm
87+
git clone [email protected]:apple/swift-clang.git clang
88+
git clone [email protected]:apple/swift-lldb.git lldb
89+
git clone [email protected]:apple/swift-cmark.git cmark
90+
git clone [email protected]:apple/swift-llbuild.git llbuild
91+
git clone [email protected]:apple/swift-package-manager.git swiftpm
92+
git clone [email protected]:apple/swift-corelibs-xctest.git
93+
git clone [email protected]:apple/swift-corelibs-foundation.git
7294

7395
[CMake](http://cmake.org) is the core infrastructure used to configure builds of
7496
Swift and its companion projects; at least version 2.8.12.2 is required. Your
@@ -79,18 +101,22 @@ command line tools to your `PATH`:
79101

80102
export PATH=/Applications/CMake.app/Contents/bin:$PATH
81103

82-
[Ninja](http://martine.github.io/ninja/) is the current recommended build system
104+
[Ninja](https://ninja-build.org) is the current recommended build system
83105
for building Swift and is the default configuration generated by CMake. If
84106
you're on OS X or don't install it as part of your Linux distribution, clone
85107
it next to the other projects and it will be bootstrapped automatically:
86108

87109
git clone [email protected]:martine/ninja.git
88110

89-
You can also use a third-party packaging tool like [Homebrew](http://brew.sh) to
90-
install CMake and Ninja on OS X:
111+
You can also install CMake and Ninja on OS X using a third-party
112+
packaging tool like [Homebrew](http://brew.sh)
91113

92114
brew install cmake ninja
93115

116+
…or [MacPorts](https://macports.org).
117+
118+
sudo port install cmake ninja
119+
94120
### Building Swift
95121

96122
The `build-script` is a high-level build automation script that supports basic
@@ -100,30 +126,30 @@ supports presets which you can define for common combinations of build options.
100126

101127
To find out more:
102128

103-
swift/utils/build-script -h
129+
utils/build-script -h
104130

105131
Note: Arguments after "--" above are forwarded to `build-script-impl`, which is
106132
the ultimate shell script that invokes the actual build and test commands.
107133

108134
A basic command to build Swift and run basic tests with Ninja:
109135

110-
swift/utils/build-script -t
136+
utils/build-script -t
111137

112-
## Develop Swift in Xcode
138+
## Developing Swift in Xcode
113139

114140
The Xcode IDE can be used to edit the Swift source code, but it is not currently
115141
fully supported as a build environment for SDKs other than OS X. If you'd like
116142
to build for other SDKs but still use Xcode, once you've built Swift using Ninja
117143
or one of the other supported CMake generators, you can set up an IDE-only Xcode
118144
environment using the build-script's `-X` flag:
119145

120-
swift/utils/build-script -X --skip-build -- --reconfigure
146+
utils/build-script -X --skip-build -- --reconfigure
121147

122-
The `--skip-build` flag tells build-script to only generate the project,
148+
The `--skip-build` flag tells `build-script` to only generate the project,
123149
not build it in its entirety. A bare minimum of LLVM tools will build in order
124150
to configure the Xcode projects.
125151

126-
The `--reconfigure` flag tells build-script-impl to run the CMake configuration
152+
The `--reconfigure` flag tells `build-script-impl` to run the CMake configuration
127153
step even if there is a cached configuration. As you develop in Xcode, you may
128154
need to rerun this from time to time to refresh your generated Xcode project,
129155
picking up new targets, file removals, or file additions.
@@ -135,3 +161,14 @@ See [docs/Testing.rst](docs/Testing.rst).
135161
## Contributing to Swift
136162

137163
Contributions to Swift are welcomed and encouraged! Please see the [Contributing to Swift guide](https://swift.org/contributing/).
164+
165+
To be a truly great community, Swift.org needs to welcome developers from all
166+
walks of life, with different backgrounds, and with a wide range of experience.
167+
A diverse and friendly community will have more great ideas, more unique
168+
perspectives, and produce more great code. We will work diligently to make the
169+
Swift community welcoming to everyone.
170+
171+
To give clarity of what is expected of our members, Swift has adopted the
172+
code of conduct defined by the Contributor Covenant. This document is used
173+
across many open source communities, and we think it articulates our values
174+
well. For more, see [the website](https://swift.org/community/#code-of-conduct).

Diff for: apinotes/README.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# API Notes README
2+
3+
API notes provide a mechanism by which Objective-C APIs can be
4+
annotated with additional semantic information not present within the
5+
original Objective-C headers. This semantic information can then be
6+
used by the Swift compiler when importing the corresponding Objective-C
7+
module to provide a better mapping of Objective-C APIs into Swift.
8+
9+
API notes are organized into a set of `.apinotes` files. Each
10+
`.apinotes` file contains annotations for a single Objective-C module,
11+
written in YAML (FIXME: to be) described below. These YAML sources
12+
must be manually compiled into a binary representation (`.apinotesc`)
13+
that the Swift compiler will lazily load when it builds code, also
14+
described below.
15+
16+
# API Notes YAML Format
17+
18+
TBD...
19+
20+
# Compiling API notes
21+
22+
The Swift compiler lazily loads API notes from compiled API notes
23+
files (`.apinotesc` files) and uses these annotations to affect the
24+
Swift signatures of imported Objective-C APIs. Compiled API notes
25+
files reside in the Swift module directory, i.e., the same directory
26+
where the `.swiftmodule` file would reside for the Swift overlay of
27+
that module. For system modules, the path depends on the platform
28+
and architecture
29+
30+
Platform | Path
31+
:------------- | :-------------
32+
OSX | `$SWIFT_EXEC/lib/swift/macosx/`
33+
iOS (32-bit) | `$SWIFT_EXEC/lib/swift/iphoneos/32`
34+
iOS (64-bit) | `$SWIFT_EXEC/lib/swift/iphoneos`
35+
iOS Simulator (32-bit) | `$SWIFT_EXEC/lib/swift/iphonesimulator/32`
36+
iOS Simulator (64-bit) | `$SWIFT_EXEC/lib/swift/iphonesimulator`
37+
38+
where `$SWIFT_EXEC/bin/swift` is the path to the Swift compiler
39+
executable.
40+
41+
When updating API notes for a system module, recompile the API notes
42+
and place the result in the appropriate directories listed above. The
43+
Swift compiler itself need not be recompiled except in rare cases
44+
where the changes affect how the SDK overlays are built. To recompile
45+
API notes for a given module `$MODULE` and place them into their
46+
47+
### OSX
48+
```
49+
xcrun swift -apinotes -yaml-to-binary -target x86_64-apple-macosx10.10 -o $SWIFT_EXEC/lib/swift/macosx/$MODULE.apinotesc $MODULE.apinotes
50+
```
51+
52+
### iOS (32-bit)
53+
```
54+
xcrun swift -apinotes -yaml-to-binary -target armv7-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphoneos/32/$MODULE.apinotesc $MODULE.apinotes
55+
```
56+
57+
### iOS (64-bit)
58+
```
59+
xcrun swift -apinotes -yaml-to-binary -target arm64-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphoneos/$MODULE.apinotesc $MODULE.apinotes
60+
```
61+
62+
### iOS Simulator (32-bit)
63+
```
64+
xcrun swift -apinotes -yaml-to-binary -target i386-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphonesimulator/32/$MODULE.apinotesc $MODULE.apinotes
65+
```
66+
67+
### iOS Simulator (64-bit)
68+
```
69+
xcrun swift -apinotes -yaml-to-binary -target x64_64-apple-ios7.0 -o $SWIFT_EXEC/lib/swift/iphonesimulator/$MODULE.apinotesc $MODULE.apinotes
70+
```
71+
72+
To add API notes for a system module `$MODULE` that does not have them yet,
73+
create a new source file `$MODULE.apinotes`. Newly-added API notes will require
74+
re-running CMake. Updated API notes will be found by the build system during
75+
the next build.
76+
77+
Note that Swift provides decompilation of binary API notes files via
78+
the `-apinotes -binary-to-yaml` option, which allows one to inspect
79+
the information the compiler is using internally. The order of the
80+
entities in the original YAML input is not preserved, so all entities
81+
in the resulting YAML output are sorted alphabetically.

Diff for: apinotes/README.txt

-74
This file was deleted.

Diff for: cmake/modules/SwiftSharedCMakeConfig.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include(CMakeParseArguments)
22

3-
# Use ${cmake_2_8_12_KEYWORD} intead of KEYWORD in target_link_libraries().
3+
# Use ${cmake_2_8_12_KEYWORD} instead of KEYWORD in target_link_libraries().
44
# These variables are used by LLVM's CMake code.
55
set(cmake_2_8_12_INTERFACE INTERFACE)
66
set(cmake_2_8_12_PRIVATE PRIVATE)
@@ -29,7 +29,7 @@ endif()
2929
# Path to llvm include directory.
3030
#
3131
# [OBJ_ROOT_DIR objRootDir]
32-
# Path tp llvm build tree.
32+
# Path to llvm build tree.
3333
#
3434
# [SOURCE_DIR srcDir]
3535
# Path to llvm source tree.

Diff for: docs/ABI.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Hard Constraints on Resilience
1212
------------------------------
1313

1414
The root of a class hierarchy must remain stable, at pain of
15-
invalidating the metaclass hierarchy. Note a Swift class without an
15+
invalidating the metaclass hierarchy. Note that a Swift class without an
1616
explicit base class is implicitly rooted in the SwiftObject
1717
Objective-C class.
1818

@@ -992,7 +992,7 @@ mangled in to disambiguate.
992992
impl-callee-convention impl-function-attribute* generic-signature? '_'
993993
impl-parameter* '_' impl-result* '_'
994994
impl-callee-convention ::= 't' // thin
995-
impl-callee-convention ::= impl-convention // thick, callee transfered with given convention
995+
impl-callee-convention ::= impl-convention // thick, callee transferred with given convention
996996
impl-convention ::= 'a' // direct, autoreleased
997997
impl-convention ::= 'd' // direct, no ownership transfer
998998
impl-convention ::= 'D' // direct, no ownership transfer,

Diff for: docs/ARCOptimization.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Identity`` (RC Identity) and RC Identity preserving instructions. An instruction
6262
``I`` with n SSA arguments and m SSA results is (i,j) RC Identity preserving if
6363
performing a ``retain_value`` on the ith SSA argument immediately before ``I``
6464
is executed is equivalent to performing a ``retain_value`` on the jth SSA result
65-
of ``I`` immediately following the exection of ``I``. For example in the
65+
of ``I`` immediately following the execution of ``I``. For example in the
6666
following, if::
6767

6868
retain_value %x
@@ -151,7 +151,7 @@ referent. Consider the following sequence of rules:
151151
is deallocated.
152152

153153
(3) A different source-level variable pointing at the same referent
154-
must not be changed/invalidated by such a call
154+
must not be changed/invalidated by such a call.
155155

156156
(4) If such a variable exists, the compiler must guarantee the
157157
refcount is > 1 going into the call.

0 commit comments

Comments
 (0)