Skip to content

Commit 16aa9a2

Browse files
committed
---
yaml --- r: 326332 b: refs/heads/master-next c: f1cb0d1 h: refs/heads/master
1 parent 588d96a commit 16aa9a2

File tree

660 files changed

+5935
-11173
lines changed

Some content is hidden

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

660 files changed

+5935
-11173
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: e052da7d8886fa0439677852e8f7830b20c2e1da
3-
refs/heads/master-next: 7ff0007702f501dbbe238a894695bbd7c964fc61
3+
refs/heads/master-next: f1cb0d11eff1adc42b2d0e6cfad9d2e39e74d7b3
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/CHANGELOG.md

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -26,63 +26,6 @@ CHANGELOG
2626
Swift Next
2727
----------
2828

29-
* [SR-11298][]:
30-
31-
A class-constrained protocol extension, where the extended protocol does
32-
not impose a class constraint, will now infer the constraint implicitly.
33-
34-
```swift
35-
protocol Foo {}
36-
class Bar: Foo {
37-
var someProperty: Int = 0
38-
}
39-
40-
// Even though 'Foo' does not impose a class constraint, it is automatically
41-
// inferred due to the Self: Bar constraint.
42-
extension Foo where Self: Bar {
43-
var anotherProperty: Int {
44-
get { return someProperty }
45-
// As a result, the setter is now implicitly nonmutating, just like it would
46-
// be if 'Foo' had a class constraint.
47-
set { someProperty = newValue }
48-
}
49-
}
50-
```
51-
52-
As a result, this could lead to code that currently compiles today to throw an error.
53-
54-
```swift
55-
protocol Foo {
56-
var someProperty: Int { get set }
57-
}
58-
59-
class Bar: Foo {
60-
var someProperty = 0
61-
}
62-
63-
extension Foo where Self: Bar {
64-
var anotherProperty1: Int {
65-
get { return someProperty }
66-
// This will now error, because the protocol requirement
67-
// is implicitly mutating and the setter is implicitly
68-
// nonmutating.
69-
set { someProperty = newValue } // Error
70-
}
71-
}
72-
```
73-
74-
**Workaround**: Define a new mutable variable inside the setter that has a reference to `self`:
75-
76-
```swift
77-
var anotherProperty1: Int {
78-
get { return someProperty }
79-
set {
80-
var mutableSelf = self
81-
mutableSelf.someProperty = newValue // Okay
82-
}
83-
}
84-
```
85-
8629
* [SE-0253][]:
8730

8831
Values of types that declare `func callAsFunction` methods can be called
@@ -108,7 +51,7 @@ Swift Next
10851

10952
* [SR-4206][]:
11053

111-
A method override is no longer allowed to have a generic signature with
54+
A method override is no longer allowed to have a generic signature with
11255
requirements not imposed by the base method. For example:
11356

