Skip to content

Commit 405dd0c

Browse files
committed
Revert "Revert "Merge pull request swiftlang#26664 from rintaro/syntaxparse-memoryleak""
This reverts commit 5559cff.
1 parent 4cd6832 commit 405dd0c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Parse/SyntaxParsingContext.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,13 @@ ParsedRawSyntaxNode SyntaxParsingContext::finalizeSourceFile() {
259259
Parts = Parts.drop_back();
260260

261261
for (auto RawNode : Parts) {
262-
if (RawNode.getKind() != SyntaxKind::CodeBlockItem)
262+
if (RawNode.getKind() != SyntaxKind::CodeBlockItem) {
263263
// FIXME: Skip toplevel garbage nodes for now. we shouldn't emit them in
264264
// the first place.
265+
if (RawNode.isRecorded())
266+
getSyntaxCreator().finalizeNode(RawNode.getOpaqueNode());
265267
continue;
268+
}
266269

267270
AllTopLevel.push_back(RawNode);
268271
}

0 commit comments

Comments
 (0)