Skip to content

Commit b099764

Browse files
committed
[ASTGen] Update swift_parse_test_main for ParseSourceFileRequest change
1 parent 0014e38 commit b099764

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/DriverTool/swift_parse_test_main.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ struct LibParseExecutor {
8585
std::unique_ptr<ASTContext> ctx(
8686
ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts,
8787
clangOpts, symbolOpts, casOpts, SM, diagEngine));
88+
auto &eval = ctx->evaluator;
89+
registerParseRequestFunctions(eval);
90+
registerTypeCheckerRequestFunctions(eval);
8891

8992
SourceFile::ParsingOptions parseOpts;
9093
parseOpts |= SourceFile::ParsingFlags::DisablePoundIfEvaluation;
@@ -95,13 +98,9 @@ struct LibParseExecutor {
9598
SourceFile *SF =
9699
new (*ctx) SourceFile(*M, SourceFileKind::Library, bufferID, parseOpts);
97100

98-
Parser parser(bufferID, *SF, /*SILParserState=*/nullptr);
99-
SmallVector<ASTNode> items;
100-
parser.parseTopLevelItems(items);
101+
auto items = evaluateOrDefault(eval, ParseSourceFileRequest{SF}, {}).TopLevelItems;
101102

102103
if (opts.contains(ExecuteOptionFlag::Dump)) {
103-
registerParseRequestFunctions(ctx->evaluator);
104-
registerTypeCheckerRequestFunctions(ctx->evaluator);
105104
for (auto &item : items) {
106105
item.dump(llvm::outs());
107106
}
@@ -161,8 +160,9 @@ struct ASTGenExecutor {
161160
std::unique_ptr<ASTContext> ctx(
162161
ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts,
163162
clangOpts, symbolOpts, casOpts, SM, diagEngine));
164-
registerParseRequestFunctions(ctx->evaluator);
165-
registerTypeCheckerRequestFunctions(ctx->evaluator);
163+
auto &eval = ctx->evaluator;
164+
registerParseRequestFunctions(eval);
165+
registerTypeCheckerRequestFunctions(eval);
166166

167167
SourceFile::ParsingOptions parseOpts;
168168
parseOpts |= SourceFile::ParsingFlags::DisablePoundIfEvaluation;
@@ -173,9 +173,7 @@ struct ASTGenExecutor {
173173
SourceFile *SF =
174174
new (*ctx) SourceFile(*M, SourceFileKind::Library, bufferID, parseOpts);
175175

176-
Parser P(bufferID, *SF, nullptr);
177-
SmallVector<ASTNode> items;
178-
P.parseTopLevelItems(items);
176+
auto items = evaluateOrDefault(eval, ParseSourceFileRequest{SF}, {}).TopLevelItems;
179177

180178
if (opts.contains(ExecuteOptionFlag::Dump)) {
181179
for (auto &item : items) {

0 commit comments

Comments
 (0)