11457
```
@@ -7822,4 +7765,3 @@ Swift 1.0
78227765
[SR-8974]: <https://bugs.swift.org/browse/SR-8974>
78237766
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
78247767
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
7825-
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>

branches/master-next/README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,12 @@
1818
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_16.04.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64)|
1919
|**[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)|
2020
|**[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)|
21+
|**[Ubuntu 16.04 (TensorFlow)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_tensorflow.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow)|
22+
|**[macOS 10.13 (TensorFlow)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_macos_high_sierra_tensorflow.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-macOS-tensorflow/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-macOS-tensorflow)|
23+
|**[Ubuntu 16.04 (TensorFlow with GPU)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_tensorflow_gpu.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow-gpu/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow-gpu)|
2124
|**[Debian 9.5](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_debian_9.5.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_5/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_5)|
2225
|**[Windows 2019](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)|
2326

24-
**Swift TensorFlow Community-Hosted CI Platforms**
25-
26-
| **OS** | **Architecture** | **Build** |
27-
|---|:---:|:---:|
28-
|**[Ubuntu 16.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_tensorflow.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow)|
29-
|**[macOS 10.13](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_macos_high_sierra_tensorflow.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-macOS-tensorflow/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-macOS-tensorflow)|
30-
|**[Ubuntu 16.04 (GPU)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_tensorflow_gpu.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow-gpu/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow-gpu)|
3127

3228
## Welcome to Swift
3329

branches/master-next/cmake/modules/SwiftHandleGybSources.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
121121
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/DeclNodes.py"
122122
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/ExprNodes.py"
123123
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/GenericNodes.py"
124-
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/NodeSerializationCodes.py"
125124
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/PatternNodes.py"
126-
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/SILOnlyNodes.py"
127125
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/StmtNodes.py"
128126
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/TypeNodes.py"
129127
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/Token.py"

branches/master-next/cmake/modules/SwiftXcodeSupport.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ macro(swift_common_xcode_cxx_config)
100100
# Force usage of Clang.
101101
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0"
102102
CACHE STRING "Xcode Compiler")
103-
# Use C++'14.
104-
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14"
103+
# Use C++'11.
104+
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11"
105105
CACHE STRING "Xcode C++ Language Standard")
106106
# Use libc++.
107107
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++"

branches/master-next/docs/CToSwiftNameTranslation.md

Lines changed: 1 addition & 205 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Name Translation from C to Swift
22

3-
This document gives a high-level description of how C and Objective-C declarations are translated to Swift, with particular focus on how names are adjusted. It is not attempting to be a *complete* description of everything the compiler does except with regards to how *names* are transformed; even there, some special cases that only apply to Apple's SDKs have been omitted. The example code shown is for illustrative purposes and does not always include all parts of an imported API's interface.
3+
This document gives a high-level description of how C and Objective-C declarations are translated to Swift, with particular focus on how names are adjusted. It is not attempting to be a *complete* description of everything the compiler does except with regards to how *names* are transformed; even there, some special cases that only apply to Apple's SDKs have been omitted.
44

55
## Word boundaries
66

@@ -239,208 +239,4 @@ _The original intent of the `swift_private` attribute was additionally to limit
239239
_For "historical reasons", the `swift_private` attribute is ignored on factory methods with no arguments imported as initializers. This is essentially matching the behavior of older Swift compilers for source compatibility in case someone has marked such a factory method as `swift_private`._
240240

241241

242-
## Custom names
243-
244-
The `swift_name` Clang attribute can be used to control how a declaration imports into Swift. If it's valid, the value of the `swift_name` attribute always overrides any other name transformation rules (prefix-stripping, underscore-prepending, etc.)
245-
246-
### Types and globals
247-
248-
The `swift_name` attribute can be used to give a type or a global a custom name. In the simplest form, the value of the attribute must be a valid Swift identifier.
249-
250-
```objc
251-
__attribute__((swift_name("SpacecraftCoordinates")))
252-
struct SPKSpacecraftCoordinates {
253-
double x, y, z, t; // space and time, of course
254-
};
255-
```
256-
257-
```swift
258-
struct SpacecraftCoordinates {
259-
var x, y, z, t: Double
260-
}
261-
```
262-
263-
### Import-as-member
264-
265-
A custom name that starts with an identifier followed by a period is taken to be a member name. The identifier should be the imported Swift name of a C/Objective-C type in the same module. In this case, the type or global will be imported as a static member of the named type.
266-
267-
```objc
268-
__attribute__((swift_name("SpacecraftCoordinates.earth")))
269-
extern const struct SPKSpacecraftCoordinates SPKSpacecraftCoordinatesEarth;
270-
```
271-
272-
```swift
273-
extension SpacecraftCoordinates {
274-
static var earth: SpacecraftCoordinates { get }
275-
}
276-
```
277-
278-
Note that types cannot be imported as members of protocols.
279-
280-
_The "in the same module" restriction is considered a technical limitation; a forward declaration of the base type will work around it._
281-
282-
283-
### C functions with custom names
284-
285-
The `swift_name` attribute can be used to give a C function a custom name. The value of the attribute must be a full Swift function name, including parameter labels.
286-
287-
```objc
288-
__attribute__((swift_name("doSomething(to:bar:)")))
289-
void doSomethingToFoo(Foo *foo, int bar);
290-
291-
// Usually seen as NS_SWIFT_NAME.
292-
```
293-
294-
```swift
295-
func doSomething(foo: UnsafeMutablePointer<Foo>, bar: Int32)
296-
```
297-
298-
An underscore can be used in place of an empty parameter label, as in Swift.
299-
300-
A C function with zero arguments and a non-`void` return type can also be imported as a computed variable by using the `getter:` prefix on the name. A function with one argument and a `void` return type can optionally serve as the setter for that variable using `setter:`.
301-
302-
```objc
303-
__attribute__((swift_name("getter:globalCounter()")))
304-
int getGlobalCounter(void);
305-
__attribute__((swift_name("setter:globalCounter(_:)")))
306-
void setGlobalCounter(int newValue);
307-
```
308-
309-
```swift
310-
var globalCounter: Int32 { get set }
311-
```
312-
313-
Note that the argument lists must still be present even though the name used is the name of the variable. (Also note the `void` parameter list to specify a C function with zero arguments. This is required!)
314-
315-
Variables with setters and no getters are not supported.
316-
317-
318-
#### Import-as-member
319-
320-
Like types and globals, functions can be imported as static members of types.
321-
322-
```objc
323-
__attribute__((swift_name("NSSound.beep()")))
324-
void NSBeep(void);
325-
```
326-
327-
```swift
328-
extension NSSound {
329-
static func beep()
330-
}
331-
```
332-
333-
However, by giving a parameter the label `self`, a function can also be imported as an instance member of a type __T__. In this case, the parameter labeled `self` must either have the type __T__ itself, or be a pointer to __T__. The latter is only valid if __T__ is imported as a value type; if the pointer is non-`const`, the resulting method will be `mutating`. If __T__ is a class, the function will be `final`.
334-
335-
```objc
336-
typedef struct {
337-
int value;
338-
} Counter;
339-
340-
__attribute__((swift_name("Counter.printValue(self:)")))
341-
void CounterPrintValue(Counter c);
342-
__attribute__((swift_name("Counter.printValue2(self:)")))
343-
void CounterPrintValue2(const Counter *c);
344-
__attribute__((swift_name("Counter.resetValue(self:)")))
345-
void CounterResetValue(Counter *c);
346-
```
347-
348-
```swift
349-
struct Counter {
350-
var value: Int32 { get set }
351-
}
352-
353-
extension Counter {
354-
func printValue()
355-
func printValue2()
356-
mutating func resetValue()
357-
}
358-
```
359-
360-
This also applies to getters and setters, to be imported as instance properties.
361-
362-
```objc
363-
__attribute__((swift_name("getter:Counter.absoluteValue(self:)")))
364-
int CounterGetAbsoluteValue(Counter c);
365-
```
366-
367-
```swift
368-
extension Counter {
369-
var absoluteValue: Int32 { get }
370-
}
371-
```
372-
373-
The getter/setter syntax also allows for subscripts by using the base name `subscript`.
374-
375-
```objc
376-
__attribute__((swift_name("getter:LinkedListOfInts.subscript(self:_:)")))
377-
int LinkedListGetAtIndex(const LinkedListOfInts *head, int index);
378-
```
379-
380-
```swift
381-
extension LinkedListOfInts {
382-
subscript(_ index: Int32) -> Int32 { get }
383-
}
384-
```
385-
386-
Finally, functions can be imported as initializers as well by using the base name `init`. These are considered "factory" initializers and are never inherited or overridable. They must not have a `self` parameter.
387-
388-
```objc
389-
__attribute__((swift_name("Counter.init(initialValue:)")))
390-
Counter CounterCreateWithInitialValue(int value);
391-
```
392-
393-
```swift
394-
extension Counter {
395-
/* non-inherited */ init(initialValue value: Int32)
396-
}
397-
```
398-
399-
400-
### Enumerators (enum cases)
401-
402-
The `swift_name` attribute can be used to rename enumerators. As mentioned above, not only does no further prefix-stripping occur on the resulting name, but the presence of a custom name removes the enum case from the computation of a prefix for the other cases.
403-
404-
```
405-
// Actual example from Apple's SDKs; in fact, the first shipping example of
406-
// swift_name on an enumerator at all!
407-
typedef NS_ENUM(NSUInteger, NSXMLNodeKind) {
408-
NSXMLInvalidKind = 0,
409-
NSXMLDocumentKind,
410-
NSXMLElementKind,
411-
NSXMLAttributeKind,
412-
NSXMLNamespaceKind,
413-
NSXMLProcessingInstructionKind,
414-
NSXMLCommentKind,
415-
NSXMLTextKind,
416-
NSXMLDTDKind NS_SWIFT_NAME(DTDKind),
417-
NSXMLEntityDeclarationKind,
418-
NSXMLAttributeDeclarationKind,
419-
NSXMLElementDeclarationKind,
420-
NSXMLNotationDeclarationKind
421-
};
422-
```
423-
424-
```
425-
public enum Kind : UInt {
426-
case invalid
427-
case document
428-
case element
429-
case attribute
430-
case namespace
431-
case processingInstruction
432-
case comment
433-
case text
434-
case DTDKind
435-
case entityDeclaration
436-
case attributeDeclaration
437-
case elementDeclaration
438-
case notationDeclaration
439-
}
440-
```
441-
442-
Although enumerators always have global scope in C, they are often imported as members in Swift, and thus the `swift_name` attribute cannot be used to import them as members of another type unless the enum type is anonymous.
443-
444-
_Currently, `swift_name` does not even allow importing an enum case as a member of the enum type itself, even if the enum is not recognized as an `@objc` enum, error code enum, or option set (i.e. the situation where a case is imported as a global constant)._
445-
446242
## More to come...

branches/master-next/docs/SIL.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ the Swift programming language. SIL accommodates the following use cases:
1717
such as definitive initialization of variables and constructors, code
1818
reachability, switch coverage.
1919
- High-level optimization passes, including retain/release optimization,
20-
dynamic method devirtualization, closure inlining, promoting heap allocations
21-
to stack allocations, promoting stack allocations to SSA registers, scalar
22-
replacement of aggregates (splitting aggregate allocations into multiple
23-
smaller allocations), and generic function instantiation.
20+
dynamic method devirtualization, closure inlining, memory allocation promotion,
21+
and generic function instantiation.
2422
- A stable distribution format that can be used to distribute "fragile"
2523
inlineable or generic code with Swift library modules, to be optimized into
2624
client binaries.

branches/master-next/include/swift/AST/ASTContext.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,6 @@ class ASTContext final {
460460
/// Retrieve the declaration of ObjectiveC.ObjCBool.
461461
StructDecl *getObjCBoolDecl() const;
462462

463-
/// Retrieve the declaration of Foundation.NSCopying.
464-
ProtocolDecl *getNSCopyingDecl() const;
465463
/// Retrieve the declaration of Foundation.NSError.
466464
ClassDecl *getNSErrorDecl() const;
467465
/// Retrieve the declaration of Foundation.NSNumber.

branches/master-next/include/swift/AST/ASTNode.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ namespace swift {
3636
enum class DeclKind : uint8_t;
3737
enum class StmtKind;
3838

39-
struct ASTNode : public llvm::PointerUnion<Expr*, Stmt*, Decl*> {
39+
struct ASTNode : public llvm::PointerUnion3<Expr*, Stmt*, Decl*> {
4040
// Inherit the constructors from PointerUnion.
41-
using PointerUnion::PointerUnion;
42-
41+
using PointerUnion3::PointerUnion3;
42+
4343
SourceRange getSourceRange() const;
4444

4545
/// Return the location of the start of the statement.

0 commit comments

Comments
 (0)