Skip to content

Commit ad5b825

Browse files
rintaroJan Svoboda
authored andcommitted
[Lexer] Don't lex trailing trivia for eof (including artificial eof)
1 parent 02a323e commit ad5b825

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Parse/Lexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ void Lexer::formToken(tok Kind, const char *TokStart) {
299299

300300
StringRef TokenText { TokStart, static_cast<size_t>(CurPtr - TokStart) };
301301

302-
if (TriviaRetention == TriviaRetentionMode::WithTrivia) {
302+
if (TriviaRetention == TriviaRetentionMode::WithTrivia && Kind != tok::eof) {
303303
lexTrivia(TrailingTrivia, /* IsForTrailingTrivia */ true);
304304
}
305305

0 commit comments

Comments
 (0)