Skip to content

Commit 3288fe3

Browse files
authored
Merge pull request #20236 from rintaro/lexer-gettokenat
[Lexer] Micro optimization for getTokenAt()
2 parents 5655b35 + 4f05802 commit 3288fe3

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/Parse/Lexer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,7 @@ Token Lexer::getTokenAt(SourceLoc Loc) {
267267
HashbangMode::Allowed, CommentRetentionMode::None,
268268
TriviaRetentionMode::WithoutTrivia);
269269
L.restoreState(State(Loc));
270-
Token Result;
271-
L.lex(Result);
272-
return Result;
270+
return L.peekNextToken();
273271
}
274272

275273
void Lexer::formToken(tok Kind, const char *TokStart) {

0 commit comments

Comments
 (0)