Skip to content

Commit 46d994f

Browse files
committed
[Parse] Sink all SIL parsing into SILParserTUState.
...in preparation for extracting SIL parsing into its own library.
1 parent 45acc5b commit 46d994f

File tree

4 files changed

+202
-199
lines changed

4 files changed

+202
-199
lines changed

include/swift/Parse/Parser.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -866,18 +866,6 @@ class Parser {
866866
ParserResult<PrecedenceGroupDecl>
867867
parseDeclPrecedenceGroup(ParseDeclOptions flags, DeclAttributes &attributes);
868868

869-
//===--------------------------------------------------------------------===//
870-
// SIL Parsing.
871-
872-
bool parseDeclSIL();
873-
bool parseDeclSILStage();
874-
bool parseSILVTable();
875-
bool parseSILGlobal();
876-
bool parseSILWitnessTable();
877-
bool parseSILDefaultWitnessTable();
878-
bool parseSILCoverageMap();
879-
bool parseSILScope();
880-
881869
//===--------------------------------------------------------------------===//
882870
// Type Parsing
883871

lib/Parse/ParseDecl.cpp

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
//===----------------------------------------------------------------------===//
1616

1717
#include "swift/Parse/Parser.h"
18+
#include "ParseSIL.h"
1819
#include "swift/Parse/CodeCompletionCallbacks.h"
1920
#include "swift/Parse/DelayedParsingCallbacks.h"
2021
#include "swift/Subsystems.h"
@@ -200,28 +201,33 @@ bool Parser::parseTopLevel() {
200201
// that SIL bodies can only be at the top level.
201202
if (Tok.is(tok::kw_sil)) {
202203
assert(isInSILMode() && "'sil' should only be a keyword in SIL mode");
203-
parseDeclSIL();
204+
SIL->parseDeclSIL(*this);
204205
} else if (Tok.is(tok::kw_sil_stage)) {
205-
assert(isInSILMode() && "'sil' should only be a keyword in SIL mode");
206-
parseDeclSILStage();
206+
assert(isInSILMode() && "'sil_stage' should only be a keyword in SIL mode");
207+
SIL->parseDeclSILStage(*this);
207208
} else if (Tok.is(tok::kw_sil_vtable)) {
208-
assert(isInSILMode() && "'sil' should only be a keyword in SIL mode");
209-
parseSILVTable();
209+
assert(isInSILMode() &&
210+
"'sil_vtable' should only be a keyword in SIL mode");
211+
SIL->parseSILVTable(*this);
210212
} else if (Tok.is(tok::kw_sil_global)) {
211-
assert(isInSILMode() && "'sil' should only be a keyword in SIL mode");
212-
parseSILGlobal();
213+
assert(isInSILMode() &&
214+
"'sil_global' should only be a keyword in SIL mode");
215+
SIL->parseSILGlobal(*this);
213216
} else if (Tok.is(tok::kw_sil_witness_table)) {
214-
assert(isInSILMode() && "'sil' should only be a keyword in SIL mode");
215-
parseSILWitnessTable();
217+
assert(isInSILMode() &&
218+
"'sil_witness_table' should only be a keyword in SIL mode");
219+
SIL->parseSILWitnessTable(*this);
216220
} else if (Tok.is(tok::kw_sil_default_witness_table)) {
217-
assert(isInSILMode() && "'sil' should only be a keyword in SIL mode");
218-
parseSILDefaultWitnessTable();
221+
assert(isInSILMode() &&
222+
"'sil_default_witness_table' should only be a keyword in SIL mode");
223+
SIL->parseSILDefaultWitnessTable(*this);
219224
} else if (Tok.is(tok::kw_sil_coverage_map)) {
220-
assert(isInSILMode() && "'sil' should only be a keyword in SIL mode");
221-
parseSILCoverageMap();
225+
assert(isInSILMode() &&
226+
"'sil_coverage_map' should only be a keyword in SIL mode");
227+
SIL->parseSILCoverageMap(*this);
222228
} else if (Tok.is(tok::kw_sil_scope)) {
223-
assert(isInSILMode() && "'sil' should only be a keyword in SIL mode");
224-
parseSILScope();
229+
assert(isInSILMode() && "'sil_scope' should only be a keyword in SIL mode");
230+
SIL->parseSILScope(*this);
225231
} else {
226232
parseBraceItems(Items,
227233
allowTopLevelCode() ? BraceItemListKind::TopLevelCode

0 commit comments

Comments
 (0)