Skip to content

Commit a948931

Browse files
committed
---
yaml --- r: 349588 b: refs/heads/master-next c: b088547 h: refs/heads/master
1 parent bc0434c commit a948931

19 files changed

+163
-108
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: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: a3dfad6a2b63f143baf539d583f40eaac1037b37
3+
refs/heads/master-next: b08854787cb740de90673b0782b14a44ea6bb5aa
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/include/swift/AST/Attr.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,7 @@ SIMPLE_DECL_ATTR(_weakLinked, WeakLinked,
362362
OnSubscript | OnConstructor | OnEnumElement | OnExtension | UserInaccessible,
363363
75)
364364
SIMPLE_DECL_ATTR(frozen, Frozen,
365-
OnEnum | OnStruct |
366-
UserInaccessible,
365+
OnEnum | OnStruct,
367366
76)
368367
DECL_ATTR_ALIAS(_frozen, Frozen)
369368
SIMPLE_DECL_ATTR(_forbidSerializingReference, ForbidSerializingReference,

branches/master-next/lib/ClangImporter/ImportDecl.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,12 +2872,8 @@ namespace {
28722872
enumDecl->computeType();
28732873

28742874
// Annotate as 'frozen' if appropriate.
2875-
assert((DeclAttribute::getOptions(DAK_Frozen) &
2876-
DeclAttribute::UserInaccessible) &&
2877-
"Once 'frozen' is supported, the attribute should not be "
2878-
"implicit (below)");
28792875
if (enumKind == EnumKind::FrozenEnum)
2880-
enumDecl->getAttrs().add(new (C) FrozenAttr(/*implicit*/true));
2876+
enumDecl->getAttrs().add(new (C) FrozenAttr(/*implicit*/false));
28812877

28822878
// Set up the C underlying type as its Swift raw type.
28832879
enumDecl->setRawType(underlyingType);

branches/master-next/lib/Parse/ParseDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4094,7 +4094,7 @@ parseDeclTypeAlias(Parser::ParseDeclOptions Flags, DeclAttributes &Attributes) {
40944094
ParserPosition startPosition = getParserPosition();
40954095
llvm::Optional<SyntaxParsingContext> TmpCtxt;
40964096
TmpCtxt.emplace(SyntaxContext);
4097-
TmpCtxt->setTransparent();
4097+
TmpCtxt->setBackTracking();
40984098

40994099
SourceLoc TypeAliasLoc = consumeToken(tok::kw_typealias);
41004100
SourceLoc EqualLoc;
@@ -4131,13 +4131,13 @@ parseDeclTypeAlias(Parser::ParseDeclOptions Flags, DeclAttributes &Attributes) {
41314131
}
41324132

41334133
if (Flags.contains(PD_InProtocol) && !genericParams && !Tok.is(tok::equal)) {
4134-
TmpCtxt->setBackTracking();
41354134
TmpCtxt.reset();
41364135
// If we're in a protocol and don't see an '=' this looks like leftover Swift 2
41374136
// code intending to be an associatedtype.
41384137
backtrackToPosition(startPosition);
41394138
return parseDeclAssociatedType(Flags, Attributes);
41404139
}
4140+
TmpCtxt->setTransparent();
41414141
TmpCtxt.reset();
41424142

41434143
auto *TAD = new (Context) TypeAliasDecl(TypeAliasLoc, EqualLoc, Id, IdLoc,

branches/master-next/lib/Parse/ParseStmt.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ ParserStatus Parser::parseExprOrStmt(ASTNode &Result) {
122122

123123
if (Tok.is(tok::pound) && Tok.isAtStartOfLine() &&
124124
peekToken().is(tok::code_complete)) {
125+
SyntaxParsingContext CCCtxt(SyntaxContext, SyntaxContextKind::Decl);
125126
consumeToken();
126127
if (CodeCompletion)
127128
CodeCompletion->completeAfterPoundDirective();

branches/master-next/lib/Parse/ParsedRawSyntaxNode.cpp

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,37 +56,34 @@ void ParsedRawSyntaxNode::dump() const {
5656
}
5757

5858
void ParsedRawSyntaxNode::dump(llvm::raw_ostream &OS, unsigned Indent) const {
59-
auto indent = [&](unsigned Amount) {
60-
for (decltype(Amount) i = 0; i < Amount; ++i) {
61-
OS << ' ';
62-
}
63-
};
64-
65-
indent(Indent);
66-
67-
if (isNull()) {
68-
OS << "(<NULL>)";
69-
return;
70-
}
71-
59+
for (decltype(Indent) i = 0; i < Indent; ++i)
60+
OS << ' ';
7261
OS << '(';
7362
dumpSyntaxKind(OS, getKind());
7463

75-
if (isToken()) {
76-
dumpTokenKind(OS, getTokenKind());
77-
78-
} else {
79-
if (isRecorded()) {
80-
OS << " [recorded]";
81-
} else if (isDeferredLayout()) {
64+
switch (DK) {
65+
case DataKind::Null:
66+
OS << "<NULL>";
67+
break;
68+
case DataKind::Recorded:
69+
OS << " [recorded] ";
70+
if (isToken()) {
71+
dumpTokenKind(OS, getTokenKind());
72+
} else {
73+
OS << "<layout>";
74+
}
75+
break;
76+
case DataKind::DeferredLayout:
77+
OS << " [deferred]";
8278
for (const auto &child : getDeferredChildren()) {
8379
OS << "\n";
84-
child.dump(OS, Indent + 1);
80+
child.dump(OS, Indent + 2);
8581
}
86-
} else {
87-
assert(isDeferredToken());
88-
OS << " [deferred token]";
89-
}
82+
break;
83+
case DataKind::DeferredToken:
84+
OS << " [deferred] ";
85+
dumpTokenKind(OS, getTokenKind());
86+
break;
9087
}
9188
OS << ')';
9289
}

branches/master-next/lib/Parse/SyntaxParsingContext.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -257,20 +257,12 @@ ParsedRawSyntaxNode SyntaxParsingContext::finalizeSourceFile() {
257257
ParsedRawSyntaxNode EOFToken = Parts.back();
258258
Parts = Parts.drop_back();
259259

260-
for (auto RawNode : Parts) {
261-
if (RawNode.getKind() != SyntaxKind::CodeBlockItem) {
262-
// FIXME: Skip toplevel garbage nodes for now. we shouldn't emit them in
263-
// the first place.
264-
if (RawNode.isRecorded())
265-
getSyntaxCreator().finalizeNode(RawNode.getOpaqueNode());
266-
continue;
267-
}
268-
269-
AllTopLevel.push_back(RawNode);
270-
}
260+
assert(llvm::all_of(Parts, [](const ParsedRawSyntaxNode& node) {
261+
return node.getKind() == SyntaxKind::CodeBlockItem;
262+
}) && "all top level element must be 'CodeBlockItem'");
271263

272264
auto itemList = Recorder.recordRawSyntax(SyntaxKind::CodeBlockItemList,
273-
AllTopLevel);
265+
Parts);
274266
return Recorder.recordRawSyntax(SyntaxKind::SourceFile,
275267
{ itemList, EOFToken });
276268
}
@@ -304,7 +296,7 @@ void SyntaxParsingContext::synthesize(tok Kind, SourceLoc Loc) {
304296
void SyntaxParsingContext::dumpStorage() const {
305297
llvm::errs() << "======================\n";
306298
for (auto Node : getStorage()) {
307-
Node.dump();
299+
Node.dump(llvm::errs());
308300
llvm::errs() << "\n--------------\n";
309301
}
310302
}

branches/master-next/test/ClangImporter/enum-exhaustivity.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
// CHECK-NEXT: case B
88
// CHECK-NEXT: {{^}$}}
99

10-
// Note that we don't print '@frozen' here yet.
11-
// CHECK-LABEL: {{^}}enum ExhaustiveEnum : {{.+}} {
10+
// CHECK-LABEL: {{^}}@frozen enum ExhaustiveEnum : {{.+}} {
1211
// CHECK: case A
1312
// CHECK-NEXT: case B
1413
// CHECK-NEXT: {{^}$}}

branches/master-next/test/IDE/complete_decl_attribute.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct MyStruct {}
9494
// KEYWORD4-NEXT: Keyword/None: dynamicCallable[#Enum Attribute#]; name=dynamicCallable
9595
// KEYWORD4-NEXT: Keyword/None: dynamicMemberLookup[#Enum Attribute#]; name=dynamicMemberLookup
9696
// KEYWORD4-NEXT: Keyword/None: usableFromInline[#Enum Attribute#]; name=usableFromInline
97+
// KEYWORD4-NEXT: Keyword/None: frozen[#Enum Attribute#]; name=frozen
9798
// KEYWORD4-NEXT: Keyword/None: propertyWrapper[#Enum Attribute#]; name=propertyWrapper
9899
// KEYWORD4-NEXT: Keyword/None: _functionBuilder[#Enum Attribute#]; name=_functionBuilder
99100
// KEYWORD4-NEXT: End completions
@@ -105,6 +106,7 @@ struct MyStruct {}
105106
// KEYWORD5-NEXT: Keyword/None: dynamicCallable[#Struct Attribute#]; name=dynamicCallable
106107
// KEYWORD5-NEXT: Keyword/None: dynamicMemberLookup[#Struct Attribute#]; name=dynamicMemberLookup
107108
// KEYWORD5-NEXT: Keyword/None: usableFromInline[#Struct Attribute#]; name=usableFromInline
109+
// KEYWORD5-NEXT: Keyword/None: frozen[#Struct Attribute#]; name=frozen
108110
// KEYWORD5-NEXT: Keyword/None: propertyWrapper[#Struct Attribute#]; name=propertyWrapper
109111
// KEYWORD5-NEXT: Keyword/None: _functionBuilder[#Struct Attribute#]; name=_functionBuilder
110112
// KEYWORD5-NEXT: End completions
@@ -263,6 +265,7 @@ func dummy2() {}
263265
// KEYWORD_LAST-NEXT: Keyword/None: usableFromInline[#Declaration Attribute#]; name=usableFromInline{{$}}
264266
// KEYWORD_LAST-NEXT: Keyword/None: discardableResult[#Declaration Attribute#]; name=discardableResult
265267
// KEYWORD_LAST-NEXT: Keyword/None: GKInspectable[#Declaration Attribute#]; name=GKInspectable{{$}}
268+
// KEYWORD_LAST-NEXT: Keyword/None: frozen[#Declaration Attribute#]; name=frozen
266269
// KEYWORD_LAST-NEXT: Keyword/None: propertyWrapper[#Declaration Attribute#]; name=propertyWrapper
267270
// KEYWORD_LAST-NEXT: Keyword/None: _functionBuilder[#Declaration Attribute#]; name=_functionBuilder{{$}}
268271
// KEYWORD_LAST-NEXT: Keyword/None: IBSegueAction[#Declaration Attribute#]; name=IBSegueAction{{$}}

branches/master-next/test/Syntax/serialize_tupletype.swift.result

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
null,
1818
null,
1919
{
20-
"id": 1,
20+
"id": 33,
2121
"tokenKind": {
2222
"kind": "kw_typealias"
2323
},
@@ -48,7 +48,7 @@
4848
"presence": "Present"
4949
},
5050
{
51-
"id": 2,
51+
"id": 34,
5252
"tokenKind": {
5353
"kind": "identifier",
5454
"text": "x"
@@ -64,11 +64,11 @@
6464
},
6565
null,
6666
{
67-
"id": 34,
67+
"id": 32,
6868
"kind": "TypeInitializerClause",
6969
"layout": [
7070
{
71-
"id": 3,
71+
"id": 1,
7272
"tokenKind": {
7373
"kind": "equal"
7474
},
@@ -82,11 +82,11 @@
8282
"presence": "Present"
8383
},
8484
{
85-
"id": 33,
85+
"id": 31,
8686
"kind": "TupleType",
8787
"layout": [
8888
{
89-
"id": 20,
89+
"id": 18,
9090
"tokenKind": {
9191
"kind": "l_paren"
9292
},
@@ -95,16 +95,16 @@
9595
"presence": "Present"
9696
},
9797
{
98-
"id": 31,
98+
"id": 29,
9999
"kind": "TupleTypeElementList",
100100
"layout": [
101101
{
102-
"id": 26,
102+
"id": 24,
103103
"kind": "TupleTypeElement",
104104
"layout": [
105105
null,
106106
{
107-
"id": 21,
107+
"id": 19,
108108
"tokenKind": {
109109
"kind": "identifier",
110110
"text": "b"
@@ -115,7 +115,7 @@
115115
},
116116
null,
117117
{
118-
"id": 22,
118+
"id": 20,
119119
"tokenKind": {
120120
"kind": "colon"
121121
},
@@ -129,11 +129,11 @@
129129
"presence": "Present"
130130
},
131131
{
132-
"id": 24,
132+
"id": 22,
133133
"kind": "SimpleTypeIdentifier",
134134
"layout": [
135135
{
136-
"id": 23,
136+
"id": 21,
137137
"tokenKind": {
138138
"kind": "identifier",
139139
"text": "Int"
@@ -149,7 +149,7 @@
149149
null,
150150
null,
151151
{
152-
"id": 25,
152+
"id": 23,
153153
"tokenKind": {
154154
"kind": "comma"
155155
},
@@ -166,12 +166,12 @@
166166
"presence": "Present"
167167
},
168168
{
169-
"id": 30,
169+
"id": 28,
170170
"kind": "TupleTypeElement",
171171
"layout": [
172172
null,
173173
{
174-
"id": 27,
174+
"id": 25,
175175
"tokenKind": {
176176
"kind": "kw__"
177177
},
@@ -181,7 +181,7 @@
181181
},
182182
null,
183183
{
184-
"id": 22,
184+
"id": 20,
185185
"tokenKind": {
186186
"kind": "colon"
187187
},
@@ -195,11 +195,11 @@
195195
"presence": "Present"
196196
},
197197
{
198-
"id": 29,
198+
"id": 27,
199199
"kind": "SimpleTypeIdentifier",
200200
"layout": [
201201
{
202-
"id": 28,
202+
"id": 26,
203203
"tokenKind": {
204204
"kind": "identifier",
205205
"text": "String"
@@ -222,7 +222,7 @@
222222
"presence": "Present"
223223
},
224224
{
225-
"id": 32,
225+
"id": 30,
226226
"tokenKind": {
227227
"kind": "r_paren"
228228
},

0 commit comments

Comments
 (0)