Skip to content

Commit 6f201db

Browse files
committed
[CodeCompletion] Don't restore the parser position after the second pass
This is just not necessary. This parser lives only for the single second pass.
1 parent 8fae089 commit 6f201db

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

lib/Parse/Parser.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,8 @@ void Parser::performCodeCompletionSecondPassImpl(
143143
// Disable libSyntax creation in the delayed parsing.
144144
SyntaxContext->disable();
145145

146-
auto BeginParserPosition = getParserPosition(info.BodyPos);
147-
148-
// ParserPositionRAII needs a primed parser to restore to.
149-
if (Tok.is(tok::NUM_TOKENS))
150-
consumeTokenWithoutFeedingReceiver();
151-
152-
// Ensure that we restore the parser state at exit.
153-
ParserPositionRAII PPR(*this);
154-
155-
// Rewind to the beginning of the top-level code.
156-
restoreParserPosition(BeginParserPosition);
146+
// Set the parser position to the start of the delayed decl or the body.
147+
restoreParserPosition(getParserPosition(info.BodyPos));
157148

158149
// Do not delay parsing in the second pass.
159150
llvm::SaveAndRestore<bool> DisableDelayedBody(DelayBodyParsing, false);

0 commit comments

Comments
 (0)