Skip to content

Commit adf49b6

Browse files
author
Harlan Haskins
committed
---
yaml --- r: 348787 b: refs/heads/master c: c090816 h: refs/heads/master i: 348785: 5365a09 348783: 7237653
1 parent 1d7ce58 commit adf49b6

File tree

226 files changed

+6250
-7485
lines changed

Some content is hidden

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

226 files changed

+6250
-7485
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: dd45f56387238f38a0796b4ca554aeddaa78a4cf
2+
refs/heads/master: c0908160a6551a1d27bd2f3e18adcbe4b81339d4
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/CHANGELOG.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ CHANGELOG
44
<details>
55
<summary>Note: This is in reverse chronological order, so newer entries are added to the top.</summary>
66

7-
| Version | Released | Toolchain |
8-
| :--------------------- | :--------- | :---------- |
9-
| [Swift 5.2](#swift-52) | | |
10-
| [Swift 5.1](#swift-51) | 2019-09-20 | Xcode 11.0 |
11-
| [Swift 5.0](#swift-50) | 2019-03-25 | Xcode 10.2 |
12-
| [Swift 4.2](#swift-42) | 2018-09-17 | Xcode 10.0 |
13-
| [Swift 4.1](#swift-41) | 2018-03-29 | Xcode 9.3 |
14-
| [Swift 4.0](#swift-40) | 2017-09-19 | Xcode 9.0 |
15-
| [Swift 3.1](#swift-31) | 2017-03-27 | Xcode 8.3 |
16-
| [Swift 3.0](#swift-30) | 2016-09-13 | Xcode 8.0 |
17-
| [Swift 2.2](#swift-22) | 2016-03-21 | Xcode 7.3 |
18-
| [Swift 2.1](#swift-21) | 2015-10-21 | Xcode 7.1 |
19-
| [Swift 2.0](#swift-20) | 2015-09-17 | Xcode 7.0 |
20-
| [Swift 1.2](#swift-12) | 2015-04-08 | Xcode 6.3 |
21-
| [Swift 1.1](#swift-11) | 2014-12-02 | Xcode 6.1.1 |
22-
| [Swift 1.0](#swift-10) | 2014-09-15 | Xcode 6.0 |
7+
| Contents |
8+
| :--------------------- |
9+
| [Swift Next](#swift-next) |
10+
| [Swift 5.1](#swift-51) |
11+
| [Swift 5.0](#swift-50) |
12+
| [Swift 4.2](#swift-42) |
13+
| [Swift 4.1](#swift-41) |
14+
| [Swift 4.0](#swift-40) |
15+
| [Swift 3.1](#swift-31) |
16+
| [Swift 3.0](#swift-30) |
17+
| [Swift 2.2](#swift-22) |
18+
| [Swift 2.1](#swift-21) |
19+
| [Swift 2.0](#swift-20) |
20+
| [Swift 1.2](#swift-12) |
21+
| [Swift 1.1](#swift-11) |
22+
| [Swift 1.0](#swift-10) |
2323

2424
</details>
2525

26-
Swift 5.2
27-
---------
26+
Swift Next
27+
----------
2828

2929
* [SR-11429][]:
3030

trunk/docs/CToSwiftNameTranslation.md

Lines changed: 3 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -212,29 +212,6 @@ Additionally, typedefs for `void *` or `const void *` that are themselves annota
212212
If a typedef's underlying type is itself a "CF pointer" typedef, the "alias" typedef will be imported as a regular typealias, with the suffix "Ref" still dropped from its name (if present) unless doing so would conflict with another declaration in the same module as the typedef.
213213

214214

215-
## Objective-C Properties
216-
217-
By default, most property names are not transformed at all. However, if the getter of a property overrides a superclass or adopted protocol method that is also a property accessor, the Swift name of the overridden accessor's property will be used for consistency. If there's more than one such name, one is chosen arbitrarily.
218-
219-
Properties with the type `BOOL` or `Boolean` use the name of the getter as the name of the Swift property by default, rather than the name of the property in Objective-C. This accounts for a difference in Swift and Objective-C naming conventions for boolean properties that use "is".
220-
221-
```objc
222-
@property(getter=isContrivedExample) BOOL contrivedExample;
223-
@property BOOL hasAnotherForm;
224-
```
225-
226-
```swift
227-
var isContrivedExample: Bool { get set }
228-
var hasAnotherForm: Bool { get set }
229-
```
230-
231-
_This rule should probably have applied to C's native `bool` as well._
232-
233-
A property declaration with the `SwiftImportPropertyAsAccessors` API note will not be imported at all, and its accessors will be imported as methods. Additionally, properties whose names start with "accessibility" in the NSAccessibility protocol are always imported as methods, as are properties whose names start with "accessibility" in an `@interface` declaration (class or category) that provides the adoption of NSAccessibility.
234-
235-
_Objective-C code has historically not been consistent about whether the NSAccessibility declarations should be considered properties and therefore the Swift compiler chooses to import them as methods, as a sort of lowest common denominator._
236-
237-
238215
## `swift_private`
239216

240217
The `swift_private` Clang attribute prepends `__` onto the base name of any declaration being imported except initializers. For initializers with no arguments, a dummy `Void` argument with the name `__` is inserted; otherwise, the label for the first argument has `__` prepended. This transformation takes place after any other name manipulation, unless the declaration has a custom name. It will not occur if the declaration is an override; in that case the name needs to match the overridden declaration.
@@ -275,8 +252,6 @@ __attribute__((swift_name("SpacecraftCoordinates")))
275252
struct SPKSpacecraftCoordinates {
276253
double x, y, z, t; // space and time, of course
277254
};
278-
279-
// Usually seen as NS_SWIFT_NAME.
280255
```
281256
282257
```swift
@@ -312,10 +287,12 @@ The `swift_name` attribute can be used to give a C function a custom name. The v
312287
```objc
313288
__attribute__((swift_name("doSomething(to:bar:)")))
314289
void doSomethingToFoo(Foo *foo, int bar);
290+
291+
// Usually seen as NS_SWIFT_NAME.
315292
```
316293
317294
```swift
318-
func doSomething(to foo: UnsafeMutablePointer<Foo>, bar: Int32)
295+
func doSomething(foo: UnsafeMutablePointer<Foo>, bar: Int32)
319296
```
320297

321298
An underscore can be used in place of an empty parameter label, as in Swift.
@@ -453,86 +430,4 @@ Although enumerators always have global scope in C, they are often imported as m
453430

454431
_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)._
455432

456-
457-
### Fields of structs and unions; Objective-C properties
458-
459-
The `swift_name` attribute can be applied to rename a struct or union field or an Objective-C property (whether on a class or a protocol). The value of the attribute must be a valid Swift identifier.
460-
461-
```objc
462-
struct SPKSpaceflightBooking {
463-
const SPKLocation * _Nullable destination;
464-
bool roundTrip __attribute__((swift_name("isRoundTrip")));
465-
};
466-
```
467-
468-
```swift
469-
struct SPKSpaceflightBooking {
470-
var destination: UnsafePointer<SPKLocation>?
471-
var isRoundTrip: Bool
472-
}
473-
```
474-
475-
476-
### Objective-C methods
477-
478-
The `swift_name` attribute can be used to give an Objective-C method a custom name. The value of the attribute must be a full Swift function name, including parameter labels.
479-
480-
```objc
481-
- (void)doSomethingToFoo:(Foo *)foo bar:(int)bar
482-
__attribute__((swift_name("doSomethingImportant(to:bar:)")));
483-
```
484-
485-
```swift
486-
func doSomethingImportant(to foo: UnsafeMutablePointer<Foo>, bar: Int32)
487-
```
488-
489-
As with functions, an underscore can be used to represent an empty parameter label.
490-
491-
Methods that follow the NSError out-parameter convention may provide one fewer parameter label than the number of parameters in the original method to indicate that a parameter should be dropped, but they do not have to. The `swift_error` attribute is still respected even when using a custom name for purposes of transforming an NSError out-parameter and the method return type.
492-
493-
```objc
494-
- (BOOL)doSomethingRiskyAndReturnError:(NSError **)error
495-
__attribute__((swift_name("doSomethingRisky()")));
496-
- (BOOL)doSomethingContrived:(NSString *)action error:(NSError **)outError
497-
__attribute__((swift_name("doSomethingContrived(_:error:)")));
498-
```
499-
500-
```swift
501-
func doSomethingRisky() throws
502-
func doSomethingContrived(_ action: String, error: ()) throws
503-
```
504-
505-
A base name of "init" can be used on a *class* method that returns `instancetype` or the containing static type in order to import that method as an initializer. Any other custom name *prevents* a class method from being imported as an initializer even if it would normally be inferred as one.
506-
507-
```objc
508-
+ (Action *)makeActionWithHandler:(void(^)(void))handler
509-
__attribute__((swift_name("init(handler:)")));
510-
+ (instancetype)makeActionWithName:(NSString *)name
511-
__attribute__((swift_name("init(name:)")));
512-
```
513-
514-
```swift
515-
/* non-inherited */ init(handler: () -> Void)
516-
init(name: String)
517-
```
518-
519-
A no-argument method imported as an initializer can be given a dummy argument label to disambiguate it from the no-argument `init()`, whether the method is an init-family instance method or a factory class method in Objective-C.
520-
521-
```objc
522-
- (instancetype)initSafely
523-
__attribute__((swift_name("init(safe:)")));
524-
+ (instancetype)makeDefaultAction
525-
__attribute__((swift_name("init(default:)")));
526-
```
527-
528-
```swift
529-
init(safe: ())
530-
init(default: ())
531-
```
532-
533-
A custom name on an instance method with one of Objective-C's subscript selectors (`objectAtIndexedSubscript:`, `objectForKeyedSubscript:`, `setObject:atIndexedSubscript:`, or `setObject:forKeyedSubscript:`) prevents that method from being imported as a subscript or used as the accessor for another subscript.
534-
535-
_Currently, this only works if *both* methods in a read/write subscript are given custom names; if just one is, a read/write subscript will still be formed. A read-only subscript only has one method to rename._
536-
537-
538433
## More to come...

trunk/docs/WindowsBuild.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,13 @@ cmake -G "Visual Studio 2017" -A x64 -T "host=x64"^ ...
186186
md "S:\b\lldb"
187187
cd "S:\b\lldb"
188188
cmake -G Ninja^
189-
-DLLVM_DIR="S:/b/llvm/lib/cmake/llvm"^
190-
-DClang_DIR="S:/b/llvm/lib/cmake/clang"^
191-
-DSwift_DIR="S:/b/swift/lib/cmake/swift"^
192189
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
193190
-DLLDB_ALLOW_STATIC_BINDINGS=YES^
191+
-DLLDB_PATH_TO_CLANG_SOURCE="S:\clang"^
192+
-DLLDB_PATH_TO_SWIFT_SOURCE="S:\swift"^
193+
-DLLDB_PATH_TO_CLANG_BUILD="S:\b\llvm"^
194+
-DLLDB_PATH_TO_LLVM_BUILD="S:\b\llvm"^
195+
-DLLDB_PATH_TO_SWIFT_BUILD="S:\b\swift"^
194196
-DLLVM_ENABLE_ASSERTIONS=ON^
195197
-DPYTHON_HOME="%ProgramFiles(x86)%\Microsoft Visual Studio\Shared\Python37_64"^
196198
S:\lldb

trunk/include/swift/AST/ASTTypeIDZone.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ SWIFT_TYPEID(Type)
2626
SWIFT_TYPEID(TypePair)
2727
SWIFT_TYPEID_NAMED(CustomAttr *, CustomAttr)
2828
SWIFT_TYPEID_NAMED(Decl *, Decl)
29-
SWIFT_TYPEID_NAMED(EnumDecl *, EnumDecl)
3029
SWIFT_TYPEID_NAMED(GenericParamList *, GenericParamList)
3130
SWIFT_TYPEID_NAMED(GenericTypeParamType *, GenericTypeParamType)
3231
SWIFT_TYPEID_NAMED(InfixOperatorDecl *, InfixOperatorDecl)

trunk/include/swift/AST/ASTTypeIDs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class AbstractFunctionDecl;
2525
class BraceStmt;
2626
class CustomAttr;
2727
class Decl;
28-
class EnumDecl;
2928
class GenericParamList;
3029
class GenericSignature;
3130
class GenericTypeParamType;

trunk/include/swift/AST/Decl.h

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3519,37 +3519,12 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
35193519
class EnumDecl final : public NominalTypeDecl {
35203520
SourceLoc EnumLoc;
35213521

3522-
enum SemanticInfoFlags : uint8_t {
3523-
// Is the raw type valid?
3524-
HasComputedRawType = 1 << 0,
3525-
// Is the complete set of (auto-incremented) raw values available?
3526-
HasFixedRawValues = 1 << 1,
3527-
// Is the complete set of raw values type checked?
3528-
HasFixedRawValuesAndTypes = 1 << 2,
3529-
};
3530-
35313522
struct {
35323523
/// The raw type and a bit to indicate whether the
35333524
/// raw was computed yet or not.
3534-
llvm::PointerIntPair<Type, 3, OptionSet<SemanticInfoFlags>> RawTypeAndFlags;
3535-
3536-
bool hasRawType() const {
3537-
return RawTypeAndFlags.getInt().contains(HasComputedRawType);
3538-
}
3539-
void cacheRawType(Type ty) {
3540-
auto flags = RawTypeAndFlags.getInt() | HasComputedRawType;
3541-
RawTypeAndFlags.setPointerAndInt(ty, flags);
3542-
}
3543-
3544-
bool hasFixedRawValues() const {
3545-
return RawTypeAndFlags.getInt().contains(HasFixedRawValues);
3546-
}
3547-
bool hasCheckedRawValues() const {
3548-
return RawTypeAndFlags.getInt().contains(HasFixedRawValuesAndTypes);
3549-
}
3525+
llvm::PointerIntPair<Type, 1, bool> RawType;
35503526
} LazySemanticInfo;
35513527

3552-
friend class EnumRawValuesRequest;
35533528
friend class EnumRawTypeRequest;
35543529
friend class TypeChecker;
35553530

@@ -3608,9 +3583,6 @@ class EnumDecl final : public NominalTypeDecl {
36083583
Bits.EnumDecl.Circularity = static_cast<unsigned>(circularity);
36093584
}
36103585

3611-
/// Record that this enum has had all of its raw values computed.
3612-
void setHasFixedRawValues();
3613-
36143586
// Implement isa/cast/dyncast/etc.
36153587
static bool classof(const Decl *D) {
36163588
return D->getKind() == DeclKind::Enum;
@@ -3640,11 +3612,9 @@ class EnumDecl final : public NominalTypeDecl {
36403612

36413613
/// Set the raw type of the enum from its inheritance clause.
36423614
void setRawType(Type rawType) {
3643-
auto flags = LazySemanticInfo.RawTypeAndFlags.getInt();
3644-
LazySemanticInfo.RawTypeAndFlags.setPointerAndInt(
3645-
rawType, flags | HasComputedRawType);
3615+
LazySemanticInfo.RawType.setPointerAndInt(rawType, true);
36463616
}
3647-
3617+
36483618
/// True if none of the enum cases have associated values.
36493619
///
36503620
/// Note that this is true for enums with absolutely no cases.
@@ -6384,8 +6354,6 @@ class EnumCaseDecl final : public Decl,
63846354
/// parent EnumDecl, although syntactically they are subordinate to the
63856355
/// EnumCaseDecl.
63866356
class EnumElementDecl : public DeclContext, public ValueDecl {
6387-
friend class EnumRawValuesRequest;
6388-
63896357
/// This is the type specified with the enum element, for
63906358
/// example 'Int' in 'case Y(Int)'. This is null if there is no type
63916359
/// associated with this element, as in 'case Z' or in all elements of enum
@@ -6426,20 +6394,9 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
64266394

64276395
ParameterList *getParameterList() const { return Params; }
64286396

6429-
/// Retrieves a fully typechecked raw value expression associated
6430-
/// with this enum element, if it exists.
6431-
LiteralExpr *getRawValueExpr() const;
6432-
6433-
/// Retrieves a "structurally" checked raw value expression associated
6434-
/// with this enum element, if it exists.
6435-
///
6436-
/// The structural raw value may or may not have a type set, but it is
6437-
/// guaranteed to be suitable for retrieving any non-semantic information
6438-
/// like digit text for an integral raw value or user text for a string raw value.
6439-
LiteralExpr *getStructuralRawValueExpr() const;
6440-
6441-
/// Reset the raw value expression.
6442-
void setRawValueExpr(LiteralExpr *e);
6397+
bool hasRawValueExpr() const { return RawValueExpr; }
6398+
LiteralExpr *getRawValueExpr() const { return RawValueExpr; }
6399+
void setRawValueExpr(LiteralExpr *e) { RawValueExpr = e; }
64436400

64446401
/// Return the containing EnumDecl.
64456402
EnumDecl *getParentEnum() const {
@@ -6462,10 +6419,6 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
64626419
bool isIndirect() const {
64636420
return getAttrs().hasAttribute<IndirectAttr>();
64646421
}
6465-
6466-
/// Do not call this!
6467-
/// It exists to let the AST walkers get the raw value without forcing a request.
6468-
LiteralExpr *getRawValueUnchecked() const { return RawValueExpr; }
64696422

64706423
static bool classof(const Decl *D) {
64716424
return D->getKind() == DeclKind::EnumElement;

trunk/include/swift/AST/DiagnosticConsumer.h

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,10 @@ enum class DiagnosticKind : uint8_t {
3838
Note
3939
};
4040

41-
/// Information about a diagnostic passed to DiagnosticConsumers.
41+
/// Extra information carried along with a diagnostic, which may or
42+
/// may not be of interest to a given diagnostic consumer.
4243
struct DiagnosticInfo {
4344
DiagID ID = DiagID(0);
44-
SourceLoc Loc;
45-
DiagnosticKind Kind;
46-
StringRef FormatString;
47-
ArrayRef<DiagnosticArgument> FormatArgs;
48-
SourceLoc BufferIndirectlyCausingDiagnostic;
49-
50-
/// DiagnosticInfo of notes which are children of this diagnostic, if any
51-
ArrayRef<DiagnosticInfo *> ChildDiagnosticInfo;
5245

5346
/// Represents a fix-it, a replacement of one range of text with another.
5447
class FixIt {
@@ -67,24 +60,6 @@ struct DiagnosticInfo {
6760

6861
/// Extra source ranges that are attached to the diagnostic.
6962
ArrayRef<FixIt> FixIts;
70-
71-
/// This is a note which has a parent error or warning
72-
bool IsChildNote = false;
73-
74-
DiagnosticInfo() {}
75-
76-
DiagnosticInfo(DiagID ID, SourceLoc Loc, DiagnosticKind Kind,
77-
StringRef FormatString,
78-
ArrayRef<DiagnosticArgument> FormatArgs,
79-
SourceLoc BufferIndirectlyCausingDiagnostic,
80-
ArrayRef<DiagnosticInfo *> ChildDiagnosticInfo,
81-
ArrayRef<CharSourceRange> Ranges, ArrayRef<FixIt> FixIts,
82-
bool IsChildNote)
83-
: ID(ID), Loc(Loc), Kind(Kind), FormatString(FormatString),
84-
FormatArgs(FormatArgs),
85-
BufferIndirectlyCausingDiagnostic(BufferIndirectlyCausingDiagnostic),
86-
ChildDiagnosticInfo(ChildDiagnosticInfo), Ranges(Ranges),
87-
FixIts(FixIts), IsChildNote(IsChildNote) {}
8863
};
8964

9065
/// Abstract interface for classes that present diagnostics to the user.

0 commit comments

Comments
 (0)