Skip to content

Commit d4e7371

Browse files
committed
[ASTGen] Make sure we spin the C++ parser even when we don't use it.
This is a temporary hack; we shouldn't even need to create the C++ parser here.
1 parent 227bc1a commit d4e7371

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/ASTGen/Sources/ASTGen/ASTGen.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public func parseTopLevelSwift(
7070
callback: @convention(c) (UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> Void
7171
) {
7272
let syntax = try! Parser.parse(source: String(cString: buffer))
73-
dump(syntax)
7473
declContext = dc
7574
ASTGenVisitor(ctx: ctx, base: buffer)
7675
.visit(syntax)

lib/Parse/ParseDecl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ void Parser::parseTopLevel(SmallVectorImpl<Decl *> &decls) {
190190
!SourceMgr.hasCodeCompletionBuffer() &&
191191
SF.Kind != SourceFileKind::SIL) {
192192
parseTopLevelSwift(contents.data(), CurDeclContext, &Context, &decls, appendToVector);
193+
194+
// Spin the C++ parser to the end; we won't be using it.
195+
while (!Tok.is(tok::eof)) {
196+
consumeToken();
197+
}
193198
return;
194199
}
195200
#endif

0 commit comments

Comments
 (0)