Skip to content

Commit e7e3726

Browse files
committed
---
yaml --- r: 348791 b: refs/heads/master c: 7c1c58e h: refs/heads/master i: 348789: 992a26a 348787: adf49b6 348783: 7237653
1 parent fe62ae9 commit e7e3726

File tree

67 files changed

+962
-1416
lines changed

Some content is hidden

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

67 files changed

+962
-1416
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: 2f3ec72ca9fc6e78f866c93a17f1dcaa7735d1c8
2+
refs/heads/master: 7c1c58ebeb66b1fd16caced7abe79b7a67d832de
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/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.

trunk/include/swift/AST/DiagnosticEngine.h

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,7 @@ namespace swift {
337337
SmallVector<DiagnosticArgument, 3> Args;
338338
SmallVector<CharSourceRange, 2> Ranges;
339339
SmallVector<FixIt, 2> FixIts;
340-
std::vector<Diagnostic> ChildNotes;
341340
SourceLoc Loc;
342-
bool IsChildNote = false;
343341
const Decl *Decl = nullptr;
344342

345343
friend DiagnosticEngine;
@@ -364,13 +362,10 @@ namespace swift {
364362
ArrayRef<DiagnosticArgument> getArgs() const { return Args; }
365363
ArrayRef<CharSourceRange> getRanges() const { return Ranges; }
366364
ArrayRef<FixIt> getFixIts() const { return FixIts; }
367-
ArrayRef<Diagnostic> getChildNotes() const { return ChildNotes; }
368-
bool isChildNote() const { return IsChildNote; }
369365
SourceLoc getLoc() const { return Loc; }
370366
const class Decl *getDecl() const { return Decl; }
371367

372368
void setLoc(SourceLoc loc) { Loc = loc; }
373-
void setIsChildNote(bool isChildNote) { IsChildNote = isChildNote; }
374369
void setDecl(const class Decl *decl) { Decl = decl; }
375370

376371
/// Returns true if this object represents a particular diagnostic.
@@ -391,8 +386,6 @@ namespace swift {
391386
void addFixIt(FixIt &&F) {
392387
FixIts.push_back(std::move(F));
393388
}
394-
395-
void addChildNote(Diagnostic &&D);
396389
};
397390

398391
/// Describes an in-flight diagnostic, which is currently active
@@ -672,8 +665,7 @@ namespace swift {
672665

673666
friend class InFlightDiagnostic;
674667
friend class DiagnosticTransaction;
675-
friend class CompoundDiagnosticTransaction;
676-
668+
677669
public:
678670
explicit DiagnosticEngine(SourceManager &SourceMgr)
679671
: SourceMgr(SourceMgr), ActiveDiagnostic(),
@@ -886,15 +878,6 @@ namespace swift {
886878
return diagnose(decl, Diagnostic(id, std::move(args)...));
887879
}
888880

889-
/// Emit a parent diagnostic and attached notes.
890-
///
891-
/// \param parentDiag An InFlightDiagnostic representing the parent diag.
892-
///
893-
/// \param builder A closure which builds and emits notes to be attached to
894-
/// the parent diag.
895-
void diagnoseWithNotes(InFlightDiagnostic parentDiag,
896-
llvm::function_ref<void(void)> builder);
897-
898881
/// \returns true if diagnostic is marked with PointsToFirstBadToken
899882
/// option.
900883
bool isDiagnosticPointsToFirstBadToken(DiagID id) const;
@@ -922,10 +905,6 @@ namespace swift {
922905
/// Retrieve the active diagnostic.
923906
Diagnostic &getActiveDiagnostic() { return *ActiveDiagnostic; }
924907

925-
/// Generate DiagnosticInfo for a Diagnostic to be passed to consumers.
926-
Optional<DiagnosticInfo>
927-
diagnosticInfoForDiagnostic(const Diagnostic &diagnostic);
928-
929908
/// Send \c diag to all diagnostic consumers.
930909
void emitDiagnostic(const Diagnostic &diag);
931910

@@ -966,7 +945,6 @@ namespace swift {
966945
/// in LIFO order. An open transaction is implicitly committed upon
967946
/// destruction.
968947
class DiagnosticTransaction {
969-
protected:
970948
DiagnosticEngine &Engine;
971949

972950
/// How many tentative diagnostics there were when the transaction
@@ -990,6 +968,7 @@ namespace swift {
990968
Depth(Engine.TransactionCount),
991969
IsOpen(true)
992970
{
971+
assert(!Engine.ActiveDiagnostic);
993972
Engine.TransactionCount++;
994973
}
995974

@@ -1032,61 +1011,6 @@ namespace swift {
10321011
"transactions must be closed LIFO");
10331012
}
10341013
};
1035-
1036-
/// Represents a diagnostic transaction which constructs a compound diagnostic
1037-
/// from any diagnostics emitted inside. A compound diagnostic consists of a
1038-
/// parent error, warning, or remark followed by a variable number of child
1039-
/// notes. The semantics are otherwise the same as a regular
1040-
/// DiagnosticTransaction.
1041-
class CompoundDiagnosticTransaction : public DiagnosticTransaction {
1042-
public:
1043-
explicit CompoundDiagnosticTransaction(DiagnosticEngine &engine)
1044-
: DiagnosticTransaction(engine) {}
1045-
1046-
~CompoundDiagnosticTransaction() {
1047-
if (IsOpen) {
1048-
commit();
1049-
}
1050-
1051-
if (Depth == 0) {
1052-
Engine.TransactionStrings.clear();
1053-
Engine.TransactionAllocator.Reset();
1054-
}
1055-
}
1056-
1057-
void commit() {
1058-
assert(PrevDiagnostics < Engine.TentativeDiagnostics.size() &&
1059-
"CompoundDiagnosticTransaction must contain at least one diag");
1060-
1061-
// The first diagnostic is assumed to be the parent. If this is not an
1062-
// error or warning, we'll assert later when trying to add children.
1063-
Diagnostic &parent = Engine.TentativeDiagnostics[PrevDiagnostics];
1064-
1065-
// Associate the children with the parent.
1066-
for (auto diag =
1067-
Engine.TentativeDiagnostics.begin() + PrevDiagnostics + 1;
1068-
diag != Engine.TentativeDiagnostics.end(); ++diag) {
1069-
diag->setIsChildNote(true);
1070-
parent.addChildNote(std::move(*diag));
1071-
}
1072-
1073-
// Erase the children, they'll be emitted alongside their parent.
1074-
Engine.TentativeDiagnostics.erase(Engine.TentativeDiagnostics.begin() +
1075-
PrevDiagnostics + 1,
1076-
Engine.TentativeDiagnostics.end());
1077-
1078-
DiagnosticTransaction::commit();
1079-
}
1080-
};
1081-
1082-
inline void
1083-
DiagnosticEngine::diagnoseWithNotes(InFlightDiagnostic parentDiag,
1084-
llvm::function_ref<void(void)> builder) {
1085-
CompoundDiagnosticTransaction transaction(*this);
1086-
parentDiag.flush();
1087-
builder();
1088-
}
1089-
10901014
} // end namespace swift
10911015

10921016
#endif

0 commit comments

Comments
 (0)